More PSR-2 changes

This commit is contained in:
MarkBaker 2015-05-12 08:00:59 +01:00
parent c70e289dac
commit 0d855d0627
15 changed files with 2313 additions and 2237 deletions

View File

@ -40,7 +40,7 @@ class PHPExcel_Cell
* *
* @var PHPExcel_Cell_IValueBinder * @var PHPExcel_Cell_IValueBinder
*/ */
private static $_valueBinder = NULL; private static $_valueBinder;
/** /**
* Value of the cell * Value of the cell
@ -59,7 +59,7 @@ class PHPExcel_Cell
* *
* @var mixed * @var mixed
*/ */
private $_calculatedValue = NULL; private $_calculatedValue;
/** /**
* Type of the cell data * Type of the cell data
@ -94,17 +94,20 @@ class PHPExcel_Cell
* *
* @return void * @return void
**/ **/
public function notifyCacheController() { public function notifyCacheController()
{
$this->_parent->updateCacheData($this); $this->_parent->updateCacheData($this);
return $this; return $this;
} }
public function detach() { public function detach()
$this->_parent = NULL; {
$this->_parent = null;
} }
public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent) { public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent)
{
$this->_parent = $parent; $this->_parent = $parent;
} }
@ -117,7 +120,7 @@ class PHPExcel_Cell
* @param PHPExcel_Worksheet $pSheet * @param PHPExcel_Worksheet $pSheet
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function __construct($pValue = NULL, $pDataType = NULL, PHPExcel_Worksheet $pSheet = NULL) public function __construct($pValue = null, $pDataType = null, PHPExcel_Worksheet $pSheet = null)
{ {
// Initialise cell value // Initialise cell value
$this->_value = $pValue; $this->_value = $pValue;
@ -126,9 +129,10 @@ class PHPExcel_Cell
$this->_parent = $pSheet->getCellCacheController(); $this->_parent = $pSheet->getCellCacheController();
// Set datatype? // Set datatype?
if ($pDataType !== NULL) { if ($pDataType !== null) {
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) {
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING; $pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
}
$this->_dataType = $pDataType; $this->_dataType = $pDataType;
} elseif (!self::getValueBinder()->bindValue($this, $pValue)) { } elseif (!self::getValueBinder()->bindValue($this, $pValue)) {
throw new PHPExcel_Exception("Value could not be bound to cell."); throw new PHPExcel_Exception("Value could not be bound to cell.");
@ -198,7 +202,7 @@ class PHPExcel_Cell
* @return PHPExcel_Cell * @return PHPExcel_Cell
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function setValue($pValue = NULL) public function setValue($pValue = null)
{ {
if (!self::getValueBinder()->bindValue($this, $pValue)) { if (!self::getValueBinder()->bindValue($this, $pValue)) {
throw new PHPExcel_Exception("Value could not be bound to cell."); throw new PHPExcel_Exception("Value could not be bound to cell.");
@ -214,7 +218,7 @@ class PHPExcel_Cell
* @return PHPExcel_Cell * @return PHPExcel_Cell
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function setValueExplicit($pValue = NULL, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING) public function setValueExplicit($pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
{ {
// set the value according to data type // set the value according to data type
switch ($pDataType) { switch ($pDataType) {
@ -224,7 +228,9 @@ class PHPExcel_Cell
case PHPExcel_Cell_DataType::TYPE_STRING2: case PHPExcel_Cell_DataType::TYPE_STRING2:
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING; $pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
case PHPExcel_Cell_DataType::TYPE_STRING: case PHPExcel_Cell_DataType::TYPE_STRING:
// Synonym for string
case PHPExcel_Cell_DataType::TYPE_INLINE: case PHPExcel_Cell_DataType::TYPE_INLINE:
// Rich text
$this->_value = PHPExcel_Cell_DataType::checkString($pValue); $this->_value = PHPExcel_Cell_DataType::checkString($pValue);
break; break;
case PHPExcel_Cell_DataType::TYPE_NUMERIC: case PHPExcel_Cell_DataType::TYPE_NUMERIC:
@ -259,7 +265,7 @@ class PHPExcel_Cell
* @return mixed * @return mixed
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function getCalculatedValue($resetLog = TRUE) public function getCalculatedValue($resetLog = true)
{ {
//echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().PHP_EOL; //echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().PHP_EOL;
if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) { if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) {
@ -276,7 +282,7 @@ class PHPExcel_Cell
} }
} }
} catch (PHPExcel_Exception $ex) { } catch (PHPExcel_Exception $ex) {
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== NULL)) { if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== null)) {
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL; //echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->_calculatedValue; // Fallback for calculations referencing external files. return $this->_calculatedValue; // Fallback for calculations referencing external files.
} }
@ -307,9 +313,9 @@ class PHPExcel_Cell
* @param mixed $pValue Value * @param mixed $pValue Value
* @return PHPExcel_Cell * @return PHPExcel_Cell
*/ */
public function setCalculatedValue($pValue = NULL) public function setCalculatedValue($pValue = null)
{ {
if ($pValue !== NULL) { if ($pValue !== null) {
$this->_calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue; $this->_calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue;
} }
@ -349,9 +355,9 @@ class PHPExcel_Cell
*/ */
public function setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING) public function setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
{ {
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) {
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING; $pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
}
$this->_dataType = $pDataType; $this->_dataType = $pDataType;
return $this->notifyCacheController(); return $this->notifyCacheController();
@ -404,7 +410,7 @@ class PHPExcel_Cell
* @return PHPExcel_Cell * @return PHPExcel_Cell
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = NULL) public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null)
{ {
if (!isset($this->_parent)) { if (!isset($this->_parent)) {
throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet'); throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet');
@ -452,7 +458,7 @@ class PHPExcel_Cell
* @return PHPExcel_Cell * @return PHPExcel_Cell
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = NULL) public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null)
{ {
if (!isset($this->_parent)) { if (!isset($this->_parent)) {
throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
@ -468,7 +474,8 @@ class PHPExcel_Cell
* *
* @return PHPExcel_CachedObjectStorage_CacheBase * @return PHPExcel_CachedObjectStorage_CacheBase
*/ */
public function getParent() { public function getParent()
{
return $this->_parent; return $this->_parent;
} }
@ -477,7 +484,8 @@ class PHPExcel_Cell
* *
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function getWorksheet() { public function getWorksheet()
{
return $this->_parent->getParent(); return $this->_parent->getParent();
} }
@ -486,7 +494,8 @@ class PHPExcel_Cell
* *
* @return boolean * @return boolean
*/ */
public function isInMergeRange() { public function isInMergeRange()
{
return (boolean) $this->getMergeRange(); return (boolean) $this->getMergeRange();
} }
@ -495,7 +504,8 @@ class PHPExcel_Cell
* *
* @return boolean * @return boolean
*/ */
public function isMergeRangeValueCell() { public function isMergeRangeValueCell()
{
if ($mergeRange = $this->getMergeRange()) { if ($mergeRange = $this->getMergeRange()) {
$mergeRange = PHPExcel_Cell::splitRange($mergeRange); $mergeRange = PHPExcel_Cell::splitRange($mergeRange);
list($startCell) = $mergeRange[0]; list($startCell) = $mergeRange[0];
@ -511,7 +521,8 @@ class PHPExcel_Cell
* *
* @return string * @return string
*/ */
public function getMergeRange() { public function getMergeRange()
{
foreach ($this->getWorksheet()->getMergeCells() as $mergeRange) { foreach ($this->getWorksheet()->getMergeCells() as $mergeRange) {
if ($this->isInRange($mergeRange)) { if ($this->isInRange($mergeRange)) {
return $mergeRange; return $mergeRange;
@ -536,7 +547,8 @@ class PHPExcel_Cell
* @param PHPExcel_Worksheet $parent * @param PHPExcel_Worksheet $parent
* @return PHPExcel_Cell * @return PHPExcel_Cell
*/ */
public function rebindParent(PHPExcel_Worksheet $parent) { public function rebindParent(PHPExcel_Worksheet $parent)
{
$this->_parent = $parent->getCellCacheController(); $this->_parent = $parent->getCellCacheController();
return $this->notifyCacheController(); return $this->notifyCacheController();
@ -573,7 +585,7 @@ class PHPExcel_Cell
{ {
if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) { if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) {
return array($matches[1],$matches[2]); return array($matches[1],$matches[2]);
} elseif ((strpos($pCoordinateString,':') !== FALSE) || (strpos($pCoordinateString,',') !== FALSE)) { } elseif ((strpos($pCoordinateString,':') !== false) || (strpos($pCoordinateString,',') !== false)) {
throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells'); throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells');
} elseif ($pCoordinateString == '') { } elseif ($pCoordinateString == '') {
throw new PHPExcel_Exception('Cell coordinate can not be zero-length string'); throw new PHPExcel_Exception('Cell coordinate can not be zero-length string');
@ -592,14 +604,16 @@ class PHPExcel_Cell
*/ */
public static function absoluteReference($pCoordinateString = 'A1') public static function absoluteReference($pCoordinateString = 'A1')
{ {
if (strpos($pCoordinateString,':') === FALSE && strpos($pCoordinateString,',') === FALSE) { if (strpos($pCoordinateString, ':') === false && strpos($pCoordinateString, ',') === false) {
// Split out any worksheet name from the reference // Split out any worksheet name from the reference
$worksheet = ''; $worksheet = '';
$cellAddress = explode('!', $pCoordinateString); $cellAddress = explode('!', $pCoordinateString);
if (count($cellAddress) > 1) { if (count($cellAddress) > 1) {
list($worksheet, $pCoordinateString) = $cellAddress; list($worksheet, $pCoordinateString) = $cellAddress;
} }
if ($worksheet > '') $worksheet .= '!'; if ($worksheet > '') {
$worksheet .= '!';
}
// Create absolute coordinate // Create absolute coordinate
if (ctype_digit($pCoordinateString)) { if (ctype_digit($pCoordinateString)) {
@ -622,14 +636,16 @@ class PHPExcel_Cell
*/ */
public static function absoluteCoordinate($pCoordinateString = 'A1') public static function absoluteCoordinate($pCoordinateString = 'A1')
{ {
if (strpos($pCoordinateString,':') === FALSE && strpos($pCoordinateString,',') === FALSE) { if (strpos($pCoordinateString, ':') === false && strpos($pCoordinateString, ',') === false) {
// Split out any worksheet name from the coordinate // Split out any worksheet name from the coordinate
$worksheet = ''; $worksheet = '';
$cellAddress = explode('!', $pCoordinateString); $cellAddress = explode('!', $pCoordinateString);
if (count($cellAddress) > 1) { if (count($cellAddress) > 1) {
list($worksheet, $pCoordinateString) = $cellAddress; list($worksheet, $pCoordinateString) = $cellAddress;
} }
if ($worksheet > '') $worksheet .= '!'; if ($worksheet > '') {
$worksheet .= '!';
}
// Create absolute coordinate // Create absolute coordinate
list($column, $row) = self::coordinateFromString($pCoordinateString); list($column, $row) = self::coordinateFromString($pCoordinateString);
@ -707,7 +723,7 @@ class PHPExcel_Cell
$pRange = strtoupper($pRange); $pRange = strtoupper($pRange);
// Extract range // Extract range
if (strpos($pRange, ':') === FALSE) { if (strpos($pRange, ':') === false) {
$rangeA = $rangeB = $pRange; $rangeA = $rangeB = $pRange;
} else { } else {
list($rangeA, $rangeB) = explode(':', $pRange); list($rangeA, $rangeB) = explode(':', $pRange);
@ -756,7 +772,7 @@ class PHPExcel_Cell
$pRange = strtoupper($pRange); $pRange = strtoupper($pRange);
// Extract range // Extract range
if (strpos($pRange, ':') === FALSE) { if (strpos($pRange, ':') === false) {
$rangeA = $rangeB = $pRange; $rangeA = $rangeB = $pRange;
} else { } else {
list($rangeA, $rangeB) = explode(':', $pRange); list($rangeA, $rangeB) = explode(':', $pRange);
@ -778,9 +794,9 @@ class PHPExcel_Cell
// though it's additional memory overhead // though it's additional memory overhead
static $_indexCache = array(); static $_indexCache = array();
if (isset($_indexCache[$pString])) if (isset($_indexCache[$pString])) {
return $_indexCache[$pString]; return $_indexCache[$pString];
}
// It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord() // It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord()
// and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant // and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant
// memory overhead either // memory overhead either
@ -843,7 +859,8 @@ class PHPExcel_Cell
* @param string $pRange Range (e.g. A1 or A1:C10 or A1:E10 A20:E25) * @param string $pRange Range (e.g. A1 or A1:C10 or A1:E10 A20:E25)
* @return array Array containing single cell references * @return array Array containing single cell references
*/ */
public static function extractAllCellReferencesInRange($pRange = 'A1') { public static function extractAllCellReferencesInRange($pRange = 'A1')
{
// Returnvalue // Returnvalue
$returnValue = array(); $returnValue = array();
@ -851,7 +868,7 @@ class PHPExcel_Cell
$cellBlocks = explode(' ', str_replace('$', '', strtoupper($pRange))); $cellBlocks = explode(' ', str_replace('$', '', strtoupper($pRange)));
foreach ($cellBlocks as $cellBlock) { foreach ($cellBlocks as $cellBlock) {
// Single cell? // Single cell?
if (strpos($cellBlock,':') === FALSE && strpos($cellBlock,',') === FALSE) { if (strpos($cellBlock,':') === false && strpos($cellBlock,',') === false) {
$returnValue[] = $cellBlock; $returnValue[] = $cellBlock;
continue; continue;
} }
@ -869,7 +886,7 @@ class PHPExcel_Cell
list($rangeStart, $rangeEnd) = $range; list($rangeStart, $rangeEnd) = $range;
sscanf($rangeStart, '%[A-Z]%d', $startCol, $startRow); sscanf($rangeStart, '%[A-Z]%d', $startCol, $startRow);
sscanf($rangeEnd, '%[A-Z]%d', $endCol, $endRow); sscanf($rangeEnd, '%[A-Z]%d', $endCol, $endRow);
$endCol++; ++$endCol;
// Current data // Current data
$currentCol = $startCol; $currentCol = $startCol;
@ -924,8 +941,9 @@ class PHPExcel_Cell
* *
* @return PHPExcel_Cell_IValueBinder * @return PHPExcel_Cell_IValueBinder
*/ */
public static function getValueBinder() { public static function getValueBinder()
if (self::$_valueBinder === NULL) { {
if (self::$_valueBinder === null) {
self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder(); self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder();
} }
@ -938,8 +956,9 @@ class PHPExcel_Cell
* @param PHPExcel_Cell_IValueBinder $binder * @param PHPExcel_Cell_IValueBinder $binder
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = NULL) { public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = null)
if ($binder === NULL) { {
if ($binder === null) {
throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly."); throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
} }
@ -949,7 +968,8 @@ class PHPExcel_Cell
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) { if ((is_object($value)) && ($key != '_parent')) {
@ -1009,6 +1029,4 @@ class PHPExcel_Cell
{ {
return (string) $this->getValue(); return (string) $this->getValue();
} }
} }

View File

@ -74,7 +74,9 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
if (preg_match('/^([+-]?)\s*([0-9]+)\s?\/\s*([0-9]+)$/', $value, $matches)) { if (preg_match('/^([+-]?)\s*([0-9]+)\s?\/\s*([0-9]+)$/', $value, $matches)) {
// Convert value to number // Convert value to number
$value = $matches[2] / $matches[3]; $value = $matches[2] / $matches[3];
if ($matches[1] == '-') $value = 0 - $value; if ($matches[1] == '-') {
$value = 0 - $value;
}
$cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
// Set style // Set style
$cell->getWorksheet()->getStyle($cell->getCoordinate()) $cell->getWorksheet()->getStyle($cell->getCoordinate())
@ -83,7 +85,9 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
} elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) { } elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
// Convert value to number // Convert value to number
$value = $matches[2] + ($matches[3] / $matches[4]); $value = $matches[2] + ($matches[3] / $matches[4]);
if ($matches[1] == '-') $value = 0 - $value; if ($matches[1] == '-') {
$value = 0 - $value;
}
$cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
// Set style // Set style
$cell->getWorksheet()->getStyle($cell->getCoordinate()) $cell->getWorksheet()->getStyle($cell->getCoordinate())

View File

@ -112,5 +112,4 @@ class PHPExcel_Cell_DataType
return $pValue; return $pValue;
} }
} }

View File

@ -57,91 +57,91 @@ class PHPExcel_Cell_DataValidation
* *
* @var string * @var string
*/ */
private $_formula1; private $formula1;
/** /**
* Formula 2 * Formula 2
* *
* @var string * @var string
*/ */
private $_formula2; private $formula2;
/** /**
* Type * Type
* *
* @var string * @var string
*/ */
private $_type = PHPExcel_Cell_DataValidation::TYPE_NONE; private $type = PHPExcel_Cell_DataValidation::TYPE_NONE;
/** /**
* Error style * Error style
* *
* @var string * @var string
*/ */
private $_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; private $errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
/** /**
* Operator * Operator
* *
* @var string * @var string
*/ */
private $_operator; private $operator;
/** /**
* Allow Blank * Allow Blank
* *
* @var boolean * @var boolean
*/ */
private $_allowBlank; private $allowBlank;
/** /**
* Show DropDown * Show DropDown
* *
* @var boolean * @var boolean
*/ */
private $_showDropDown; private $showDropDown;
/** /**
* Show InputMessage * Show InputMessage
* *
* @var boolean * @var boolean
*/ */
private $_showInputMessage; private $showInputMessage;
/** /**
* Show ErrorMessage * Show ErrorMessage
* *
* @var boolean * @var boolean
*/ */
private $_showErrorMessage; private $showErrorMessage;
/** /**
* Error title * Error title
* *
* @var string * @var string
*/ */
private $_errorTitle; private $errorTitle;
/** /**
* Error * Error
* *
* @var string * @var string
*/ */
private $_error; private $error;
/** /**
* Prompt title * Prompt title
* *
* @var string * @var string
*/ */
private $_promptTitle; private $promptTitle;
/** /**
* Prompt * Prompt
* *
* @var string * @var string
*/ */
private $_prompt; private $prompt;
/** /**
* Create a new PHPExcel_Cell_DataValidation * Create a new PHPExcel_Cell_DataValidation
@ -149,19 +149,19 @@ class PHPExcel_Cell_DataValidation
public function __construct() public function __construct()
{ {
// Initialise member variables // Initialise member variables
$this->_formula1 = ''; $this->formula1 = '';
$this->_formula2 = ''; $this->formula2 = '';
$this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE; $this->type = PHPExcel_Cell_DataValidation::TYPE_NONE;
$this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; $this->errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
$this->_operator = ''; $this->operator = '';
$this->_allowBlank = FALSE; $this->allowBlank = false;
$this->_showDropDown = FALSE; $this->showDropDown = false;
$this->_showInputMessage = FALSE; $this->showInputMessage = false;
$this->_showErrorMessage = FALSE; $this->showErrorMessage = false;
$this->_errorTitle = ''; $this->errorTitle = '';
$this->_error = ''; $this->error = '';
$this->_promptTitle = ''; $this->promptTitle = '';
$this->_prompt = ''; $this->prompt = '';
} }
/** /**
@ -169,8 +169,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return string * @return string
*/ */
public function getFormula1() { public function getFormula1()
return $this->_formula1; {
return $this->formula1;
} }
/** /**
@ -179,8 +180,9 @@ class PHPExcel_Cell_DataValidation
* @param string $value * @param string $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setFormula1($value = '') { public function setFormula1($value = '')
$this->_formula1 = $value; {
$this->formula1 = $value;
return $this; return $this;
} }
@ -190,7 +192,7 @@ class PHPExcel_Cell_DataValidation
* @return string * @return string
*/ */
public function getFormula2() { public function getFormula2() {
return $this->_formula2; return $this->formula2;
} }
/** /**
@ -199,8 +201,9 @@ class PHPExcel_Cell_DataValidation
* @param string $value * @param string $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setFormula2($value = '') { public function setFormula2($value = '')
$this->_formula2 = $value; {
$this->formula2 = $value;
return $this; return $this;
} }
@ -209,8 +212,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return string * @return string
*/ */
public function getType() { public function getType()
return $this->_type; {
return $this->type;
} }
/** /**
@ -219,8 +223,9 @@ class PHPExcel_Cell_DataValidation
* @param string $value * @param string $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE) { public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE)
$this->_type = $value; {
$this->type = $value;
return $this; return $this;
} }
@ -229,8 +234,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return string * @return string
*/ */
public function getErrorStyle() { public function getErrorStyle()
return $this->_errorStyle; {
return $this->errorStyle;
} }
/** /**
@ -239,8 +245,9 @@ class PHPExcel_Cell_DataValidation
* @param string $value * @param string $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP) { public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP)
$this->_errorStyle = $value; {
$this->errorStyle = $value;
return $this; return $this;
} }
@ -249,8 +256,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return string * @return string
*/ */
public function getOperator() { public function getOperator()
return $this->_operator; {
return $this->operator;
} }
/** /**
@ -259,8 +267,9 @@ class PHPExcel_Cell_DataValidation
* @param string $value * @param string $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setOperator($value = '') { public function setOperator($value = '')
$this->_operator = $value; {
$this->operator = $value;
return $this; return $this;
} }
@ -269,8 +278,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return boolean * @return boolean
*/ */
public function getAllowBlank() { public function getAllowBlank()
return $this->_allowBlank; {
return $this->allowBlank;
} }
/** /**
@ -279,8 +289,9 @@ class PHPExcel_Cell_DataValidation
* @param boolean $value * @param boolean $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setAllowBlank($value = false) { public function setAllowBlank($value = false)
$this->_allowBlank = $value; {
$this->allowBlank = $value;
return $this; return $this;
} }
@ -289,8 +300,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return boolean * @return boolean
*/ */
public function getShowDropDown() { public function getShowDropDown()
return $this->_showDropDown; {
return $this->showDropDown;
} }
/** /**
@ -299,8 +311,9 @@ class PHPExcel_Cell_DataValidation
* @param boolean $value * @param boolean $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setShowDropDown($value = false) { public function setShowDropDown($value = false)
$this->_showDropDown = $value; {
$this->showDropDown = $value;
return $this; return $this;
} }
@ -309,8 +322,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return boolean * @return boolean
*/ */
public function getShowInputMessage() { public function getShowInputMessage()
return $this->_showInputMessage; {
return $this->showInputMessage;
} }
/** /**
@ -319,8 +333,9 @@ class PHPExcel_Cell_DataValidation
* @param boolean $value * @param boolean $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setShowInputMessage($value = false) { public function setShowInputMessage($value = false)
$this->_showInputMessage = $value; {
$this->showInputMessage = $value;
return $this; return $this;
} }
@ -329,8 +344,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return boolean * @return boolean
*/ */
public function getShowErrorMessage() { public function getShowErrorMessage()
return $this->_showErrorMessage; {
return $this->showErrorMessage;
} }
/** /**
@ -339,8 +355,9 @@ class PHPExcel_Cell_DataValidation
* @param boolean $value * @param boolean $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setShowErrorMessage($value = false) { public function setShowErrorMessage($value = false)
$this->_showErrorMessage = $value; {
$this->showErrorMessage = $value;
return $this; return $this;
} }
@ -349,8 +366,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return string * @return string
*/ */
public function getErrorTitle() { public function getErrorTitle()
return $this->_errorTitle; {
return $this->errorTitle;
} }
/** /**
@ -359,8 +377,9 @@ class PHPExcel_Cell_DataValidation
* @param string $value * @param string $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setErrorTitle($value = '') { public function setErrorTitle($value = '')
$this->_errorTitle = $value; {
$this->errorTitle = $value;
return $this; return $this;
} }
@ -369,8 +388,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return string * @return string
*/ */
public function getError() { public function getError()
return $this->_error; {
return $this->error;
} }
/** /**
@ -379,8 +399,9 @@ class PHPExcel_Cell_DataValidation
* @param string $value * @param string $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setError($value = '') { public function setError($value = '')
$this->_error = $value; {
$this->error = $value;
return $this; return $this;
} }
@ -389,8 +410,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return string * @return string
*/ */
public function getPromptTitle() { public function getPromptTitle()
return $this->_promptTitle; {
return $this->promptTitle;
} }
/** /**
@ -399,8 +421,9 @@ class PHPExcel_Cell_DataValidation
* @param string $value * @param string $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setPromptTitle($value = '') { public function setPromptTitle($value = '')
$this->_promptTitle = $value; {
$this->promptTitle = $value;
return $this; return $this;
} }
@ -409,8 +432,9 @@ class PHPExcel_Cell_DataValidation
* *
* @return string * @return string
*/ */
public function getPrompt() { public function getPrompt()
return $this->_prompt; {
return $this->prompt;
} }
/** /**
@ -419,8 +443,9 @@ class PHPExcel_Cell_DataValidation
* @param string $value * @param string $value
* @return PHPExcel_Cell_DataValidation * @return PHPExcel_Cell_DataValidation
*/ */
public function setPrompt($value = '') { public function setPrompt($value = '')
$this->_prompt = $value; {
$this->prompt = $value;
return $this; return $this;
} }
@ -429,29 +454,31 @@ class PHPExcel_Cell_DataValidation
* *
* @return string Hash code * @return string Hash code
*/ */
public function getHashCode() { public function getHashCode()
{
return md5( return md5(
$this->_formula1 $this->formula1 .
. $this->_formula2 $this->formula2 .
. $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE $this->type = PHPExcel_Cell_DataValidation::TYPE_NONE .
. $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP $this->errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP .
. $this->_operator $this->operator .
. ($this->_allowBlank ? 't' : 'f') ($this->allowBlank ? 't' : 'f') .
. ($this->_showDropDown ? 't' : 'f') ($this->showDropDown ? 't' : 'f') .
. ($this->_showInputMessage ? 't' : 'f') ($this->showInputMessage ? 't' : 'f') .
. ($this->_showErrorMessage ? 't' : 'f') ($this->showErrorMessage ? 't' : 'f') .
. $this->_errorTitle $this->errorTitle .
. $this->_error $this->error .
. $this->_promptTitle $this->promptTitle .
. $this->_prompt $this->prompt .
. __CLASS__ __CLASS__
); );
} }
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -7,8 +7,8 @@
* Time: 12:11 PM * Time: 12:11 PM
*/ */
class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties { class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
{
/** /**
* Axis Number * Axis Number
* *
@ -25,16 +25,16 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
* @var array of mixed * @var array of mixed
*/ */
private $_axis_options = array( private $_axis_options = array(
'minimum' => NULL, 'minimum' => null,
'maximum' => NULL, 'maximum' => null,
'major_unit' => NULL, 'major_unit' => null,
'minor_unit' => NULL, 'minor_unit' => null,
'orientation' => self::ORIENTATION_NORMAL, 'orientation' => self::ORIENTATION_NORMAL,
'minor_tick_mark' => self::TICK_MARK_NONE, 'minor_tick_mark' => self::TICK_MARK_NONE,
'major_tick_mark' => self::TICK_MARK_NONE, 'major_tick_mark' => self::TICK_MARK_NONE,
'axis_labels' => self::AXIS_LABELS_NEXT_TO, 'axis_labels' => self::AXIS_LABELS_NEXT_TO,
'horizontal_crosses' => self::HORIZONTAL_CROSSES_AUTOZERO, 'horizontal_crosses' => self::HORIZONTAL_CROSSES_AUTOZERO,
'horizontal_crosses_value' => NULL 'horizontal_crosses_value' => null
); );
/** /**
@ -44,7 +44,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
*/ */
private $_fill_properties = array( private $_fill_properties = array(
'type' => self::EXCEL_COLOR_TYPE_ARGB, 'type' => self::EXCEL_COLOR_TYPE_ARGB,
'value' => NULL, 'value' => null,
'alpha' => 0 'alpha' => 0
); );
@ -55,7 +55,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
*/ */
private $_line_properties = array( private $_line_properties = array(
'type' => self::EXCEL_COLOR_TYPE_ARGB, 'type' => self::EXCEL_COLOR_TYPE_ARGB,
'value' => NULL, 'value' => null,
'alpha' => 0 'alpha' => 0
); );
@ -89,22 +89,22 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
*/ */
private $_shadow_properties = array( private $_shadow_properties = array(
'presets' => self::SHADOW_PRESETS_NOSHADOW, 'presets' => self::SHADOW_PRESETS_NOSHADOW,
'effect' => NULL, 'effect' => null,
'color' => array( 'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD, 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
'value' => 'black', 'value' => 'black',
'alpha' => 40, 'alpha' => 40,
), ),
'size' => array( 'size' => array(
'sx' => NULL, 'sx' => null,
'sy' => NULL, 'sy' => null,
'kx' => NULL 'kx' => null
), ),
'blur' => NULL, 'blur' => null,
'direction' => NULL, 'direction' => null,
'distance' => NULL, 'distance' => null,
'algn' => NULL, 'algn' => null,
'rotWithShape' => NULL 'rotWithShape' => null
); );
/** /**
@ -113,7 +113,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
* @var array of mixed * @var array of mixed
*/ */
private $_glow_properties = array( private $_glow_properties = array(
'size' => NULL, 'size' => null,
'color' => array( 'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD, 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
'value' => 'black', 'value' => 'black',
@ -127,7 +127,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
* @var array of mixed * @var array of mixed
*/ */
private $_soft_edges = array( private $_soft_edges = array(
'size' => NULL 'size' => null
); );
/** /**
@ -135,7 +135,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
* *
* @return string * @return string
*/ */
public function setAxisNumberProperties($format_code) { public function setAxisNumberProperties($format_code)
{
$this->_axis_number['format'] = (string) $format_code; $this->_axis_number['format'] = (string) $format_code;
$this->_axis_number['source_linked'] = 0; $this->_axis_number['source_linked'] = 0;
} }
@ -145,7 +146,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
* *
* @return string * @return string
*/ */
public function getAxisNumberFormat() { public function getAxisNumberFormat()
{
return $this->_axis_number['format']; return $this->_axis_number['format'];
} }
@ -154,7 +156,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
* *
* @return string * @return string
*/ */
public function getAxisNumberSourceLinked() { public function getAxisNumberSourceLinked()
{
return (string) $this->_axis_number['source_linked']; return (string) $this->_axis_number['source_linked'];
} }
@ -173,22 +176,22 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
* @param string $minor_unit * @param string $minor_unit
* *
*/ */
public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = NULL, $horizontal_crosses = NULL, public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null,
$axis_orientation = NULL, $major_tmt = NULL, $minor_tmt = NULL, $minimum = NULL, $maximum = NULL, $major_unit = NULL, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null,
$minor_unit = NULL) $minor_unit = null)
{ {
$this->_axis_options['axis_labels'] = (string) $axis_labels; $this->_axis_options['axis_labels'] = (string) $axis_labels;
($horizontal_crosses_value !== NULL) ($horizontal_crosses_value !== null)
? $this->_axis_options['horizontal_crosses_value'] = (string) $horizontal_crosses_value : NULL; ? $this->_axis_options['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null;
($horizontal_crosses !== NULL) ? $this->_axis_options['horizontal_crosses'] = (string) $horizontal_crosses : NULL; ($horizontal_crosses !== null) ? $this->_axis_options['horizontal_crosses'] = (string) $horizontal_crosses : null;
($axis_orientation !== NULL) ? $this->_axis_options['orientation'] = (string) $axis_orientation : NULL; ($axis_orientation !== null) ? $this->_axis_options['orientation'] = (string) $axis_orientation : null;
($major_tmt !== NULL) ? $this->_axis_options['major_tick_mark'] = (string) $major_tmt : NULL; ($major_tmt !== null) ? $this->_axis_options['major_tick_mark'] = (string) $major_tmt : null;
($minor_tmt !== NULL) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : NULL; ($minor_tmt !== null) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : null;
($minor_tmt !== NULL) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : NULL; ($minor_tmt !== null) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : null;
($minimum !== NULL) ? $this->_axis_options['minimum'] = (string) $minimum : NULL; ($minimum !== null) ? $this->_axis_options['minimum'] = (string) $minimum : null;
($maximum !== NULL) ? $this->_axis_options['maximum'] = (string) $maximum : NULL; ($maximum !== null) ? $this->_axis_options['maximum'] = (string) $maximum : null;
($major_unit !== NULL) ? $this->_axis_options['major_unit'] = (string) $major_unit : NULL; ($major_unit !== null) ? $this->_axis_options['major_unit'] = (string) $major_unit : null;
($minor_unit !== NULL) ? $this->_axis_options['minor_unit'] = (string) $minor_unit : NULL; ($minor_unit !== null) ? $this->_axis_options['minor_unit'] = (string) $minor_unit : null;
} }
/** /**
@ -273,24 +276,24 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
* *
*/ */
public function setLineStyleProperties($line_width = NULL, $compound_type = NULL, public function setLineStyleProperties($line_width = null, $compound_type = null,
$dash_type = NULL, $cap_type = NULL, $join_type = NULL, $head_arrow_type = NULL, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null,
$head_arrow_size = NULL, $end_arrow_type = NULL, $end_arrow_size = NULL) { $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) {
(!is_null($line_width)) ? $this->_line_style_properties['width'] = $this->getExcelPointsWidth((float) $line_width) (!is_null($line_width)) ? $this->_line_style_properties['width'] = $this->getExcelPointsWidth((float) $line_width)
: NULL; : null;
(!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : NULL; (!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : null;
(!is_null($dash_type)) ? $this->_line_style_properties['dash'] = (string) $dash_type : NULL; (!is_null($dash_type)) ? $this->_line_style_properties['dash'] = (string) $dash_type : null;
(!is_null($cap_type)) ? $this->_line_style_properties['cap'] = (string) $cap_type : NULL; (!is_null($cap_type)) ? $this->_line_style_properties['cap'] = (string) $cap_type : null;
(!is_null($join_type)) ? $this->_line_style_properties['join'] = (string) $join_type : NULL; (!is_null($join_type)) ? $this->_line_style_properties['join'] = (string) $join_type : null;
(!is_null($head_arrow_type)) ? $this->_line_style_properties['arrow']['head']['type'] = (string) $head_arrow_type (!is_null($head_arrow_type)) ? $this->_line_style_properties['arrow']['head']['type'] = (string) $head_arrow_type
: NULL; : null;
(!is_null($head_arrow_size)) ? $this->_line_style_properties['arrow']['head']['size'] = (string) $head_arrow_size (!is_null($head_arrow_size)) ? $this->_line_style_properties['arrow']['head']['size'] = (string) $head_arrow_size
: NULL; : null;
(!is_null($end_arrow_type)) ? $this->_line_style_properties['arrow']['end']['type'] = (string) $end_arrow_type (!is_null($end_arrow_type)) ? $this->_line_style_properties['arrow']['end']['type'] = (string) $end_arrow_type
: NULL; : null;
(!is_null($end_arrow_size)) ? $this->_line_style_properties['arrow']['end']['size'] = (string) $end_arrow_size (!is_null($end_arrow_size)) ? $this->_line_style_properties['arrow']['end']['size'] = (string) $end_arrow_size
: NULL; : null;
} }
/** /**
@ -342,7 +345,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
* *
*/ */
public function setShadowProperties($sh_presets, $sh_color_value = NULL, $sh_color_type = NULL, $sh_color_alpha = NULL, $sh_blur = NULL, $sh_angle = NULL, $sh_distance = NULL) { public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null) {
$this $this
->_setShadowPresetsProperties((int) $sh_presets) ->_setShadowPresetsProperties((int) $sh_presets)
->_setShadowColor( ->_setShadowColor(
@ -378,18 +381,18 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowProperiesMapValues(array $properties_map, &$reference = NULL) { private function _setShadowProperiesMapValues(array $properties_map, &$reference = null) {
$base_reference = $reference; $base_reference = $reference;
foreach ($properties_map as $property_key => $property_val) { foreach ($properties_map as $property_key => $property_val) {
if (is_array($property_val)) { if (is_array($property_val)) {
if ($reference === NULL) { if ($reference === null) {
$reference = & $this->_shadow_properties[$property_key]; $reference = & $this->_shadow_properties[$property_key];
} else { } else {
$reference = & $reference[$property_key]; $reference = & $reference[$property_key];
} }
$this->_setShadowProperiesMapValues($property_val, $reference); $this->_setShadowProperiesMapValues($property_val, $reference);
} else { } else {
if ($base_reference === NULL) { if ($base_reference === null) {
$this->_shadow_properties[$property_key] = $property_val; $this->_shadow_properties[$property_key] = $property_val;
} else { } else {
$reference[$property_key] = $property_val; $reference[$property_key] = $property_val;
@ -425,7 +428,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
*/ */
private function _setShadowBlur($blur) { private function _setShadowBlur($blur) {
if ($blur !== NULL) { if ($blur !== null) {
$this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur); $this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur);
} }
@ -441,7 +444,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
*/ */
private function _setShadowAngle($angle) { private function _setShadowAngle($angle) {
if ($angle !== NULL) { if ($angle !== null) {
$this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle); $this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle);
} }
@ -457,7 +460,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
*/ */
private function _setShadowDistance($distance) { private function _setShadowDistance($distance) {
if ($distance !== NULL) { if ($distance !== null) {
$this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance); $this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
} }
@ -486,7 +489,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties {
* @param string $color_type * @param string $color_type
*/ */
public function setGlowProperties($size, $color_value = NULL, $color_alpha = NULL, $color_type = NULL) { public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) {
$this $this
->_setGlowSize($size) ->_setGlowSize($size)
->_setGlowColor( ->_setGlowColor(

View File

@ -35,7 +35,6 @@
*/ */
class PHPExcel_Chart_DataSeries class PHPExcel_Chart_DataSeries
{ {
const TYPE_BARCHART = 'barChart'; const TYPE_BARCHART = 'barChart';
const TYPE_BARCHART_3D = 'bar3DChart'; const TYPE_BARCHART_3D = 'bar3DChart';
const TYPE_LINECHART = 'lineChart'; const TYPE_LINECHART = 'lineChart';

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Chart_DataSeriesValues
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Chart_DataSeriesValues
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_DataSeriesValues class PHPExcel_Chart_DataSeriesValues
{ {

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Chart_Exception
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,16 +25,8 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
class PHPExcel_Chart_Exception extends PHPExcel_Exception
{
/**
* PHPExcel_Chart_Exception
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Exception extends PHPExcel_Exception {
/** /**
* Error handler callback * Error handler callback
* *
@ -43,7 +36,8 @@ class PHPExcel_Chart_Exception extends PHPExcel_Exception {
* @param mixed $line * @param mixed $line
* @param mixed $context * @param mixed $context
*/ */
public static function errorHandlerCallback($code, $string, $file, $line, $context) { public static function errorHandlerCallback($code, $string, $file, $line, $context)
{
$e = new self($string, $code); $e = new self($string, $code);
$e->line = $line; $e->line = $line;
$e->file = $file; $e->file = $file;

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Chart_Legend
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Chart_Legend
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Legend class PHPExcel_Chart_Legend
{ {
/** Legend positions */ /** Legend positions */
@ -49,7 +41,8 @@ class PHPExcel_Chart_Legend
const POSITION_TOP = 't'; const POSITION_TOP = 't';
const POSITION_TOPRIGHT = 'tr'; const POSITION_TOPRIGHT = 'tr';
private static $_positionXLref = array( self::xlLegendPositionBottom => self::POSITION_BOTTOM, private static $_positionXLref = array(
self::xlLegendPositionBottom => self::POSITION_BOTTOM,
self::xlLegendPositionCorner => self::POSITION_TOPRIGHT, self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
self::xlLegendPositionCustom => '??', self::xlLegendPositionCustom => '??',
self::xlLegendPositionLeft => self::POSITION_LEFT, self::xlLegendPositionLeft => self::POSITION_LEFT,

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Chart_PlotArea
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Chart_PlotArea
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_PlotArea class PHPExcel_Chart_PlotArea
{ {
/** /**

View File

@ -53,7 +53,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* *
* @var boolean * @var boolean
*/ */
private $_embedImages = FALSE; private $_embedImages = false;
/** /**
* Use inline CSS? * Use inline CSS?
@ -130,7 +130,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* *
* @param PHPExcel $phpExcel PHPExcel object * @param PHPExcel $phpExcel PHPExcel object
*/ */
public function __construct(PHPExcel $phpExcel) { public function __construct(PHPExcel $phpExcel)
{
$this->_phpExcel = $phpExcel; $this->_phpExcel = $phpExcel;
$this->_defaultFont = $this->_phpExcel->getDefaultStyle()->getFont(); $this->_defaultFont = $this->_phpExcel->getDefaultStyle()->getFont();
} }
@ -141,12 +142,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param string $pFilename * @param string $pFilename
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function save($pFilename = null) { public function save($pFilename = null)
{
// garbage collect // garbage collect
$this->_phpExcel->garbageCollect(); $this->_phpExcel->garbageCollect();
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); $saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
@ -186,13 +188,18 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param string $vAlign Vertical alignment * @param string $vAlign Vertical alignment
* @return string * @return string
*/ */
private function _mapVAlign($vAlign) { private function _mapVAlign($vAlign)
{
switch ($vAlign) { switch ($vAlign) {
case PHPExcel_Style_Alignment::VERTICAL_BOTTOM: return 'bottom'; case PHPExcel_Style_Alignment::VERTICAL_BOTTOM:
case PHPExcel_Style_Alignment::VERTICAL_TOP: return 'top'; return 'bottom';
case PHPExcel_Style_Alignment::VERTICAL_TOP:
return 'top';
case PHPExcel_Style_Alignment::VERTICAL_CENTER: case PHPExcel_Style_Alignment::VERTICAL_CENTER:
case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY: return 'middle'; case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY:
default: return 'baseline'; return 'middle';
default:
return 'baseline';
} }
} }
@ -202,15 +209,22 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param string $hAlign Horizontal alignment * @param string $hAlign Horizontal alignment
* @return string|false * @return string|false
*/ */
private function _mapHAlign($hAlign) { private function _mapHAlign($hAlign)
{
switch ($hAlign) { switch ($hAlign) {
case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL: return false; case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL:
case PHPExcel_Style_Alignment::HORIZONTAL_LEFT: return 'left'; return false;
case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT: return 'right'; case PHPExcel_Style_Alignment::HORIZONTAL_LEFT:
return 'left';
case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT:
return 'right';
case PHPExcel_Style_Alignment::HORIZONTAL_CENTER: case PHPExcel_Style_Alignment::HORIZONTAL_CENTER:
case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS: return 'center'; case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS:
case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY: return 'justify'; return 'center';
default: return false; case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY:
return 'justify';
default:
return false;
} }
} }
@ -220,23 +234,40 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param int $borderStyle Sheet index * @param int $borderStyle Sheet index
* @return string * @return string
*/ */
private function _mapBorderStyle($borderStyle) { private function _mapBorderStyle($borderStyle)
{
switch ($borderStyle) { switch ($borderStyle) {
case PHPExcel_Style_Border::BORDER_NONE: return 'none'; case PHPExcel_Style_Border::BORDER_NONE:
case PHPExcel_Style_Border::BORDER_DASHDOT: return '1px dashed'; return 'none';
case PHPExcel_Style_Border::BORDER_DASHDOTDOT: return '1px dotted'; case PHPExcel_Style_Border::BORDER_DASHDOT:
case PHPExcel_Style_Border::BORDER_DASHED: return '1px dashed'; return '1px dashed';
case PHPExcel_Style_Border::BORDER_DOTTED: return '1px dotted'; case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
case PHPExcel_Style_Border::BORDER_DOUBLE: return '3px double'; return '1px dotted';
case PHPExcel_Style_Border::BORDER_HAIR: return '1px solid'; case PHPExcel_Style_Border::BORDER_DASHED:
case PHPExcel_Style_Border::BORDER_MEDIUM: return '2px solid'; return '1px dashed';
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: return '2px dashed'; case PHPExcel_Style_Border::BORDER_DOTTED:
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: return '2px dotted'; return '1px dotted';
case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: return '2px dashed'; case PHPExcel_Style_Border::BORDER_DOUBLE:
case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: return '2px dashed'; return '3px double';
case PHPExcel_Style_Border::BORDER_THICK: return '3px solid'; case PHPExcel_Style_Border::BORDER_HAIR:
case PHPExcel_Style_Border::BORDER_THIN: return '1px solid'; return '1px solid';
default: return '1px solid'; // map others to thin case PHPExcel_Style_Border::BORDER_MEDIUM:
return '2px solid';
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
return '2px dashed';
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
return '2px dotted';
case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
return '2px dashed';
case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
return '2px dashed';
case PHPExcel_Style_Border::BORDER_THICK:
return '3px solid';
case PHPExcel_Style_Border::BORDER_THIN:
return '1px solid';
default:
// map others to thin
return '1px solid';
} }
} }
@ -245,7 +276,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* *
* @return int * @return int
*/ */
public function getSheetIndex() { public function getSheetIndex()
{
return $this->_sheetIndex; return $this->_sheetIndex;
} }
@ -255,7 +287,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param int $pValue Sheet index * @param int $pValue Sheet index
* @return PHPExcel_Writer_HTML * @return PHPExcel_Writer_HTML
*/ */
public function setSheetIndex($pValue = 0) { public function setSheetIndex($pValue = 0)
{
$this->_sheetIndex = $pValue; $this->_sheetIndex = $pValue;
return $this; return $this;
} }
@ -265,7 +298,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* *
* @return boolean * @return boolean
*/ */
public function getGenerateSheetNavigationBlock() { public function getGenerateSheetNavigationBlock()
{
return $this->_generateSheetNavigationBlock; return $this->_generateSheetNavigationBlock;
} }
@ -275,7 +309,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param boolean $pValue Flag indicating whether the sheet navigation block should be generated or not * @param boolean $pValue Flag indicating whether the sheet navigation block should be generated or not
* @return PHPExcel_Writer_HTML * @return PHPExcel_Writer_HTML
*/ */
public function setGenerateSheetNavigationBlock($pValue = true) { public function setGenerateSheetNavigationBlock($pValue = true)
{
$this->_generateSheetNavigationBlock = (bool) $pValue; $this->_generateSheetNavigationBlock = (bool) $pValue;
return $this; return $this;
} }
@ -283,7 +318,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
/** /**
* Write all sheets (resets sheetIndex to NULL) * Write all sheets (resets sheetIndex to NULL)
*/ */
public function writeAllSheets() { public function writeAllSheets()
{
$this->_sheetIndex = null; $this->_sheetIndex = null;
return $this; return $this;
} }
@ -295,7 +331,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string * @return string
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function generateHTMLHeader($pIncludeStyles = false) { public function generateHTMLHeader($pIncludeStyles = false)
{
// PHPExcel object known? // PHPExcel object known?
if (is_null($this->_phpExcel)) { if (is_null($this->_phpExcel)) {
throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
@ -308,25 +345,33 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$html .= '<html>' . PHP_EOL; $html .= '<html>' . PHP_EOL;
$html .= ' <head>' . PHP_EOL; $html .= ' <head>' . PHP_EOL;
$html .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . PHP_EOL; $html .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . PHP_EOL;
if ($properties->getTitle() > '') if ($properties->getTitle() > '') {
$html .= ' <title>' . htmlspecialchars($properties->getTitle()) . '</title>' . PHP_EOL; $html .= ' <title>' . htmlspecialchars($properties->getTitle()) . '</title>' . PHP_EOL;
}
if ($properties->getCreator() > '') if ($properties->getCreator() > '') {
$html .= ' <meta name="author" content="' . htmlspecialchars($properties->getCreator()) . '" />' . PHP_EOL; $html .= ' <meta name="author" content="' . htmlspecialchars($properties->getCreator()) . '" />' . PHP_EOL;
if ($properties->getTitle() > '') }
if ($properties->getTitle() > '') {
$html .= ' <meta name="title" content="' . htmlspecialchars($properties->getTitle()) . '" />' . PHP_EOL; $html .= ' <meta name="title" content="' . htmlspecialchars($properties->getTitle()) . '" />' . PHP_EOL;
if ($properties->getDescription() > '') }
if ($properties->getDescription() > '') {
$html .= ' <meta name="description" content="' . htmlspecialchars($properties->getDescription()) . '" />' . PHP_EOL; $html .= ' <meta name="description" content="' . htmlspecialchars($properties->getDescription()) . '" />' . PHP_EOL;
if ($properties->getSubject() > '') }
if ($properties->getSubject() > '') {
$html .= ' <meta name="subject" content="' . htmlspecialchars($properties->getSubject()) . '" />' . PHP_EOL; $html .= ' <meta name="subject" content="' . htmlspecialchars($properties->getSubject()) . '" />' . PHP_EOL;
if ($properties->getKeywords() > '') }
if ($properties->getKeywords() > '') {
$html .= ' <meta name="keywords" content="' . htmlspecialchars($properties->getKeywords()) . '" />' . PHP_EOL; $html .= ' <meta name="keywords" content="' . htmlspecialchars($properties->getKeywords()) . '" />' . PHP_EOL;
if ($properties->getCategory() > '') }
if ($properties->getCategory() > '') {
$html .= ' <meta name="category" content="' . htmlspecialchars($properties->getCategory()) . '" />' . PHP_EOL; $html .= ' <meta name="category" content="' . htmlspecialchars($properties->getCategory()) . '" />' . PHP_EOL;
if ($properties->getCompany() > '') }
if ($properties->getCompany() > '') {
$html .= ' <meta name="company" content="' . htmlspecialchars($properties->getCompany()) . '" />' . PHP_EOL; $html .= ' <meta name="company" content="' . htmlspecialchars($properties->getCompany()) . '" />' . PHP_EOL;
if ($properties->getManager() > '') }
if ($properties->getManager() > '') {
$html .= ' <meta name="manager" content="' . htmlspecialchars($properties->getManager()) . '" />' . PHP_EOL; $html .= ' <meta name="manager" content="' . htmlspecialchars($properties->getManager()) . '" />' . PHP_EOL;
}
if ($pIncludeStyles) { if ($pIncludeStyles) {
$html .= $this->generateStyles(true); $html .= $this->generateStyles(true);
@ -336,7 +381,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$html .= '' . PHP_EOL; $html .= '' . PHP_EOL;
$html .= ' <body>' . PHP_EOL; $html .= ' <body>' . PHP_EOL;
// Return
return $html; return $html;
} }
@ -346,7 +390,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string * @return string
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function generateSheetData() { public function generateSheetData()
{
// PHPExcel object known? // PHPExcel object known?
if (is_null($this->_phpExcel)) { if (is_null($this->_phpExcel)) {
throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
@ -455,7 +500,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
++$sheetId; ++$sheetId;
} }
// Return
return $html; return $html;
} }
@ -501,7 +545,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
return $html; return $html;
} }
private function _extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row) { private function _extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row)
{
$rowMax = $row; $rowMax = $row;
$colMax = 'A'; $colMax = 'A';
if ($this->_includeCharts) { if ($this->_includeCharts) {
@ -559,7 +604,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string * @return string
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates) { private function _writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates)
{
// Construct HTML // Construct HTML
$html = ''; $html = '';
@ -612,7 +658,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
} }
} }
// Return
return $html; return $html;
} }
@ -624,7 +669,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string * @return string
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates) { private function _writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates)
{
// Construct HTML // Construct HTML
$html = ''; $html = '';
@ -669,7 +715,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string * @return string
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function generateStyles($generateSurroundingHTML = true) { public function generateStyles($generateSurroundingHTML = true)
{
// PHPExcel object known? // PHPExcel object known?
if (is_null($this->_phpExcel)) { if (is_null($this->_phpExcel)) {
throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
@ -710,7 +757,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return array * @return array
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function buildCSS($generateSurroundingHTML = true) { public function buildCSS($generateSurroundingHTML = true)
{
// PHPExcel object known? // PHPExcel object known?
if (is_null($this->_phpExcel)) { if (is_null($this->_phpExcel)) {
throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
@ -864,16 +912,17 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style $pStyle PHPExcel_Style * @param PHPExcel_Style $pStyle PHPExcel_Style
* @return array * @return array
*/ */
private function _createCSSStyle(PHPExcel_Style $pStyle) { private function _createCSSStyle(PHPExcel_Style $pStyle)
{
// Construct CSS // Construct CSS
$css = ''; $css = '';
// Create CSS // Create CSS
$css = array_merge( $css = array_merge(
$this->_createCSSStyleAlignment($pStyle->getAlignment()) $this->_createCSSStyleAlignment($pStyle->getAlignment()),
, $this->_createCSSStyleBorders($pStyle->getBorders()) $this->_createCSSStyleBorders($pStyle->getBorders()),
, $this->_createCSSStyleFont($pStyle->getFont()) $this->_createCSSStyleFont($pStyle->getFont()),
, $this->_createCSSStyleFill($pStyle->getFill()) $this->_createCSSStyleFill($pStyle->getFill())
); );
// Return // Return
@ -886,7 +935,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style_Alignment $pStyle PHPExcel_Style_Alignment * @param PHPExcel_Style_Alignment $pStyle PHPExcel_Style_Alignment
* @return array * @return array
*/ */
private function _createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle) { private function _createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle)
{
// Construct CSS // Construct CSS
$css = array(); $css = array();
@ -894,11 +944,11 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$css['vertical-align'] = $this->_mapVAlign($pStyle->getVertical()); $css['vertical-align'] = $this->_mapVAlign($pStyle->getVertical());
if ($textAlign = $this->_mapHAlign($pStyle->getHorizontal())) { if ($textAlign = $this->_mapHAlign($pStyle->getHorizontal())) {
$css['text-align'] = $textAlign; $css['text-align'] = $textAlign;
if(in_array($textAlign,array('left','right'))) if (in_array($textAlign,array('left','right'))) {
$css['padding-'.$textAlign] = (string)((int)$pStyle->getIndent() * 9).'px'; $css['padding-'.$textAlign] = (string)((int)$pStyle->getIndent() * 9).'px';
} }
}
// Return
return $css; return $css;
} }
@ -908,7 +958,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style_Font $pStyle PHPExcel_Style_Font * @param PHPExcel_Style_Font $pStyle PHPExcel_Style_Font
* @return array * @return array
*/ */
private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle) { private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle)
{
// Construct CSS // Construct CSS
$css = array(); $css = array();
@ -931,7 +982,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$css['font-family'] = '\'' . $pStyle->getName() . '\''; $css['font-family'] = '\'' . $pStyle->getName() . '\'';
$css['font-size'] = $pStyle->getSize() . 'pt'; $css['font-size'] = $pStyle->getSize() . 'pt';
// Return
return $css; return $css;
} }
@ -941,7 +991,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style_Borders $pStyle PHPExcel_Style_Borders * @param PHPExcel_Style_Borders $pStyle PHPExcel_Style_Borders
* @return array * @return array
*/ */
private function _createCSSStyleBorders(PHPExcel_Style_Borders $pStyle) { private function _createCSSStyleBorders(PHPExcel_Style_Borders $pStyle)
{
// Construct CSS // Construct CSS
$css = array(); $css = array();
@ -951,7 +1002,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$css['border-left'] = $this->_createCSSStyleBorder($pStyle->getLeft()); $css['border-left'] = $this->_createCSSStyleBorder($pStyle->getLeft());
$css['border-right'] = $this->_createCSSStyleBorder($pStyle->getRight()); $css['border-right'] = $this->_createCSSStyleBorder($pStyle->getRight());
// Return
return $css; return $css;
} }
@ -961,14 +1011,14 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style_Border $pStyle PHPExcel_Style_Border * @param PHPExcel_Style_Border $pStyle PHPExcel_Style_Border
* @return string * @return string
*/ */
private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle) { private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle)
{
// Create CSS // Create CSS
// $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB(); // $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
// Create CSS - add !important to non-none border styles for merged cells // Create CSS - add !important to non-none border styles for merged cells
$borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle()); $borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle());
$css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important'); $css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important');
// Return
return $css; return $css;
} }
@ -978,7 +1028,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style_Fill $pStyle PHPExcel_Style_Fill * @param PHPExcel_Style_Fill $pStyle PHPExcel_Style_Fill
* @return array * @return array
*/ */
private function _createCSSStyleFill(PHPExcel_Style_Fill $pStyle) { private function _createCSSStyleFill(PHPExcel_Style_Fill $pStyle)
{
// Construct HTML // Construct HTML
$css = array(); $css = array();
@ -987,20 +1038,19 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
'white' : '#' . $pStyle->getStartColor()->getRGB(); 'white' : '#' . $pStyle->getStartColor()->getRGB();
$css['background-color'] = $value; $css['background-color'] = $value;
// Return
return $css; return $css;
} }
/** /**
* Generate HTML footer * Generate HTML footer
*/ */
public function generateHTMLFooter() { public function generateHTMLFooter()
{
// Construct HTML // Construct HTML
$html = ''; $html = '';
$html .= ' </body>' . PHP_EOL; $html .= ' </body>' . PHP_EOL;
$html .= '</html>' . PHP_EOL; $html .= '</html>' . PHP_EOL;
// Return
return $html; return $html;
} }
@ -1011,7 +1061,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string * @return string
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _generateTableHeader($pSheet) { private function _generateTableHeader($pSheet)
{
$sheetIndex = $pSheet->getParent()->getIndex($pSheet); $sheetIndex = $pSheet->getParent()->getIndex($pSheet);
// Construct HTML // Construct HTML
@ -1047,7 +1098,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
} }
} }
// Return
return $html; return $html;
} }
@ -1056,12 +1106,10 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _generateTableFooter() { private function _generateTableFooter()
// Construct HTML {
$html = ''; $html = ' </table>' . PHP_EOL;
$html .= ' </table>' . PHP_EOL;
// Return
return $html; return $html;
} }
@ -1074,7 +1122,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string * @return string
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _generateRow(PHPExcel_Worksheet $pSheet, $pValues = null, $pRow = 0, $cellType = 'td') { private function _generateRow(PHPExcel_Worksheet $pSheet, $pValues = null, $pRow = 0, $cellType = 'td')
{
if (is_array($pValues)) { if (is_array($pValues)) {
// Construct HTML // Construct HTML
$html = ''; $html = '';
@ -1339,7 +1388,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* *
* @return string * @return string
*/ */
public function getImagesRoot() { public function getImagesRoot()
{
return $this->_imagesRoot; return $this->_imagesRoot;
} }
@ -1349,7 +1399,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param string $pValue * @param string $pValue
* @return PHPExcel_Writer_HTML * @return PHPExcel_Writer_HTML
*/ */
public function setImagesRoot($pValue = '.') { public function setImagesRoot($pValue = '.')
{
$this->_imagesRoot = $pValue; $this->_imagesRoot = $pValue;
return $this; return $this;
} }
@ -1359,7 +1410,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* *
* @return boolean * @return boolean
*/ */
public function getEmbedImages() { public function getEmbedImages()
{
return $this->_embedImages; return $this->_embedImages;
} }
@ -1369,7 +1421,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Writer_HTML * @return PHPExcel_Writer_HTML
*/ */
public function setEmbedImages($pValue = '.') { public function setEmbedImages($pValue = '.')
{
$this->_embedImages = $pValue; $this->_embedImages = $pValue;
return $this; return $this;
} }
@ -1379,7 +1432,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* *
* @return boolean * @return boolean
*/ */
public function getUseInlineCss() { public function getUseInlineCss()
{
return $this->_useInlineCss; return $this->_useInlineCss;
} }
@ -1389,7 +1443,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Writer_HTML * @return PHPExcel_Writer_HTML
*/ */
public function setUseInlineCss($pValue = false) { public function setUseInlineCss($pValue = false)
{
$this->_useInlineCss = $pValue; $this->_useInlineCss = $pValue;
return $this; return $this;
} }
@ -1515,7 +1570,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$this->_spansAreCalculated = true; $this->_spansAreCalculated = true;
} }
private function _setMargins(PHPExcel_Worksheet $pSheet) { private function _setMargins(PHPExcel_Worksheet $pSheet)
{
$htmlPage = '@page { '; $htmlPage = '@page { ';
$htmlBody = 'body { '; $htmlBody = 'body { ';
@ -1537,5 +1593,4 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
return "<style>\n" . $htmlPage . $htmlBody . "</style>\n"; return "<style>\n" . $htmlPage . $htmlBody . "</style>\n";
} }
} }