Source for file DocumentProperties.php
Documentation is available at DocumentProperties.php
* Copyright (c) 2006 - 2011 PHPExcel
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.6, 2011-02-27
* PHPExcel_DocumentProperties
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
const PROPERTY_TYPE_BOOLEAN = 'b';
const PROPERTY_TYPE_INTEGER = 'i';
const PROPERTY_TYPE_FLOAT = 'f';
const PROPERTY_TYPE_DATE = 'd';
const PROPERTY_TYPE_STRING = 's';
const PROPERTY_TYPE_UNKNOWN = 'u';
private $_creator = 'Unknown Creator';
private $_lastModifiedBy;
private $_title = 'Untitled Spreadsheet';
private $_description = '';
private $_company = 'Microsoft Corporation';
private $_customProperties = array();
* Create a new PHPExcel_DocumentProperties
$this->_lastModifiedBy = $this->_creator;
$this->_created = time();
$this->_modified = time();
* @return PHPExcel_DocumentProperties
$this->_creator = $pValue;
return $this->_lastModifiedBy;
* @return PHPExcel_DocumentProperties
$this->_lastModifiedBy = $pValue;
* @param datetime $pValue
* @return PHPExcel_DocumentProperties
$this->_created = $pValue;
* @param datetime $pValue
* @return PHPExcel_DocumentProperties
$this->_modified = $pValue;
* @return PHPExcel_DocumentProperties
public function setTitle($pValue = '') {
return $this->_description;
* @return PHPExcel_DocumentProperties
$this->_description = $pValue;
* @return PHPExcel_DocumentProperties
$this->_subject = $pValue;
* @return PHPExcel_DocumentProperties
$this->_keywords = $pValue;
* @return PHPExcel_DocumentProperties
$this->_category = $pValue;
* @return PHPExcel_DocumentProperties
$this->_company = $pValue;
* @return PHPExcel_DocumentProperties
$this->_manager = $pValue;
* Get a List of Custom Property Names
* @return array of string
* Check if a Custom Property is defined
* @param string $propertyName
return isset ($this->_customProperties[$propertyName]);
* Get a Custom Property Value
* @param string $propertyName
if (isset ($this->_customProperties[$propertyName])) {
return $this->_customProperties[$propertyName]['value'];
* Get a Custom Property Type
* @param string $propertyName
if (isset ($this->_customProperties[$propertyName])) {
return $this->_customProperties[$propertyName]['type'];
* @param string $propertyName
* @param mixed $propertyValue
* @param string $propertyType
* @return PHPExcel_DocumentProperties
public function setCustomProperty($propertyName,$propertyValue= '',$propertyType= NULL) {
if ((is_null($propertyType)) || (!in_array($propertyType,array(self::PROPERTY_TYPE_INTEGER,
self::PROPERTY_TYPE_FLOAT,
self::PROPERTY_TYPE_STRING,
self::PROPERTY_TYPE_DATE,
self::PROPERTY_TYPE_BOOLEAN)))) {
$propertyType = self::PROPERTY_TYPE_STRING;
$propertyType = self::PROPERTY_TYPE_FLOAT;
} elseif(is_int($propertyValue)) {
$propertyType = self::PROPERTY_TYPE_INTEGER;
} elseif (is_bool($propertyValue)) {
$propertyType = self::PROPERTY_TYPE_BOOLEAN;
$propertyType = self::PROPERTY_TYPE_STRING;
$this->_customProperties[$propertyName] = array('value' => $propertyValue, 'type' => $propertyType);
* Implement PHP __clone to create a deep clone, not just a shallow copy.
foreach ($vars as $key => $value) {
$this->$key = clone $value;
case 'i1' : // 1-Byte Signed Integer
case 'i2' : // 2-Byte Signed Integer
case 'i4' : // 4-Byte Signed Integer
case 'i8' : // 8-Byte Signed Integer
return (int) $propertyValue;
case 'ui1' : // 1-Byte Unsigned Integer
case 'ui2' : // 2-Byte Unsigned Integer
case 'ui4' : // 4-Byte Unsigned Integer
case 'ui8' : // 8-Byte Unsigned Integer
case 'uint' : // Unsigned Integer
return abs((int) $propertyValue);
case 'r4' : // 4-Byte Real Number
case 'r8' : // 8-Byte Real Number
case 'decimal' : // Decimal
return (float) $propertyValue;
case 'lpwstr' : // LPWSTR
case 'bstr' : // Basic String
case 'date' : // Date and Time
case 'filetime' : // File Time
return ($propertyValue == 'true') ? True : False;
case 'error' : // Error Status Code
case 'vector' : // Vector
case 'blob' : // Binary Blob
case 'oblob' : // Binary Blob Object
case 'stream' : // Binary Stream
case 'ostream' : // Binary Stream Object
case 'storage' : // Binary Storage
case 'ostorage' : // Binary Storage Object
case 'vstream' : // Binary Versioned Stream
case 'clsid' : // Class ID
case 'cf' : // Clipboard Data
case 'i1' : // 1-Byte Signed Integer
case 'i2' : // 2-Byte Signed Integer
case 'i4' : // 4-Byte Signed Integer
case 'i8' : // 8-Byte Signed Integer
case 'ui1' : // 1-Byte Unsigned Integer
case 'ui2' : // 2-Byte Unsigned Integer
case 'ui4' : // 4-Byte Unsigned Integer
case 'ui8' : // 8-Byte Unsigned Integer
case 'uint' : // Unsigned Integer
return self::PROPERTY_TYPE_INTEGER;
case 'r4' : // 4-Byte Real Number
case 'r8' : // 8-Byte Real Number
case 'decimal' : // Decimal
return self::PROPERTY_TYPE_FLOAT;
case 'lpwstr' : // LPWSTR
case 'bstr' : // Basic String
return self::PROPERTY_TYPE_STRING;
case 'date' : // Date and Time
case 'filetime' : // File Time
return self::PROPERTY_TYPE_DATE;
return self::PROPERTY_TYPE_BOOLEAN;
case 'error' : // Error Status Code
case 'vector' : // Vector
case 'blob' : // Binary Blob
case 'oblob' : // Binary Blob Object
case 'stream' : // Binary Stream
case 'ostream' : // Binary Stream Object
case 'storage' : // Binary Storage
case 'ostorage' : // Binary Storage Object
case 'vstream' : // Binary Versioned Stream
case 'clsid' : // Class ID
case 'cf' : // Clipboard Data
return self::PROPERTY_TYPE_UNKNOWN;
return self::PROPERTY_TYPE_UNKNOWN;
|