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
*/
private static $_valueBinder = NULL;
private static $_valueBinder;
/**
* Value of the cell
@ -59,7 +59,7 @@ class PHPExcel_Cell
*
* @var mixed
*/
private $_calculatedValue = NULL;
private $_calculatedValue;
/**
* Type of the cell data
@ -94,17 +94,20 @@ class PHPExcel_Cell
*
* @return void
**/
public function notifyCacheController() {
public function notifyCacheController()
{
$this->_parent->updateCacheData($this);
return $this;
}
public function detach() {
$this->_parent = NULL;
public function detach()
{
$this->_parent = null;
}
public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent) {
public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent)
{
$this->_parent = $parent;
}
@ -117,7 +120,7 @@ class PHPExcel_Cell
* @param PHPExcel_Worksheet $pSheet
* @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
$this->_value = $pValue;
@ -126,9 +129,10 @@ class PHPExcel_Cell
$this->_parent = $pSheet->getCellCacheController();
// Set datatype?
if ($pDataType !== NULL) {
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2)
if ($pDataType !== null) {
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) {
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
}
$this->_dataType = $pDataType;
} elseif (!self::getValueBinder()->bindValue($this, $pValue)) {
throw new PHPExcel_Exception("Value could not be bound to cell.");
@ -198,7 +202,7 @@ class PHPExcel_Cell
* @return PHPExcel_Cell
* @throws PHPExcel_Exception
*/
public function setValue($pValue = NULL)
public function setValue($pValue = null)
{
if (!self::getValueBinder()->bindValue($this, $pValue)) {
throw new PHPExcel_Exception("Value could not be bound to cell.");
@ -214,7 +218,7 @@ class PHPExcel_Cell
* @return PHPExcel_Cell
* @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
switch ($pDataType) {
@ -224,17 +228,19 @@ class PHPExcel_Cell
case PHPExcel_Cell_DataType::TYPE_STRING2:
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
case PHPExcel_Cell_DataType::TYPE_STRING:
// Synonym for string
case PHPExcel_Cell_DataType::TYPE_INLINE:
// Rich text
$this->_value = PHPExcel_Cell_DataType::checkString($pValue);
break;
case PHPExcel_Cell_DataType::TYPE_NUMERIC:
$this->_value = (float)$pValue;
$this->_value = (float) $pValue;
break;
case PHPExcel_Cell_DataType::TYPE_FORMULA:
$this->_value = (string)$pValue;
$this->_value = (string) $pValue;
break;
case PHPExcel_Cell_DataType::TYPE_BOOL:
$this->_value = (bool)$pValue;
$this->_value = (bool) $pValue;
break;
case PHPExcel_Cell_DataType::TYPE_ERROR:
$this->_value = PHPExcel_Cell_DataType::checkErrorCode($pValue);
@ -259,7 +265,7 @@ class PHPExcel_Cell
* @return mixed
* @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;
if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) {
@ -267,7 +273,7 @@ class PHPExcel_Cell
//echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL;
$result = PHPExcel_Calculation::getInstance(
$this->getWorksheet()->getParent()
)->calculateCellValue($this,$resetLog);
)->calculateCellValue($this, $resetLog);
//echo $this->getCoordinate().' calculation result is '.$result.PHP_EOL;
// We don't yet handle array returns
if (is_array($result)) {
@ -275,8 +281,8 @@ class PHPExcel_Cell
$result = array_pop($result);
}
}
} catch ( PHPExcel_Exception $ex ) {
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== NULL)) {
} catch (PHPExcel_Exception $ex) {
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== null)) {
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->_calculatedValue; // Fallback for calculations referencing external files.
}
@ -293,7 +299,7 @@ class PHPExcel_Cell
}
//echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL;
return $result;
} elseif($this->_value instanceof PHPExcel_RichText) {
} elseif ($this->_value instanceof PHPExcel_RichText) {
// echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->_value.'<br />';
return $this->_value->getPlainText();
}
@ -307,9 +313,9 @@ class PHPExcel_Cell
* @param mixed $pValue Value
* @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;
}
@ -349,9 +355,9 @@ class PHPExcel_Cell
*/
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;
}
$this->_dataType = $pDataType;
return $this->notifyCacheController();
@ -404,7 +410,7 @@ class PHPExcel_Cell
* @return PHPExcel_Cell
* @throws PHPExcel_Exception
*/
public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = NULL)
public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null)
{
if (!isset($this->_parent)) {
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
* @throws PHPExcel_Exception
*/
public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = NULL)
public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null)
{
if (!isset($this->_parent)) {
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
*/
public function getParent() {
public function getParent()
{
return $this->_parent;
}
@ -477,7 +484,8 @@ class PHPExcel_Cell
*
* @return PHPExcel_Worksheet
*/
public function getWorksheet() {
public function getWorksheet()
{
return $this->_parent->getParent();
}
@ -486,7 +494,8 @@ class PHPExcel_Cell
*
* @return boolean
*/
public function isInMergeRange() {
public function isInMergeRange()
{
return (boolean) $this->getMergeRange();
}
@ -495,7 +504,8 @@ class PHPExcel_Cell
*
* @return boolean
*/
public function isMergeRangeValueCell() {
public function isMergeRangeValueCell()
{
if ($mergeRange = $this->getMergeRange()) {
$mergeRange = PHPExcel_Cell::splitRange($mergeRange);
list($startCell) = $mergeRange[0];
@ -511,8 +521,9 @@ class PHPExcel_Cell
*
* @return string
*/
public function getMergeRange() {
foreach($this->getWorksheet()->getMergeCells() as $mergeRange) {
public function getMergeRange()
{
foreach ($this->getWorksheet()->getMergeCells() as $mergeRange) {
if ($this->isInRange($mergeRange)) {
return $mergeRange;
}
@ -536,7 +547,8 @@ class PHPExcel_Cell
* @param PHPExcel_Worksheet $parent
* @return PHPExcel_Cell
*/
public function rebindParent(PHPExcel_Worksheet $parent) {
public function rebindParent(PHPExcel_Worksheet $parent)
{
$this->_parent = $parent->getCellCacheController();
return $this->notifyCacheController();
@ -550,7 +562,7 @@ class PHPExcel_Cell
*/
public function isInRange($pRange = 'A1:A1')
{
list($rangeStart,$rangeEnd) = self::rangeBoundaries($pRange);
list($rangeStart, $rangeEnd) = self::rangeBoundaries($pRange);
// Translate properties
$myColumn = self::columnIndexFromString($this->getColumn());
@ -573,7 +585,7 @@ class PHPExcel_Cell
{
if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) {
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');
} elseif ($pCoordinateString == '') {
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')
{
if (strpos($pCoordinateString,':') === FALSE && strpos($pCoordinateString,',') === FALSE) {
if (strpos($pCoordinateString, ':') === false && strpos($pCoordinateString, ',') === false) {
// Split out any worksheet name from the reference
$worksheet = '';
$cellAddress = explode('!',$pCoordinateString);
$cellAddress = explode('!', $pCoordinateString);
if (count($cellAddress) > 1) {
list($worksheet,$pCoordinateString) = $cellAddress;
list($worksheet, $pCoordinateString) = $cellAddress;
}
if ($worksheet > '') {
$worksheet .= '!';
}
if ($worksheet > '') $worksheet .= '!';
// Create absolute coordinate
if (ctype_digit($pCoordinateString)) {
@ -622,19 +636,21 @@ class PHPExcel_Cell
*/
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
$worksheet = '';
$cellAddress = explode('!',$pCoordinateString);
$cellAddress = explode('!', $pCoordinateString);
if (count($cellAddress) > 1) {
list($worksheet,$pCoordinateString) = $cellAddress;
list($worksheet, $pCoordinateString) = $cellAddress;
}
if ($worksheet > '') {
$worksheet .= '!';
}
if ($worksheet > '') $worksheet .= '!';
// Create absolute coordinate
list($column, $row) = self::coordinateFromString($pCoordinateString);
$column = ltrim($column,'$');
$row = ltrim($row,'$');
$column = ltrim($column, '$');
$row = ltrim($row, '$');
return $worksheet . '$' . $column . '$' . $row;
}
@ -652,7 +668,7 @@ class PHPExcel_Cell
public static function splitRange($pRange = 'A1:A1')
{
// Ensure $pRange is a valid range
if(empty($pRange)) {
if (empty($pRange)) {
$pRange = self::DEFAULT_RANGE;
}
@ -699,7 +715,7 @@ class PHPExcel_Cell
public static function rangeBoundaries($pRange = 'A1:A1')
{
// Ensure $pRange is a valid range
if(empty($pRange)) {
if (empty($pRange)) {
$pRange = self::DEFAULT_RANGE;
}
@ -707,7 +723,7 @@ class PHPExcel_Cell
$pRange = strtoupper($pRange);
// Extract range
if (strpos($pRange, ':') === FALSE) {
if (strpos($pRange, ':') === false) {
$rangeA = $rangeB = $pRange;
} else {
list($rangeA, $rangeB) = explode(':', $pRange);
@ -733,7 +749,7 @@ class PHPExcel_Cell
public static function rangeDimension($pRange = 'A1:A1')
{
// Calculate range outer borders
list($rangeStart,$rangeEnd) = self::rangeBoundaries($pRange);
list($rangeStart, $rangeEnd) = self::rangeBoundaries($pRange);
return array( ($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1) );
}
@ -748,7 +764,7 @@ class PHPExcel_Cell
public static function getRangeBoundaries($pRange = 'A1:A1')
{
// Ensure $pRange is a valid range
if(empty($pRange)) {
if (empty($pRange)) {
$pRange = self::DEFAULT_RANGE;
}
@ -756,7 +772,7 @@ class PHPExcel_Cell
$pRange = strtoupper($pRange);
// Extract range
if (strpos($pRange, ':') === FALSE) {
if (strpos($pRange, ':') === false) {
$rangeA = $rangeB = $pRange;
} else {
list($rangeA, $rangeB) = explode(':', $pRange);
@ -778,9 +794,9 @@ class PHPExcel_Cell
// though it's additional memory overhead
static $_indexCache = array();
if (isset($_indexCache[$pString]))
if (isset($_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()
// 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
@ -797,10 +813,10 @@ class PHPExcel_Cell
if (!isset($pString{1})) {
$_indexCache[$pString] = $_columnLookup[$pString];
return $_indexCache[$pString];
} elseif(!isset($pString{2})) {
} elseif (!isset($pString{2})) {
$_indexCache[$pString] = $_columnLookup[$pString{0}] * 26 + $_columnLookup[$pString{1}];
return $_indexCache[$pString];
} elseif(!isset($pString{3})) {
} elseif (!isset($pString{3})) {
$_indexCache[$pString] = $_columnLookup[$pString{0}] * 676 + $_columnLookup[$pString{1}] * 26 + $_columnLookup[$pString{2}];
return $_indexCache[$pString];
}
@ -843,7 +859,8 @@ class PHPExcel_Cell
* @param string $pRange Range (e.g. A1 or A1:C10 or A1:E10 A20:E25)
* @return array Array containing single cell references
*/
public static function extractAllCellReferencesInRange($pRange = 'A1') {
public static function extractAllCellReferencesInRange($pRange = 'A1')
{
// Returnvalue
$returnValue = array();
@ -851,14 +868,14 @@ class PHPExcel_Cell
$cellBlocks = explode(' ', str_replace('$', '', strtoupper($pRange)));
foreach ($cellBlocks as $cellBlock) {
// Single cell?
if (strpos($cellBlock,':') === FALSE && strpos($cellBlock,',') === FALSE) {
if (strpos($cellBlock,':') === false && strpos($cellBlock,',') === false) {
$returnValue[] = $cellBlock;
continue;
}
// Range...
$ranges = self::splitRange($cellBlock);
foreach($ranges as $range) {
foreach ($ranges as $range) {
// Single cell?
if (!isset($range[1])) {
$returnValue[] = $range[0];
@ -867,9 +884,9 @@ class PHPExcel_Cell
// Range...
list($rangeStart, $rangeEnd) = $range;
sscanf($rangeStart,'%[A-Z]%d', $startCol, $startRow);
sscanf($rangeEnd,'%[A-Z]%d', $endCol, $endRow);
$endCol++;
sscanf($rangeStart, '%[A-Z]%d', $startCol, $startRow);
sscanf($rangeEnd, '%[A-Z]%d', $endCol, $endRow);
++$endCol;
// Current data
$currentCol = $startCol;
@ -890,8 +907,8 @@ class PHPExcel_Cell
// Sort the result by column and row
$sortKeys = array();
foreach (array_unique($returnValue) as $coord) {
sscanf($coord,'%[A-Z]%d', $column, $row);
$sortKeys[sprintf('%3s%09d',$column,$row)] = $coord;
sscanf($coord, '%[A-Z]%d', $column, $row);
$sortKeys[sprintf('%3s%09d', $column, $row)] = $coord;
}
ksort($sortKeys);
@ -924,8 +941,9 @@ class PHPExcel_Cell
*
* @return PHPExcel_Cell_IValueBinder
*/
public static function getValueBinder() {
if (self::$_valueBinder === NULL) {
public static function getValueBinder()
{
if (self::$_valueBinder === null) {
self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder();
}
@ -938,8 +956,9 @@ class PHPExcel_Cell
* @param PHPExcel_Cell_IValueBinder $binder
* @throws PHPExcel_Exception
*/
public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = NULL) {
if ($binder === NULL) {
public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = null)
{
if ($binder === null) {
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.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) {
@ -1009,6 +1029,4 @@ class PHPExcel_Cell
{
return (string) $this->getValue();
}
}

View File

@ -59,7 +59,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
if ($value == PHPExcel_Calculation::getTRUE()) {
$cell->setValueExplicit(true, PHPExcel_Cell_DataType::TYPE_BOOL);
return true;
} elseif($value == PHPExcel_Calculation::getFALSE()) {
} elseif ($value == PHPExcel_Calculation::getFALSE()) {
$cell->setValueExplicit(false, PHPExcel_Cell_DataType::TYPE_BOOL);
return true;
}
@ -74,20 +74,24 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
if (preg_match('/^([+-]?)\s*([0-9]+)\s?\/\s*([0-9]+)$/', $value, $matches)) {
// Convert value to number
$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);
// Set style
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
->getNumberFormat()->setFormatCode( '??/??' );
$cell->getWorksheet()->getStyle($cell->getCoordinate())
->getNumberFormat()->setFormatCode('??/??');
return true;
} elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
// Convert value to number
$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);
// Set style
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
->getNumberFormat()->setFormatCode( '# ??/??' );
$cell->getWorksheet()->getStyle($cell->getCoordinate())
->getNumberFormat()->setFormatCode('# ??/??');
return true;
}
@ -95,9 +99,9 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) {
// Convert value to number
$value = (float) str_replace('%', '', $value) / 100;
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
// Set style
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
$cell->getWorksheet()->getStyle($cell->getCoordinate())
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00);
return true;
}

View File

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

View File

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

View File

@ -87,9 +87,9 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
} elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) {
$tValue = ltrim($pValue, '+-');
if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.' ) {
if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.') {
return PHPExcel_Cell_DataType::TYPE_STRING;
} elseif((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) {
} elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) {
return PHPExcel_Cell_DataType::TYPE_STRING;
}
return PHPExcel_Cell_DataType::TYPE_NUMERIC;

View File

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

View File

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

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Chart_DataSeriesValues
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @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
{

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Chart_Exception
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,16 +25,8 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* 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 {
class PHPExcel_Chart_Exception extends PHPExcel_Exception
{
/**
* Error handler callback
*
@ -43,7 +36,8 @@ class PHPExcel_Chart_Exception extends PHPExcel_Exception {
* @param mixed $line
* @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->line = $line;
$e->file = $file;

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Chart_Legend
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @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
{
/** Legend positions */
@ -49,7 +41,8 @@ class PHPExcel_Chart_Legend
const POSITION_TOP = 't';
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::xlLegendPositionCustom => '??',
self::xlLegendPositionLeft => self::POSITION_LEFT,

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Chart_PlotArea
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @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
{
/**

View File

@ -53,7 +53,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
*
* @var boolean
*/
private $_embedImages = FALSE;
private $_embedImages = false;
/**
* Use inline CSS?
@ -130,7 +130,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
*
* @param PHPExcel $phpExcel PHPExcel object
*/
public function __construct(PHPExcel $phpExcel) {
public function __construct(PHPExcel $phpExcel)
{
$this->_phpExcel = $phpExcel;
$this->_defaultFont = $this->_phpExcel->getDefaultStyle()->getFont();
}
@ -141,12 +142,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param string $pFilename
* @throws PHPExcel_Writer_Exception
*/
public function save($pFilename = null) {
public function save($pFilename = null)
{
// garbage collect
$this->_phpExcel->garbageCollect();
$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();
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
* @return string
*/
private function _mapVAlign($vAlign) {
private function _mapVAlign($vAlign)
{
switch ($vAlign) {
case PHPExcel_Style_Alignment::VERTICAL_BOTTOM: return 'bottom';
case PHPExcel_Style_Alignment::VERTICAL_TOP: return 'top';
case PHPExcel_Style_Alignment::VERTICAL_BOTTOM:
return 'bottom';
case PHPExcel_Style_Alignment::VERTICAL_TOP:
return 'top';
case PHPExcel_Style_Alignment::VERTICAL_CENTER:
case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY: return 'middle';
default: return 'baseline';
case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY:
return 'middle';
default:
return 'baseline';
}
}
@ -202,15 +209,22 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param string $hAlign Horizontal alignment
* @return string|false
*/
private function _mapHAlign($hAlign) {
private function _mapHAlign($hAlign)
{
switch ($hAlign) {
case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL: return false;
case PHPExcel_Style_Alignment::HORIZONTAL_LEFT: return 'left';
case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT: return 'right';
case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL:
return false;
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_CONTINUOUS: return 'center';
case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY: return 'justify';
default: return false;
case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS:
return 'center';
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
* @return string
*/
private function _mapBorderStyle($borderStyle) {
private function _mapBorderStyle($borderStyle)
{
switch ($borderStyle) {
case PHPExcel_Style_Border::BORDER_NONE: return 'none';
case PHPExcel_Style_Border::BORDER_DASHDOT: return '1px dashed';
case PHPExcel_Style_Border::BORDER_DASHDOTDOT: return '1px dotted';
case PHPExcel_Style_Border::BORDER_DASHED: return '1px dashed';
case PHPExcel_Style_Border::BORDER_DOTTED: return '1px dotted';
case PHPExcel_Style_Border::BORDER_DOUBLE: return '3px double';
case PHPExcel_Style_Border::BORDER_HAIR: return '1px solid';
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: return '1px solid'; // map others to thin
case PHPExcel_Style_Border::BORDER_NONE:
return 'none';
case PHPExcel_Style_Border::BORDER_DASHDOT:
return '1px dashed';
case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
return '1px dotted';
case PHPExcel_Style_Border::BORDER_DASHED:
return '1px dashed';
case PHPExcel_Style_Border::BORDER_DOTTED:
return '1px dotted';
case PHPExcel_Style_Border::BORDER_DOUBLE:
return '3px double';
case PHPExcel_Style_Border::BORDER_HAIR:
return '1px solid';
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
*/
public function getSheetIndex() {
public function getSheetIndex()
{
return $this->_sheetIndex;
}
@ -255,7 +287,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param int $pValue Sheet index
* @return PHPExcel_Writer_HTML
*/
public function setSheetIndex($pValue = 0) {
public function setSheetIndex($pValue = 0)
{
$this->_sheetIndex = $pValue;
return $this;
}
@ -265,7 +298,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
*
* @return boolean
*/
public function getGenerateSheetNavigationBlock() {
public function getGenerateSheetNavigationBlock()
{
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
* @return PHPExcel_Writer_HTML
*/
public function setGenerateSheetNavigationBlock($pValue = true) {
public function setGenerateSheetNavigationBlock($pValue = true)
{
$this->_generateSheetNavigationBlock = (bool) $pValue;
return $this;
}
@ -283,7 +318,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
/**
* Write all sheets (resets sheetIndex to NULL)
*/
public function writeAllSheets() {
public function writeAllSheets()
{
$this->_sheetIndex = null;
return $this;
}
@ -295,7 +331,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string
* @throws PHPExcel_Writer_Exception
*/
public function generateHTMLHeader($pIncludeStyles = false) {
public function generateHTMLHeader($pIncludeStyles = false)
{
// PHPExcel object known?
if (is_null($this->_phpExcel)) {
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 .= ' <head>' . 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;
if ($properties->getCreator() > '')
}
if ($properties->getCreator() > '') {
$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;
if ($properties->getDescription() > '')
}
if ($properties->getDescription() > '') {
$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;
if ($properties->getKeywords() > '')
}
if ($properties->getKeywords() > '') {
$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;
if ($properties->getCompany() > '')
}
if ($properties->getCompany() > '') {
$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;
}
if ($pIncludeStyles) {
$html .= $this->generateStyles(true);
@ -336,7 +381,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$html .= '' . PHP_EOL;
$html .= ' <body>' . PHP_EOL;
// Return
return $html;
}
@ -346,7 +390,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string
* @throws PHPExcel_Writer_Exception
*/
public function generateSheetData() {
public function generateSheetData()
{
// PHPExcel object known?
if (is_null($this->_phpExcel)) {
throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
@ -401,7 +446,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
// Loop through cells
$row = $rowMin-1;
while($row++ < $rowMax) {
while ($row++ < $rowMax) {
// <thead> ?
if ($row == $theadStart) {
$html .= ' <thead>' . PHP_EOL;
@ -415,12 +460,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
}
// Write row if there are HTML table cells in it
if ( !isset($this->_isSpannedRow[$sheet->getParent()->getIndex($sheet)][$row]) ) {
if (!isset($this->_isSpannedRow[$sheet->getParent()->getIndex($sheet)][$row])) {
// Start a new rowData
$rowData = array();
// Loop through columns
$column = $dimension[0][0] - 1;
while($column++ < $dimension[1][0]) {
while ($column++ < $dimension[1][0]) {
// Cell exists?
if ($sheet->cellExistsByColumnAndRow($column, $row)) {
$rowData[$column] = PHPExcel_Cell::stringFromColumnIndex($column) . $row;
@ -455,7 +500,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
++$sheetId;
}
// Return
return $html;
}
@ -501,7 +545,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
return $html;
}
private function _extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row) {
private function _extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row)
{
$rowMax = $row;
$colMax = 'A';
if ($this->_includeCharts) {
@ -559,7 +604,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string
* @throws PHPExcel_Writer_Exception
*/
private function _writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates) {
private function _writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates)
{
// Construct HTML
$html = '';
@ -590,8 +636,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$imageData = $filename;
} else {
$imageDetails = getimagesize($filename);
if ($fp = fopen($filename,"rb", 0)) {
$picture = fread($fp,filesize($filename));
if ($fp = fopen($filename, "rb", 0)) {
$picture = fread($fp, filesize($filename));
fclose($fp);
// base64 encode the binary data, then break it
// into chunks according to RFC 2045 semantics
@ -612,7 +658,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
}
}
// Return
return $html;
}
@ -624,7 +669,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string
* @throws PHPExcel_Writer_Exception
*/
private function _writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates) {
private function _writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates)
{
// Construct HTML
$html = '';
@ -640,8 +686,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$html .= PHP_EOL;
$imageDetails = getimagesize($chartFileName);
if ($fp = fopen($chartFileName,"rb", 0)) {
$picture = fread($fp,filesize($chartFileName));
if ($fp = fopen($chartFileName, "rb", 0)) {
$picture = fread($fp, filesize($chartFileName));
fclose($fp);
// base64 encode the binary data, then break it
// into chunks according to RFC 2045 semantics
@ -669,7 +715,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string
* @throws PHPExcel_Writer_Exception
*/
public function generateStyles($generateSurroundingHTML = true) {
public function generateStyles($generateSurroundingHTML = true)
{
// PHPExcel object known?
if (is_null($this->_phpExcel)) {
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
* @throws PHPExcel_Writer_Exception
*/
public function buildCSS($generateSurroundingHTML = true) {
public function buildCSS($generateSurroundingHTML = true)
{
// PHPExcel object known?
if (is_null($this->_phpExcel)) {
throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
@ -768,8 +816,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
// Calculate cell style hashes
foreach ($this->_phpExcel->getCellXfCollection() as $index => $style) {
$css['td.style' . $index] = $this->_createCSSStyle( $style );
$css['th.style' . $index] = $this->_createCSSStyle( $style );
$css['td.style' . $index] = $this->_createCSSStyle($style);
$css['th.style' . $index] = $this->_createCSSStyle($style);
}
// Fetch sheets
@ -792,7 +840,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
// col elements, initialize
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()) - 1;
$column = -1;
while($column++ < $highestColumnIndex) {
while ($column++ < $highestColumnIndex) {
$this->_columnWidths[$sheetIndex][$column] = 42; // approximation
$css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = '42pt';
}
@ -864,16 +912,17 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style $pStyle PHPExcel_Style
* @return array
*/
private function _createCSSStyle(PHPExcel_Style $pStyle) {
private function _createCSSStyle(PHPExcel_Style $pStyle)
{
// Construct CSS
$css = '';
// Create CSS
$css = array_merge(
$this->_createCSSStyleAlignment($pStyle->getAlignment())
, $this->_createCSSStyleBorders($pStyle->getBorders())
, $this->_createCSSStyleFont($pStyle->getFont())
, $this->_createCSSStyleFill($pStyle->getFill())
$this->_createCSSStyleAlignment($pStyle->getAlignment()),
$this->_createCSSStyleBorders($pStyle->getBorders()),
$this->_createCSSStyleFont($pStyle->getFont()),
$this->_createCSSStyleFill($pStyle->getFill())
);
// Return
@ -886,7 +935,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style_Alignment $pStyle PHPExcel_Style_Alignment
* @return array
*/
private function _createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle) {
private function _createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle)
{
// Construct CSS
$css = array();
@ -894,11 +944,11 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$css['vertical-align'] = $this->_mapVAlign($pStyle->getVertical());
if ($textAlign = $this->_mapHAlign($pStyle->getHorizontal())) {
$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';
}
}
// Return
return $css;
}
@ -908,7 +958,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style_Font $pStyle PHPExcel_Style_Font
* @return array
*/
private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle) {
private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle)
{
// Construct CSS
$css = array();
@ -918,9 +969,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
}
if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) {
$css['text-decoration'] = 'underline line-through';
} else if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE) {
} elseif ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE) {
$css['text-decoration'] = 'underline';
} else if ($pStyle->getStrikethrough()) {
} elseif ($pStyle->getStrikethrough()) {
$css['text-decoration'] = 'line-through';
}
if ($pStyle->getItalic()) {
@ -931,7 +982,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$css['font-family'] = '\'' . $pStyle->getName() . '\'';
$css['font-size'] = $pStyle->getSize() . 'pt';
// Return
return $css;
}
@ -941,7 +991,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style_Borders $pStyle PHPExcel_Style_Borders
* @return array
*/
private function _createCSSStyleBorders(PHPExcel_Style_Borders $pStyle) {
private function _createCSSStyleBorders(PHPExcel_Style_Borders $pStyle)
{
// Construct CSS
$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-right'] = $this->_createCSSStyleBorder($pStyle->getRight());
// Return
return $css;
}
@ -961,14 +1011,14 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style_Border $pStyle PHPExcel_Style_Border
* @return string
*/
private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle) {
private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle)
{
// Create CSS
// $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
// Create CSS - add !important to non-none border styles for merged cells
$borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle());
$css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important');
// Return
return $css;
}
@ -978,7 +1028,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param PHPExcel_Style_Fill $pStyle PHPExcel_Style_Fill
* @return array
*/
private function _createCSSStyleFill(PHPExcel_Style_Fill $pStyle) {
private function _createCSSStyleFill(PHPExcel_Style_Fill $pStyle)
{
// Construct HTML
$css = array();
@ -987,20 +1038,19 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
'white' : '#' . $pStyle->getStartColor()->getRGB();
$css['background-color'] = $value;
// Return
return $css;
}
/**
* Generate HTML footer
*/
public function generateHTMLFooter() {
public function generateHTMLFooter()
{
// Construct HTML
$html = '';
$html .= ' </body>' . PHP_EOL;
$html .= '</html>' . PHP_EOL;
// Return
return $html;
}
@ -1011,7 +1061,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string
* @throws PHPExcel_Writer_Exception
*/
private function _generateTableHeader($pSheet) {
private function _generateTableHeader($pSheet)
{
$sheetIndex = $pSheet->getParent()->getIndex($pSheet);
// Construct HTML
@ -1035,7 +1086,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
// Write <col> elements
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1;
$i = -1;
while($i++ < $highestColumnIndex) {
while ($i++ < $highestColumnIndex) {
if (!$this->_isPdf) {
if (!$this->_useInlineCss) {
$html .= ' <col class="col' . $i . '">' . PHP_EOL;
@ -1047,7 +1098,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
}
}
// Return
return $html;
}
@ -1056,12 +1106,10 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
*
* @throws PHPExcel_Writer_Exception
*/
private function _generateTableFooter() {
// Construct HTML
$html = '';
$html .= ' </table>' . PHP_EOL;
private function _generateTableFooter()
{
$html = ' </table>' . PHP_EOL;
// Return
return $html;
}
@ -1074,7 +1122,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @return string
* @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)) {
// Construct HTML
$html = '';
@ -1152,7 +1201,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
if ($element->getFont()->getSuperScript()) {
$cellData .= '<sup>';
} else if ($element->getFont()->getSubScript()) {
} elseif ($element->getFont()->getSubScript()) {
$cellData .= '<sub>';
}
}
@ -1164,7 +1213,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
if ($element instanceof PHPExcel_RichText_Run) {
if ($element->getFont()->getSuperScript()) {
$cellData .= '</sup>';
} else if ($element->getFont()->getSubScript()) {
} elseif ($element->getFont()->getSubScript()) {
$cellData .= '</sub>';
}
@ -1175,20 +1224,20 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
if ($this->_preCalculateFormulas) {
$cellData = PHPExcel_Style_NumberFormat::toFormattedString(
$cell->getCalculatedValue(),
$pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode(),
$pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(),
array($this, 'formatColor')
);
} else {
$cellData = PHPExcel_Style_NumberFormat::toFormattedString(
$cell->getValue(),
$pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode(),
$pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(),
array($this, 'formatColor')
);
}
$cellData = htmlspecialchars($cellData);
if ($pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getFont()->getSuperScript()) {
if ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSuperScript()) {
$cellData = '<sup>'.$cellData.'</sup>';
} elseif ($pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getFont()->getSubScript()) {
} elseif ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSubScript()) {
$cellData = '<sub>'.$cellData.'</sub>';
}
}
@ -1231,8 +1280,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
}
// Should the cell be written or is it swallowed by a rowspan or colspan?
$writeCell = ! ( isset($this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum])
&& $this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum] );
$writeCell = !(isset($this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum])
&& $this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum]);
// Colspan and Rowspan
$colspan = 1;
@ -1263,7 +1312,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$width = 0;
$i = $colNum - 1;
$e = $colNum + $colSpan - 1;
while($i++ < $e) {
while ($i++ < $e) {
if (isset($this->_columnWidths[$sheetIndex][$i])) {
$width += $this->_columnWidths[$sheetIndex][$i];
}
@ -1339,7 +1388,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
*
* @return string
*/
public function getImagesRoot() {
public function getImagesRoot()
{
return $this->_imagesRoot;
}
@ -1349,7 +1399,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param string $pValue
* @return PHPExcel_Writer_HTML
*/
public function setImagesRoot($pValue = '.') {
public function setImagesRoot($pValue = '.')
{
$this->_imagesRoot = $pValue;
return $this;
}
@ -1359,7 +1410,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
*
* @return boolean
*/
public function getEmbedImages() {
public function getEmbedImages()
{
return $this->_embedImages;
}
@ -1369,7 +1421,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param boolean $pValue
* @return PHPExcel_Writer_HTML
*/
public function setEmbedImages($pValue = '.') {
public function setEmbedImages($pValue = '.')
{
$this->_embedImages = $pValue;
return $this;
}
@ -1379,7 +1432,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
*
* @return boolean
*/
public function getUseInlineCss() {
public function getUseInlineCss()
{
return $this->_useInlineCss;
}
@ -1389,7 +1443,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
* @param boolean $pValue
* @return PHPExcel_Writer_HTML
*/
public function setUseInlineCss($pValue = false) {
public function setUseInlineCss($pValue = false)
{
$this->_useInlineCss = $pValue;
return $this;
}
@ -1515,7 +1570,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$this->_spansAreCalculated = true;
}
private function _setMargins(PHPExcel_Worksheet $pSheet) {
private function _setMargins(PHPExcel_Worksheet $pSheet)
{
$htmlPage = '@page { ';
$htmlBody = 'body { ';
@ -1537,5 +1593,4 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
return "<style>\n" . $htmlPage . $htmlBody . "</style>\n";
}
}