You are here

public function PHPExcel_DocumentProperties::setCustomProperty in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/DocumentProperties.php \PHPExcel_DocumentProperties::setCustomProperty()

Set a Custom Property

Parameters

string $propertyName:

mixed $propertyValue:

string $propertyType: 'i' : Integer 'f' : Floating Point 's' : String 'd' : Date/Time 'b' : Boolean

Return value

PHPExcel_DocumentProperties

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/DocumentProperties.php, line 440

Class

PHPExcel_DocumentProperties
PHPExcel_DocumentProperties

Code

public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = NULL) {
  if ($propertyType === NULL || !in_array($propertyType, array(
    self::PROPERTY_TYPE_INTEGER,
    self::PROPERTY_TYPE_FLOAT,
    self::PROPERTY_TYPE_STRING,
    self::PROPERTY_TYPE_DATE,
    self::PROPERTY_TYPE_BOOLEAN,
  ))) {
    if ($propertyValue === NULL) {
      $propertyType = self::PROPERTY_TYPE_STRING;
    }
    elseif (is_float($propertyValue)) {
      $propertyType = self::PROPERTY_TYPE_FLOAT;
    }
    elseif (is_int($propertyValue)) {
      $propertyType = self::PROPERTY_TYPE_INTEGER;
    }
    elseif (is_bool($propertyValue)) {
      $propertyType = self::PROPERTY_TYPE_BOOLEAN;
    }
    else {
      $propertyType = self::PROPERTY_TYPE_STRING;
    }
  }
  $this->_customProperties[$propertyName] = array(
    'value' => $propertyValue,
    'type' => $propertyType,
  );
  return $this;
}