Conflicts:
	Classes/PHPExcel/Calculation.php
	Classes/PHPExcel/Shared/CodePage.php
	Classes/PHPExcel/Shared/Date.php
	Classes/PHPExcel/Shared/ZipArchive.php
This commit is contained in:
MarkBaker 2015-05-13 00:45:56 +01:00
commit 99b0beb721
86 changed files with 15483 additions and 14315 deletions

View File

@ -25,7 +25,7 @@ before_script:
script:
## PHP_CodeSniffer
- ./vendor/bin/phpcs Classes/ unitTests/ --standard=PSR2 -n --ignore=Classes/PHPExcel/Shared/PCLZip
- ./vendor/bin/phpcs --report-width=200 --report-summary --report-full Classes/ unitTests/ --standard=PSR2 -n
## PHPUnit
- phpunit -c ./unitTests/

View File

@ -3657,6 +3657,301 @@ class PHPExcel_Calculation {
return strcmp($inversedStr1, $inversedStr2);
}
<<<<<<< HEAD
=======
private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
// Validate the two operands
if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) return FALSE;
if (!$this->_validateBinaryOperand($cellID,$operand2,$stack)) return FALSE;
// If either of the operands is a matrix, we need to treat them both as matrices
// (converting the other operand to a matrix if need be); then perform the required
// matrix operation
if ((is_array($operand1)) || (is_array($operand2))) {
// Ensure that both operands are arrays/matrices of the same size
self::_checkMatrixOperands($operand1, $operand2, 2);
try {
// Convert operand 1 from a PHP array to a matrix
$matrix = new PHPExcel_Shared_JAMA_Matrix($operand1);
// Perform the required operation against the operand 1 matrix, passing in operand 2
$matrixResult = $matrix->$matrixFunction($operand2);
$result = $matrixResult->getArray();
} catch (PHPExcel_Exception $ex) {
$this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
$result = '#VALUE!';
}
} else {
if ((PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) &&
((is_string($operand1) && !is_numeric($operand1) && strlen($operand1)>0) ||
(is_string($operand2) && !is_numeric($operand2) && strlen($operand2)>0))) {
$result = PHPExcel_Calculation_Functions::VALUE();
} else {
// If we're dealing with non-matrix operations, execute the necessary operation
switch ($operation) {
// Addition
case '+':
$result = $operand1 + $operand2;
break;
// Subtraction
case '-':
$result = $operand1 - $operand2;
break;
// Multiplication
case '*':
$result = $operand1 * $operand2;
break;
// Division
case '/':
if ($operand2 == 0) {
// Trap for Divide by Zero error
$stack->push('Value','#DIV/0!');
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails('#DIV/0!'));
return FALSE;
} else {
$result = $operand1 / $operand2;
}
break;
// Power
case '^':
$result = pow($operand1, $operand2);
break;
}
}
}
// Log the result details
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($result));
// And push the result onto the stack
$stack->push('Value',$result);
return TRUE;
} // function _executeNumericBinaryOperation()
// trigger an error, but nicely, if need be
protected function _raiseFormulaError($errorMessage) {
$this->formulaError = $errorMessage;
$this->_cyclicReferenceStack->clear();
if (!$this->suppressFormulaErrors) throw new PHPExcel_Calculation_Exception($errorMessage);
trigger_error($errorMessage, E_USER_ERROR);
} // function _raiseFormulaError()
/**
* Extract range values
*
* @param string &$pRange String based range representation
* @param PHPExcel_Worksheet $pSheet Worksheet
* @param boolean $resetLog Flag indicating whether calculation log should be reset or not
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
* @throws PHPExcel_Calculation_Exception
*/
public function extractCellRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = NULL, $resetLog = TRUE) {
// Return value
$returnValue = array ();
// echo 'extractCellRange('.$pRange.')',PHP_EOL;
if ($pSheet !== NULL) {
$pSheetName = $pSheet->getTitle();
// echo 'Passed sheet name is '.$pSheetName.PHP_EOL;
// echo 'Range reference is '.$pRange.PHP_EOL;
if (strpos ($pRange, '!') !== false) {
// echo '$pRange reference includes sheet reference',PHP_EOL;
list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
// echo 'New sheet name is '.$pSheetName,PHP_EOL;
// echo 'Adjusted Range reference is '.$pRange,PHP_EOL;
$pSheet = $this->_workbook->getSheetByName($pSheetName);
}
// Extract range
$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
$pRange = $pSheetName.'!'.$pRange;
if (!isset($aReferences[1])) {
// Single cell in range
sscanf($aReferences[0],'%[A-Z]%d', $currentCol, $currentRow);
$cellValue = NULL;
if ($pSheet->cellExists($aReferences[0])) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
} else {
$returnValue[$currentRow][$currentCol] = NULL;
}
} else {
// Extract cell data for all cells in the range
foreach ($aReferences as $reference) {
// Extract range
sscanf($reference,'%[A-Z]%d', $currentCol, $currentRow);
$cellValue = NULL;
if ($pSheet->cellExists($reference)) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
} else {
$returnValue[$currentRow][$currentCol] = NULL;
}
}
}
}
// Return
return $returnValue;
} // function extractCellRange()
/**
* Extract range values
*
* @param string &$pRange String based range representation
* @param PHPExcel_Worksheet $pSheet Worksheet
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
* @param boolean $resetLog Flag indicating whether calculation log should be reset or not
* @throws PHPExcel_Calculation_Exception
*/
public function extractNamedRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = NULL, $resetLog = TRUE) {
// Return value
$returnValue = array ();
// echo 'extractNamedRange('.$pRange.')<br />';
if ($pSheet !== NULL) {
$pSheetName = $pSheet->getTitle();
// echo 'Current sheet name is '.$pSheetName.'<br />';
// echo 'Range reference is '.$pRange.'<br />';
if (strpos ($pRange, '!') !== false) {
// echo '$pRange reference includes sheet reference',PHP_EOL;
list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
// echo 'New sheet name is '.$pSheetName,PHP_EOL;
// echo 'Adjusted Range reference is '.$pRange,PHP_EOL;
$pSheet = $this->_workbook->getSheetByName($pSheetName);
}
// Named range?
$namedRange = PHPExcel_NamedRange::resolveRange($pRange, $pSheet);
if ($namedRange !== NULL) {
$pSheet = $namedRange->getWorksheet();
// echo 'Named Range '.$pRange.' (';
$pRange = $namedRange->getRange();
$splitRange = PHPExcel_Cell::splitRange($pRange);
// Convert row and column references
if (ctype_alpha($splitRange[0][0])) {
$pRange = $splitRange[0][0] . '1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow();
} elseif(ctype_digit($splitRange[0][0])) {
$pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1];
}
// echo $pRange.') is in sheet '.$namedRange->getWorksheet()->getTitle().'<br />';
// if ($pSheet->getTitle() != $namedRange->getWorksheet()->getTitle()) {
// if (!$namedRange->getLocalOnly()) {
// $pSheet = $namedRange->getWorksheet();
// } else {
// return $returnValue;
// }
// }
} else {
return PHPExcel_Calculation_Functions::REF();
}
// Extract range
$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
// var_dump($aReferences);
if (!isset($aReferences[1])) {
// Single cell (or single column or row) in range
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
$cellValue = NULL;
if ($pSheet->cellExists($aReferences[0])) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
} else {
$returnValue[$currentRow][$currentCol] = NULL;
}
} else {
// Extract cell data for all cells in the range
foreach ($aReferences as $reference) {
// Extract range
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($reference);
// echo 'NAMED RANGE: $currentCol='.$currentCol.' $currentRow='.$currentRow.'<br />';
$cellValue = NULL;
if ($pSheet->cellExists($reference)) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
} else {
$returnValue[$currentRow][$currentCol] = NULL;
}
}
}
// print_r($returnValue);
// echo '<br />';
}
// Return
return $returnValue;
} // function extractNamedRange()
/**
* Is a specific function implemented?
*
* @param string $pFunction Function Name
* @return boolean
*/
public function isImplemented($pFunction = '') {
$pFunction = strtoupper ($pFunction);
if (isset(self::$_PHPExcelFunctions[$pFunction])) {
return (self::$_PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY');
} else {
return FALSE;
}
} // function isImplemented()
/**
* Get a list of all implemented functions as an array of function objects
*
* @return array of PHPExcel_Calculation_Function
*/
public function listFunctions() {
// Return value
$returnValue = array();
// Loop functions
foreach(self::$_PHPExcelFunctions as $functionName => $function) {
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
$returnValue[$functionName] = new PHPExcel_Calculation_Function($function['category'],
$functionName,
$function['functionCall']
);
}
}
// Return
return $returnValue;
} // function listFunctions()
/**
* Get a list of all Excel function names
*
* @return array
*/
public function listAllFunctionNames() {
return array_keys(self::$_PHPExcelFunctions);
} // function listAllFunctionNames()
/**
* Get a list of implemented Excel function names
*
* @return array
*/
public function listFunctionNames() {
// Return value
$returnValue = array();
// Loop functions
foreach(self::$_PHPExcelFunctions as $functionName => $function) {
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
$returnValue[] = $functionName;
}
}
// Return
return $returnValue;
} // function listFunctionNames()
} // class PHPExcel_Calculation
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
// Validate the two operands

View File

@ -113,9 +113,9 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
// Convert value to number
$value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
$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(
str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE)
);
@ -123,9 +123,9 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
} elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
// Convert value to number
$value = (float) trim(str_replace(array('$',','), '', $value));
$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_CURRENCY_USD_SIMPLE);
return true;
}
@ -137,7 +137,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
$days = $h / 24 + $m / 1440;
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
// Set style
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
$cell->getWorksheet()->getStyle($cell->getCoordinate())
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3);
return true;
}
@ -150,7 +150,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
// Convert value to number
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
// Set style
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
$cell->getWorksheet()->getStyle($cell->getCoordinate())
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
return true;
}
@ -165,7 +165,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
} else {
$formatCode = 'yyyy-mm-dd';
}
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
$cell->getWorksheet()->getStyle($cell->getCoordinate())
->getNumberFormat()->setFormatCode($formatCode);
return true;
}

View File

@ -191,7 +191,8 @@ class PHPExcel_Cell_DataValidation
*
* @return string
*/
public function getFormula2() {
public function getFormula2()
{
return $this->formula2;
}

View File

@ -176,9 +176,7 @@ 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)
@ -201,7 +199,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return string
*/
public function getAxisOptionsProperty($property) {
public function getAxisOptionsProperty($property)
{
return $this->_axis_options[$property];
}
@ -211,7 +210,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $orientation
*
*/
public function setAxisOrientation($orientation) {
public function setAxisOrientation($orientation)
{
$this->orientation = (string) $orientation;
}
@ -223,7 +223,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $type
*
*/
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{
$this->_fill_properties = $this->setColorProperties($color, $alpha, $type);
}
@ -235,7 +236,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $type
*
*/
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{
$this->_line_properties = $this->setColorProperties($color, $alpha, $type);
}
@ -246,7 +248,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return string
*/
public function getFillProperty($property) {
public function getFillProperty($property)
{
return $this->_fill_properties[$property];
}
@ -257,7 +260,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return string
*/
public function getLineProperty($property) {
public function getLineProperty($property)
{
return $this->_line_properties[$property];
}
@ -276,10 +280,7 @@ 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;
@ -304,7 +305,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @return string
*/
public function getLineStyleProperty($elements) {
public function getLineStyleProperty($elements)
{
return $this->getArrayElementsValue($this->_line_style_properties, $elements);
}
@ -316,7 +318,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @return string
*/
public function getLineStyleArrowWidth($arrow) {
public function getLineStyleArrowWidth($arrow)
{
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w');
}
@ -328,7 +331,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @return string
*/
public function getLineStyleArrowLength($arrow) {
public function getLineStyleArrowLength($arrow)
{
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len');
}

View File

@ -166,7 +166,8 @@ class PHPExcel_Chart_DataSeries
*
* @return string
*/
public function getPlotType() {
public function getPlotType()
{
return $this->_plotType;
}
@ -176,7 +177,8 @@ class PHPExcel_Chart_DataSeries
* @param string $plotType
* @return PHPExcel_Chart_DataSeries
*/
public function setPlotType($plotType = '') {
public function setPlotType($plotType = '')
{
$this->_plotType = $plotType;
return $this;
}
@ -186,7 +188,8 @@ class PHPExcel_Chart_DataSeries
*
* @return string
*/
public function getPlotGrouping() {
public function getPlotGrouping()
{
return $this->_plotGrouping;
}
@ -196,7 +199,8 @@ class PHPExcel_Chart_DataSeries
* @param string $groupingType
* @return PHPExcel_Chart_DataSeries
*/
public function setPlotGrouping($groupingType = null) {
public function setPlotGrouping($groupingType = null)
{
$this->_plotGrouping = $groupingType;
return $this;
}
@ -206,7 +210,8 @@ class PHPExcel_Chart_DataSeries
*
* @return string
*/
public function getPlotDirection() {
public function getPlotDirection()
{
return $this->_plotDirection;
}
@ -216,7 +221,8 @@ class PHPExcel_Chart_DataSeries
* @param string $plotDirection
* @return PHPExcel_Chart_DataSeries
*/
public function setPlotDirection($plotDirection = null) {
public function setPlotDirection($plotDirection = null)
{
$this->_plotDirection = $plotDirection;
return $this;
}
@ -226,7 +232,8 @@ class PHPExcel_Chart_DataSeries
*
* @return string
*/
public function getPlotOrder() {
public function getPlotOrder()
{
return $this->_plotOrder;
}
@ -235,7 +242,8 @@ class PHPExcel_Chart_DataSeries
*
* @return array of PHPExcel_Chart_DataSeriesValues
*/
public function getPlotLabels() {
public function getPlotLabels()
{
return $this->_plotLabel;
}
@ -244,11 +252,12 @@ class PHPExcel_Chart_DataSeries
*
* @return PHPExcel_Chart_DataSeriesValues
*/
public function getPlotLabelByIndex($index) {
public function getPlotLabelByIndex($index)
{
$keys = array_keys($this->_plotLabel);
if (in_array($index,$keys)) {
if (in_array($index, $keys)) {
return $this->_plotLabel[$index];
} elseif(isset($keys[$index])) {
} elseif (isset($keys[$index])) {
return $this->_plotLabel[$keys[$index]];
}
return false;
@ -259,7 +268,8 @@ class PHPExcel_Chart_DataSeries
*
* @return array of PHPExcel_Chart_DataSeriesValues
*/
public function getPlotCategories() {
public function getPlotCategories()
{
return $this->_plotCategory;
}
@ -268,11 +278,12 @@ class PHPExcel_Chart_DataSeries
*
* @return PHPExcel_Chart_DataSeriesValues
*/
public function getPlotCategoryByIndex($index) {
public function getPlotCategoryByIndex($index)
{
$keys = array_keys($this->_plotCategory);
if (in_array($index,$keys)) {
if (in_array($index, $keys)) {
return $this->_plotCategory[$index];
} elseif(isset($keys[$index])) {
} elseif (isset($keys[$index])) {
return $this->_plotCategory[$keys[$index]];
}
return false;
@ -283,7 +294,8 @@ class PHPExcel_Chart_DataSeries
*
* @return string
*/
public function getPlotStyle() {
public function getPlotStyle()
{
return $this->_plotStyle;
}
@ -293,7 +305,8 @@ class PHPExcel_Chart_DataSeries
* @param string $plotStyle
* @return PHPExcel_Chart_DataSeries
*/
public function setPlotStyle($plotStyle = null) {
public function setPlotStyle($plotStyle = null)
{
$this->_plotStyle = $plotStyle;
return $this;
}
@ -303,7 +316,8 @@ class PHPExcel_Chart_DataSeries
*
* @return array of PHPExcel_Chart_DataSeriesValues
*/
public function getPlotValues() {
public function getPlotValues()
{
return $this->_plotValues;
}
@ -312,11 +326,12 @@ class PHPExcel_Chart_DataSeries
*
* @return PHPExcel_Chart_DataSeriesValues
*/
public function getPlotValuesByIndex($index) {
public function getPlotValuesByIndex($index)
{
$keys = array_keys($this->_plotValues);
if (in_array($index,$keys)) {
if (in_array($index, $keys)) {
return $this->_plotValues[$index];
} elseif(isset($keys[$index])) {
} elseif (isset($keys[$index])) {
return $this->_plotValues[$keys[$index]];
}
return false;
@ -327,7 +342,8 @@ class PHPExcel_Chart_DataSeries
*
* @return integer
*/
public function getPlotSeriesCount() {
public function getPlotSeriesCount()
{
return count($this->_plotValues);
}
@ -336,7 +352,8 @@ class PHPExcel_Chart_DataSeries
*
* @return boolean
*/
public function getSmoothLine() {
public function getSmoothLine()
{
return $this->_smoothLine;
}
@ -346,23 +363,28 @@ class PHPExcel_Chart_DataSeries
* @param boolean $smoothLine
* @return PHPExcel_Chart_DataSeries
*/
public function setSmoothLine($smoothLine = TRUE) {
public function setSmoothLine($smoothLine = true)
{
$this->_smoothLine = $smoothLine;
return $this;
}
public function refresh(PHPExcel_Worksheet $worksheet) {
public function refresh(PHPExcel_Worksheet $worksheet)
{
foreach($this->_plotValues as $plotValues) {
if ($plotValues !== NULL)
$plotValues->refresh($worksheet, TRUE);
if ($plotValues !== null) {
$plotValues->refresh($worksheet, true);
}
}
foreach($this->_plotLabel as $plotValues) {
if ($plotValues !== NULL)
$plotValues->refresh($worksheet, TRUE);
if ($plotValues !== null) {
$plotValues->refresh($worksheet, true);
}
}
foreach($this->_plotCategory as $plotValues) {
if ($plotValues !== NULL)
$plotValues->refresh($worksheet, FALSE);
if ($plotValues !== null) {
$plotValues->refresh($worksheet, false);
}
}
}

View File

@ -40,49 +40,49 @@ class PHPExcel_Chart_Layout
*
* @var string
*/
private $_layoutTarget = NULL;
private $_layoutTarget = null;
/**
* X Mode
*
* @var string
*/
private $_xMode = NULL;
private $_xMode = null;
/**
* Y Mode
*
* @var string
*/
private $_yMode = NULL;
private $_yMode = null;
/**
* X-Position
*
* @var float
*/
private $_xPos = NULL;
private $_xPos = null;
/**
* Y-Position
*
* @var float
*/
private $_yPos = NULL;
private $_yPos = null;
/**
* width
*
* @var float
*/
private $_width = NULL;
private $_width = null;
/**
* height
*
* @var float
*/
private $_height = NULL;
private $_height = null;
/**
* show legend key
@ -90,7 +90,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showLegendKey = NULL;
private $_showLegendKey = null;
/**
* show value
@ -98,7 +98,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showVal = NULL;
private $_showVal = null;
/**
* show category name
@ -106,7 +106,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showCatName = NULL;
private $_showCatName = null;
/**
* show data series name
@ -114,7 +114,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showSerName = NULL;
private $_showSerName = null;
/**
* show percentage
@ -122,14 +122,14 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showPercent = NULL;
private $_showPercent = null;
/**
* show bubble size
*
* @var boolean
*/
private $_showBubbleSize = NULL;
private $_showBubbleSize = null;
/**
* show leader lines
@ -137,21 +137,35 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showLeaderLines = NULL;
private $_showLeaderLines = null;
/**
* Create a new PHPExcel_Chart_Layout
*/
public function __construct($layout=array())
public function __construct($layout = array())
{
if (isset($layout['layoutTarget'])) { $this->_layoutTarget = $layout['layoutTarget']; }
if (isset($layout['xMode'])) { $this->_xMode = $layout['xMode']; }
if (isset($layout['yMode'])) { $this->_yMode = $layout['yMode']; }
if (isset($layout['x'])) { $this->_xPos = (float) $layout['x']; }
if (isset($layout['y'])) { $this->_yPos = (float) $layout['y']; }
if (isset($layout['w'])) { $this->_width = (float) $layout['w']; }
if (isset($layout['h'])) { $this->_height = (float) $layout['h']; }
if (isset($layout['layoutTarget'])) {
$this->_layoutTarget = $layout['layoutTarget'];
}
if (isset($layout['xMode'])) {
$this->_xMode = $layout['xMode'];
}
if (isset($layout['yMode'])) {
$this->_yMode = $layout['yMode'];
}
if (isset($layout['x'])) {
$this->_xPos = (float) $layout['x'];
}
if (isset($layout['y'])) {
$this->_yPos = (float) $layout['y'];
}
if (isset($layout['w'])) {
$this->_width = (float) $layout['w'];
}
if (isset($layout['h'])) {
$this->_height = (float) $layout['h'];
}
}
/**
@ -159,7 +173,8 @@ class PHPExcel_Chart_Layout
*
* @return string
*/
public function getLayoutTarget() {
public function getLayoutTarget()
{
return $this->_layoutTarget;
}
@ -169,7 +184,8 @@ class PHPExcel_Chart_Layout
* @param Layout Target $value
* @return PHPExcel_Chart_Layout
*/
public function setLayoutTarget($value) {
public function setLayoutTarget($value)
{
$this->_layoutTarget = $value;
return $this;
}
@ -179,7 +195,8 @@ class PHPExcel_Chart_Layout
*
* @return string
*/
public function getXMode() {
public function getXMode()
{
return $this->_xMode;
}
@ -189,7 +206,8 @@ class PHPExcel_Chart_Layout
* @param X-Mode $value
* @return PHPExcel_Chart_Layout
*/
public function setXMode($value) {
public function setXMode($value)
{
$this->_xMode = $value;
return $this;
}
@ -199,7 +217,8 @@ class PHPExcel_Chart_Layout
*
* @return string
*/
public function getYMode() {
public function getYMode()
{
return $this->_yMode;
}
@ -209,7 +228,8 @@ class PHPExcel_Chart_Layout
* @param Y-Mode $value
* @return PHPExcel_Chart_Layout
*/
public function setYMode($value) {
public function setYMode($value)
{
$this->_yMode = $value;
return $this;
}
@ -219,7 +239,8 @@ class PHPExcel_Chart_Layout
*
* @return number
*/
public function getXPosition() {
public function getXPosition()
{
return $this->_xPos;
}
@ -229,7 +250,8 @@ class PHPExcel_Chart_Layout
* @param X-Position $value
* @return PHPExcel_Chart_Layout
*/
public function setXPosition($value) {
public function setXPosition($value)
{
$this->_xPos = $value;
return $this;
}
@ -239,7 +261,8 @@ class PHPExcel_Chart_Layout
*
* @return number
*/
public function getYPosition() {
public function getYPosition()
{
return $this->_yPos;
}
@ -249,7 +272,8 @@ class PHPExcel_Chart_Layout
* @param Y-Position $value
* @return PHPExcel_Chart_Layout
*/
public function setYPosition($value) {
public function setYPosition($value)
{
$this->_yPos = $value;
return $this;
}
@ -259,7 +283,8 @@ class PHPExcel_Chart_Layout
*
* @return number
*/
public function getWidth() {
public function getWidth()
{
return $this->_width;
}
@ -269,7 +294,8 @@ class PHPExcel_Chart_Layout
* @param Width $value
* @return PHPExcel_Chart_Layout
*/
public function setWidth($value) {
public function setWidth($value)
{
$this->_width = $value;
return $this;
}
@ -279,7 +305,8 @@ class PHPExcel_Chart_Layout
*
* @return number
*/
public function getHeight() {
public function getHeight()
{
return $this->_height;
}
@ -289,7 +316,8 @@ class PHPExcel_Chart_Layout
* @param Height $value
* @return PHPExcel_Chart_Layout
*/
public function setHeight($value) {
public function setHeight($value)
{
$this->_height = $value;
return $this;
}
@ -300,7 +328,8 @@ class PHPExcel_Chart_Layout
*
* @return boolean
*/
public function getShowLegendKey() {
public function getShowLegendKey()
{
return $this->_showLegendKey;
}
@ -311,7 +340,8 @@ class PHPExcel_Chart_Layout
* @param boolean $value Show legend key
* @return PHPExcel_Chart_Layout
*/
public function setShowLegendKey($value) {
public function setShowLegendKey($value)
{
$this->_showLegendKey = $value;
return $this;
}
@ -321,7 +351,8 @@ class PHPExcel_Chart_Layout
*
* @return boolean
*/
public function getShowVal() {
public function getShowVal()
{
return $this->_showVal;
}
@ -332,7 +363,8 @@ class PHPExcel_Chart_Layout
* @param boolean $value Show val
* @return PHPExcel_Chart_Layout
*/
public function setShowVal($value) {
public function setShowVal($value)
{
$this->_showVal = $value;
return $this;
}
@ -342,7 +374,8 @@ class PHPExcel_Chart_Layout
*
* @return boolean
*/
public function getShowCatName() {
public function getShowCatName()
{
return $this->_showCatName;
}
@ -353,7 +386,8 @@ class PHPExcel_Chart_Layout
* @param boolean $value Show cat name
* @return PHPExcel_Chart_Layout
*/
public function setShowCatName($value) {
public function setShowCatName($value)
{
$this->_showCatName = $value;
return $this;
}
@ -363,7 +397,8 @@ class PHPExcel_Chart_Layout
*
* @return boolean
*/
public function getShowSerName() {
public function getShowSerName()
{
return $this->_showSerName;
}
@ -374,7 +409,8 @@ class PHPExcel_Chart_Layout
* @param boolean $value Show series name
* @return PHPExcel_Chart_Layout
*/
public function setShowSerName($value) {
public function setShowSerName($value)
{
$this->_showSerName = $value;
return $this;
}
@ -384,7 +420,8 @@ class PHPExcel_Chart_Layout
*
* @return boolean
*/
public function getShowPercent() {
public function getShowPercent()
{
return $this->_showPercent;
}
@ -395,7 +432,8 @@ class PHPExcel_Chart_Layout
* @param boolean $value Show percentage
* @return PHPExcel_Chart_Layout
*/
public function setShowPercent($value) {
public function setShowPercent($value)
{
$this->_showPercent = $value;
return $this;
}
@ -405,7 +443,8 @@ class PHPExcel_Chart_Layout
*
* @return boolean
*/
public function getShowBubbleSize() {
public function getShowBubbleSize()
{
return $this->_showBubbleSize;
}
@ -416,7 +455,8 @@ class PHPExcel_Chart_Layout
* @param boolean $value Show bubble size
* @return PHPExcel_Chart_Layout
*/
public function setShowBubbleSize($value) {
public function setShowBubbleSize($value)
{
$this->_showBubbleSize = $value;
return $this;
}
@ -426,7 +466,8 @@ class PHPExcel_Chart_Layout
*
* @return boolean
*/
public function getShowLeaderLines() {
public function getShowLeaderLines()
{
return $this->_showLeaderLines;
}
@ -437,9 +478,9 @@ class PHPExcel_Chart_Layout
* @param boolean $value Show leader lines
* @return PHPExcel_Chart_Layout
*/
public function setShowLeaderLines($value) {
public function setShowLeaderLines($value)
{
$this->_showLeaderLines = $value;
return $this;
}
}

View File

@ -55,7 +55,8 @@ class PHPExcel_Chart_PlotArea
*
* @return PHPExcel_Chart_Layout
*/
public function getLayout() {
public function getLayout()
{
return $this->_layout;
}
@ -64,7 +65,8 @@ class PHPExcel_Chart_PlotArea
*
* @return array of PHPExcel_Chart_DataSeries
*/
public function getPlotGroupCount() {
public function getPlotGroupCount()
{
return count($this->_plotSeries);
}
@ -73,9 +75,10 @@ class PHPExcel_Chart_PlotArea
*
* @return integer
*/
public function getPlotSeriesCount() {
public function getPlotSeriesCount()
{
$seriesCount = 0;
foreach($this->_plotSeries as $plot) {
foreach ($this->_plotSeries as $plot) {
$seriesCount += $plot->getPlotSeriesCount();
}
return $seriesCount;
@ -86,7 +89,8 @@ class PHPExcel_Chart_PlotArea
*
* @return array of PHPExcel_Chart_DataSeries
*/
public function getPlotGroup() {
public function getPlotGroup()
{
return $this->_plotSeries;
}
@ -95,7 +99,8 @@ class PHPExcel_Chart_PlotArea
*
* @return PHPExcel_Chart_DataSeries
*/
public function getPlotGroupByIndex($index) {
public function getPlotGroupByIndex($index)
{
return $this->_plotSeries[$index];
}
@ -105,16 +110,17 @@ class PHPExcel_Chart_PlotArea
* @param [PHPExcel_Chart_DataSeries]
* @return PHPExcel_Chart_PlotArea
*/
public function setPlotSeries($plotSeries = array()) {
public function setPlotSeries($plotSeries = array())
{
$this->_plotSeries = $plotSeries;
return $this;
}
public function refresh(PHPExcel_Worksheet $worksheet) {
foreach($this->_plotSeries as $plotSeries) {
public function refresh(PHPExcel_Worksheet $worksheet)
{
foreach ($this->_plotSeries as $plotSeries) {
$plotSeries->refresh($worksheet);
}
}
}

View File

@ -8,7 +8,6 @@
abstract class PHPExcel_Chart_Properties
{
const
EXCEL_COLOR_TYPE_STANDARD = 'prstClr',
EXCEL_COLOR_TYPE_SCHEME = 'schemeClr',
@ -114,19 +113,23 @@ abstract class PHPExcel_Chart_Properties
SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
protected function getExcelPointsWidth($width) {
protected function getExcelPointsWidth($width)
{
return $width * 12700;
}
protected function getExcelPointsAngle($angle) {
protected function getExcelPointsAngle($angle)
{
return $angle * 60000;
}
protected function getTrueAlpha($alpha) {
protected function getTrueAlpha($alpha)
{
return (string) 100 - $alpha . '000';
}
protected function setColorProperties($color, $alpha, $type) {
protected function setColorProperties($color, $alpha, $type)
{
return array(
'type' => (string) $type,
'value' => (string) $color,
@ -350,11 +353,8 @@ abstract class PHPExcel_Chart_Properties
foreach ($elements as $keys) {
$reference = & $reference[$keys];
}
return $reference;
}
return $this;
}
}

View File

@ -76,11 +76,11 @@ class PHPExcel_DocumentSecurity
}
/**
* Is some sort of dcument security enabled?
* Is some sort of document security enabled?
*
* @return boolean
*/
function isSecurityEnabled()
public function isSecurityEnabled()
{
return $this->_lockRevision ||
$this->_lockStructure ||
@ -92,7 +92,7 @@ class PHPExcel_DocumentSecurity
*
* @return boolean
*/
function getLockRevision()
public function getLockRevision()
{
return $this->_lockRevision;
}
@ -103,7 +103,7 @@ class PHPExcel_DocumentSecurity
* @param boolean $pValue
* @return PHPExcel_DocumentSecurity
*/
function setLockRevision($pValue = false)
public function setLockRevision($pValue = false)
{
$this->_lockRevision = $pValue;
return $this;
@ -114,7 +114,7 @@ class PHPExcel_DocumentSecurity
*
* @return boolean
*/
function getLockStructure()
public function getLockStructure()
{
return $this->_lockStructure;
}
@ -125,7 +125,7 @@ class PHPExcel_DocumentSecurity
* @param boolean $pValue
* @return PHPExcel_DocumentSecurity
*/
function setLockStructure($pValue = false)
public function setLockStructure($pValue = false)
{
$this->_lockStructure = $pValue;
return $this;
@ -136,7 +136,7 @@ class PHPExcel_DocumentSecurity
*
* @return boolean
*/
function getLockWindows()
public function getLockWindows()
{
return $this->_lockWindows;
}
@ -147,7 +147,7 @@ class PHPExcel_DocumentSecurity
* @param boolean $pValue
* @return PHPExcel_DocumentSecurity
*/
function setLockWindows($pValue = false)
public function setLockWindows($pValue = false)
{
$this->_lockWindows = $pValue;
return $this;
@ -158,7 +158,7 @@ class PHPExcel_DocumentSecurity
*
* @return string
*/
function getRevisionsPassword()
public function getRevisionsPassword()
{
return $this->_revisionsPassword;
}
@ -170,7 +170,7 @@ class PHPExcel_DocumentSecurity
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_DocumentSecurity
*/
function setRevisionsPassword($pValue = '', $pAlreadyHashed = false)
public function setRevisionsPassword($pValue = '', $pAlreadyHashed = false)
{
if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
@ -184,7 +184,7 @@ class PHPExcel_DocumentSecurity
*
* @return string
*/
function getWorkbookPassword()
public function getWorkbookPassword()
{
return $this->_workbookPassword;
}
@ -196,7 +196,7 @@ class PHPExcel_DocumentSecurity
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_DocumentSecurity
*/
function setWorkbookPassword($pValue = '', $pAlreadyHashed = false)
public function setWorkbookPassword($pValue = '', $pAlreadyHashed = false)
{
if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);

View File

@ -31,5 +31,4 @@ interface PHPExcel_IComparable
* @return string Hash code
*/
public function getHashCode();
}

View File

@ -91,7 +91,6 @@ class PHPExcel_Shared_CodePage
case 65000: return 'UTF-7'; break; // Unicode (UTF-7)
case 65001: return 'UTF-8'; break; // Unicode (UTF-8)
}
throw new PHPExcel_Exception('Unknown codepage: ' . $codePage);
}
}

View File

@ -21,6 +21,20 @@
*
* @category PHPExcel
* @package PHPExcel_Shared
<<<<<<< HEAD
=======
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_Date
*
* @category PHPExcel
* @package PHPExcel_Shared
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
@ -38,6 +52,7 @@ class PHPExcel_Shared_Date
* @public
* @var string[]
*/
<<<<<<< HEAD
public static $monthNames = array(
'Jan' => 'January',
'Feb' => 'February',
@ -52,6 +67,21 @@ class PHPExcel_Shared_Date
'Nov' => 'November',
'Dec' => 'December',
);
=======
public static $_monthNames = array( 'Jan' => 'January',
'Feb' => 'February',
'Mar' => 'March',
'Apr' => 'April',
'May' => 'May',
'Jun' => 'June',
'Jul' => 'July',
'Aug' => 'August',
'Sep' => 'September',
'Oct' => 'October',
'Nov' => 'November',
'Dec' => 'December',
);
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/*
* Names of the months of the year, indexed by shortname
@ -60,12 +90,20 @@ class PHPExcel_Shared_Date
* @public
* @var string[]
*/
<<<<<<< HEAD
public static $numberSuffixes = array(
'st',
'nd',
'rd',
'th',
);
=======
public static $_numberSuffixes = array( 'st',
'nd',
'rd',
'th',
);
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/*
* Base calendar year to use for calculations
@ -73,7 +111,11 @@ class PHPExcel_Shared_Date
* @private
* @var int
*/
<<<<<<< HEAD
protected static $excelBaseDate = self::CALENDAR_WINDOWS_1900;
=======
protected static $_excelBaseDate = self::CALENDAR_WINDOWS_1900;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/**
* Set the Excel calendar (Windows 1900 or Mac 1904)
@ -81,6 +123,7 @@ class PHPExcel_Shared_Date
* @param integer $baseDate Excel base date (1900 or 1904)
* @return boolean Success or failure
*/
<<<<<<< HEAD
public static function setExcelCalendar($baseDate)
{
if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
@ -90,6 +133,16 @@ class PHPExcel_Shared_Date
}
return false;
}
=======
public static function setExcelCalendar($baseDate) {
if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
($baseDate == self::CALENDAR_MAC_1904)) {
self::$_excelBaseDate = $baseDate;
return TRUE;
}
return FALSE;
} // function setExcelCalendar()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/**
@ -97,10 +150,16 @@ class PHPExcel_Shared_Date
*
* @return integer Excel base date (1900 or 1904)
*/
<<<<<<< HEAD
public static function getExcelCalendar()
{
return self::$excelBaseDate;
}
=======
public static function getExcelCalendar() {
return self::$_excelBaseDate;
} // function getExcelCalendar()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/**
@ -112,6 +171,7 @@ class PHPExcel_Shared_Date
* @param string $timezone The timezone for finding the adjustment from UST
* @return long PHP serialized date/time
*/
<<<<<<< HEAD
public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = false, $timezone = null)
{
if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) {
@ -122,11 +182,26 @@ class PHPExcel_Shared_Date
}
} else {
$myexcelBaseDate = 24107;
=======
public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) {
$my_excelBaseDate = 25569;
// Adjust for the spurious 29-Feb-1900 (Day 60)
if ($dateValue < 60) {
--$my_excelBaseDate;
}
} else {
$my_excelBaseDate = 24107;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
}
// Perform conversion
if ($dateValue >= 1) {
<<<<<<< HEAD
$utcDays = $dateValue - $myexcelBaseDate;
=======
$utcDays = $dateValue - $my_excelBaseDate;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$returnValue = round($utcDays * 86400);
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
$returnValue = (integer) $returnValue;
@ -142,8 +217,14 @@ class PHPExcel_Shared_Date
PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) :
0;
<<<<<<< HEAD
return $returnValue + $timezoneAdjustment;
}
=======
// Return
return $returnValue + $timezoneAdjustment;
} // function ExcelToPHP()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/**
@ -152,8 +233,12 @@ class PHPExcel_Shared_Date
* @param integer $dateValue Excel date/time value
* @return DateTime PHP date/time object
*/
<<<<<<< HEAD
public static function ExcelToPHPObject($dateValue = 0)
{
=======
public static function ExcelToPHPObject($dateValue = 0) {
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$dateTime = self::ExcelToPHP($dateValue);
$days = floor($dateTime / 86400);
$time = round((($dateTime / 86400) - $days) * 86400);
@ -165,7 +250,11 @@ class PHPExcel_Shared_Date
$dateObj->setTime($hours,$minutes,$seconds);
return $dateObj;
<<<<<<< HEAD
}
=======
} // function ExcelToPHPObject()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/**
@ -178,11 +267,18 @@ class PHPExcel_Shared_Date
* @return mixed Excel date/time value
* or boolean FALSE on failure
*/
<<<<<<< HEAD
public static function PHPToExcel($dateValue = 0, $adjustToTimezone = false, $timezone = null)
{
$saveTimeZone = date_default_timezone_get();
date_default_timezone_set('UTC');
$retValue = false;
=======
public static function PHPToExcel($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
$saveTimeZone = date_default_timezone_get();
date_default_timezone_set('UTC');
$retValue = FALSE;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
$retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'),
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
@ -195,7 +291,11 @@ class PHPExcel_Shared_Date
date_default_timezone_set($saveTimeZone);
return $retValue;
<<<<<<< HEAD
}
=======
} // function PHPToExcel()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/**
@ -209,13 +309,19 @@ class PHPExcel_Shared_Date
* @param long $seconds
* @return long Excel date/time value
*/
<<<<<<< HEAD
public static function FormattedPHPToExcel($year, $month, $day, $hours = 0, $minutes = 0, $seconds = 0)
{
if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) {
=======
public static function FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0) {
if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) {
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
//
// Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel
// This affects every date following 28th February 1900
//
<<<<<<< HEAD
$excel1900isLeapYear = true;
if (($year == 1900) && ($month <= 2)) {
$excel1900isLeapYear = false;
@ -224,6 +330,14 @@ class PHPExcel_Shared_Date
} else {
$myexcelBaseDate = 2416481;
$excel1900isLeapYear = false;
=======
$excel1900isLeapYear = TRUE;
if (($year == 1900) && ($month <= 2)) { $excel1900isLeapYear = FALSE; }
$my_excelBaseDate = 2415020;
} else {
$my_excelBaseDate = 2416481;
$excel1900isLeapYear = FALSE;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
}
// Julian base date Adjustment
@ -237,12 +351,20 @@ class PHPExcel_Shared_Date
// Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0)
$century = substr($year,0,2);
$decade = substr($year,2,2);
<<<<<<< HEAD
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myexcelBaseDate + $excel1900isLeapYear;
=======
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $my_excelBaseDate + $excel1900isLeapYear;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;
return (float) $excelDate + $excelTime;
<<<<<<< HEAD
}
=======
} // function FormattedPHPToExcel()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/**
@ -251,14 +373,22 @@ class PHPExcel_Shared_Date
* @param PHPExcel_Cell $pCell
* @return boolean
*/
<<<<<<< HEAD
public static function isDateTime(PHPExcel_Cell $pCell)
{
=======
public static function isDateTime(PHPExcel_Cell $pCell) {
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
return self::isDateTimeFormat(
$pCell->getWorksheet()->getStyle(
$pCell->getCoordinate()
)->getNumberFormat()
);
<<<<<<< HEAD
}
=======
} // function isDateTime()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/**
@ -267,10 +397,16 @@ class PHPExcel_Shared_Date
* @param PHPExcel_Style_NumberFormat $pFormat
* @return boolean
*/
<<<<<<< HEAD
public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat)
{
return self::isDateTimeFormatCode($pFormat->getFormatCode());
}
=======
public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat) {
return self::isDateTimeFormatCode($pFormat->getFormatCode());
} // function isDateTimeFormat()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
private static $possibleDateFormatCharacters = 'eymdHs';
@ -281,6 +417,7 @@ class PHPExcel_Shared_Date
* @param string $pFormatCode
* @return boolean
*/
<<<<<<< HEAD
public static function isDateTimeFormatCode($pFormatCode = '')
{
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL))
@ -289,6 +426,15 @@ class PHPExcel_Shared_Date
if (preg_match('/[0#]E[+-]0/i', $pFormatCode))
// Scientific format
return false;
=======
public static function isDateTimeFormatCode($pFormatCode = '') {
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL))
// "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check)
return FALSE;
if (preg_match('/[0#]E[+-]0/i', $pFormatCode))
// Scientific format
return FALSE;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
// Switch on formatcode
switch ($pFormatCode) {
// Explicitly defined date formats
@ -314,6 +460,7 @@ class PHPExcel_Shared_Date
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22:
<<<<<<< HEAD
return true;
}
@ -342,6 +489,36 @@ class PHPExcel_Shared_Date
// No date...
return false;
}
=======
return TRUE;
}
// Typically number, currency or accounting (or occasionally fraction) formats
if ((substr($pFormatCode,0,1) == '_') || (substr($pFormatCode,0,2) == '0 ')) {
return FALSE;
}
// Try checking for any of the date formatting characters that don't appear within square braces
if (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$pFormatCode)) {
// We might also have a format mask containing quoted strings...
// we don't want to test for any of our characters within the quoted blocks
if (strpos($pFormatCode,'"') !== FALSE) {
$segMatcher = FALSE;
foreach(explode('"',$pFormatCode) as $subVal) {
// Only test in alternate array entries (the non-quoted blocks)
if (($segMatcher = !$segMatcher) &&
(preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$subVal))) {
return TRUE;
}
}
return FALSE;
}
return TRUE;
}
// No date...
return FALSE;
} // function isDateTimeFormatCode()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/**
@ -350,16 +527,25 @@ class PHPExcel_Shared_Date
* @param string $dateValue Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10'
* @return float|FALSE Excel date/time serial value
*/
<<<<<<< HEAD
public static function stringToExcel($dateValue = '')
{
if (strlen($dateValue) < 2)
return false;
if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue))
return false;
=======
public static function stringToExcel($dateValue = '') {
if (strlen($dateValue) < 2)
return FALSE;
if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue))
return FALSE;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue);
if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) {
<<<<<<< HEAD
return false;
}
@ -375,6 +561,24 @@ class PHPExcel_Shared_Date
public static function monthStringToNumber($month)
{
=======
return FALSE;
} else {
if (strpos($dateValue, ':') !== FALSE) {
$timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($dateValue);
if ($timeValue === PHPExcel_Calculation_Functions::VALUE()) {
return FALSE;
}
$dateValueNew += $timeValue;
}
return $dateValueNew;
}
}
public static function monthStringToNumber($month) {
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$monthIndex = 1;
foreach(self::$monthNames as $shortMonthName => $longMonthName) {
if (($month === $longMonthName) || ($month === $shortMonthName)) {
@ -385,9 +589,14 @@ class PHPExcel_Shared_Date
return $month;
}
<<<<<<< HEAD
public static function dayStringToNumber($day)
{
$strippedDayValue = (str_replace(self::$numberSuffixes, '', $day));
=======
public static function dayStringToNumber($day) {
$strippedDayValue = (str_replace(self::$_numberSuffixes,'',$day));
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
if (is_numeric($strippedDayValue)) {
return $strippedDayValue;
}

View File

@ -52,9 +52,9 @@ class PHPExcel_Shared_TimeZone
*/
public static function _validateTimeZone($timezone) {
if (in_array($timezone, DateTimeZone::listIdentifiers())) {
return TRUE;
return true;
}
return FALSE;
return false;
}
/**
@ -66,9 +66,9 @@ class PHPExcel_Shared_TimeZone
public static function setTimeZone($timezone) {
if (self::_validateTimezone($timezone)) {
self::$_timezone = $timezone;
return TRUE;
return true;
}
return FALSE;
return false;
} // function setTimezone()
@ -92,7 +92,7 @@ class PHPExcel_Shared_TimeZone
private static function _getTimezoneTransitions($objTimezone, $timestamp) {
$allTransitions = $objTimezone->getTransitions();
$transitions = array();
foreach($allTransitions as $key => $transition) {
foreach ($allTransitions as $key => $transition) {
if ($transition['ts'] > $timestamp) {
$transitions[] = ($key > 0) ? $allTransitions[$key - 1] : $transition;
break;
@ -115,7 +115,7 @@ class PHPExcel_Shared_TimeZone
* @throws PHPExcel_Exception
*/
public static function getTimeZoneAdjustment($timezone, $timestamp) {
if ($timezone !== NULL) {
if ($timezone !== null) {
if (!self::_validateTimezone($timezone)) {
throw new PHPExcel_Exception("Invalid timezone " . $timezone);
}
@ -136,5 +136,4 @@ class PHPExcel_Shared_TimeZone
return (count($transitions) > 0) ? $transitions[0]['offset'] : 0;
}
}

View File

@ -30,12 +30,34 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PCLZip/pclzip.lib.php';
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
<<<<<<< HEAD
=======
if (!defined('PCLZIP_TEMPORARY_DIR')) {
define('PCLZIP_TEMPORARY_DIR', PHPExcel_Shared_File::sys_get_temp_dir() . DIRECTORY_SEPARATOR);
}
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PCLZip/pclzip.lib.php';
/**
* PHPExcel_Shared_ZipArchive
*
* @category PHPExcel
* @package PHPExcel_Shared_ZipArchive
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
class PHPExcel_Shared_ZipArchive
{
/** constants */
<<<<<<< HEAD
const OVERWRITE = 'OVERWRITE';
const CREATE = 'CREATE';
=======
const OVERWRITE = 'OVERWRITE';
const CREATE = 'CREATE';
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/**
@ -92,10 +114,14 @@ class PHPExcel_Shared_ZipArchive
fwrite($handle, $contents);
fclose($handle);
<<<<<<< HEAD
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"],
PCLZIP_OPT_REMOVE_PATH, $this->_tempDir,
PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]
);
=======
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->_tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]);
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
if ($res == 0) {
throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true));
}

View File

@ -48,7 +48,8 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
* @param PHPExcel_Writer_IWriter $pWriter
* @throws PHPExcel_Writer_Exception
*/
public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null) {
public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null)
{
$this->_parentWriter = $pWriter;
}
@ -58,7 +59,8 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
* @return PHPExcel_Writer_IWriter
* @throws PHPExcel_Writer_Exception
*/
public function getParentWriter() {
public function getParentWriter()
{
if (!is_null($this->_parentWriter)) {
return $this->_parentWriter;
} else {
@ -72,10 +74,10 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
* @param PHPExcel_Writer_IWriter $pWriter
* @throws PHPExcel_Writer_Exception
*/
public function __construct(PHPExcel_Writer_IWriter $pWriter = null) {
public function __construct(PHPExcel_Writer_IWriter $pWriter = null)
{
if (!is_null($pWriter)) {
$this->_parentWriter = $pWriter;
}
}
}

View File

@ -95,7 +95,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
*
* @param PHPExcel $phpExcel PHPExcel object
*/
public function __construct(PHPExcel $phpExcel) {
public function __construct(PHPExcel $phpExcel)
{
$this->_phpExcel = $phpExcel;
$this->_parser = new PHPExcel_Writer_Excel5_Parser();
@ -107,13 +108,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* @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);
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
@ -121,18 +123,12 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$this->_colors = array();
// Initialise workbook writer
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel,
$this->_str_total, $this->_str_unique, $this->_str_table,
$this->_colors, $this->_parser);
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser);
// Initialise worksheet writers
$countSheets = $this->_phpExcel->getSheetCount();
for ($i = 0; $i < $countSheets; ++$i) {
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique,
$this->_str_table, $this->_colors,
$this->_parser,
$this->_preCalculateFormulas,
$this->_phpExcel->getSheet($i));
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser, $this->_preCalculateFormulas, $this->_phpExcel->getSheet($i));
}
// build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
@ -190,14 +186,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation();
// initialize OLE Document Summary Information
if(isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)){
if (isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)) {
$OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
$OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation);
}
$this->_summaryInformation = $this->_writeSummaryInformation();
// initialize OLE Summary Information
if(isset($this->_summaryInformation) && !empty($this->_summaryInformation)){
if (isset($this->_summaryInformation) && !empty($this->_summaryInformation)) {
$OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
$OLE_SummaryInformation->append($this->_summaryInformation);
}
@ -205,11 +201,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
// define OLE Parts
$arrRootData = array($OLE);
// initialize OLE Properties file
if(isset($OLE_SummaryInformation)){
if (isset($OLE_SummaryInformation)) {
$arrRootData[] = $OLE_SummaryInformation;
}
// initialize OLE Extended Properties file
if(isset($OLE_DocumentSummaryInformation)){
if (isset($OLE_DocumentSummaryInformation)) {
$arrRootData[] = $OLE_DocumentSummaryInformation;
}
@ -229,7 +225,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_Excel5
*/
public function setTempDir($pValue = '') {
public function setTempDir($pValue = '')
{
return $this;
}
@ -330,13 +327,13 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
}
// AutoFilters
if(!empty($filterRange)){
if (!empty($filterRange)) {
$rangeBounds = PHPExcel_Cell::rangeBoundaries($filterRange);
$iNumColStart = $rangeBounds[0][0];
$iNumColEnd = $rangeBounds[1][0];
$iInc = $iNumColStart;
while($iInc <= $iNumColEnd){
while($iInc <= $iNumColEnd) {
++$countShapes[$sheetIndex];
// create an Drawing Object for the dropdown
@ -444,8 +441,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
++$sheetCountShapes;
++$totalCountShapes;
$spId = $sheetCountShapes
| ($this->_phpExcel->getIndex($sheet) + 1) << 10;
$spId = $sheetCountShapes | ($this->_phpExcel->getIndex($sheet) + 1) << 10;
$spIdMax = max($spId, $spIdMax);
}
}
@ -463,31 +459,26 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
foreach ($sheet->getDrawingCollection() as $drawing) {
if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
$filename = $drawing->getPath();
list($imagesx, $imagesy, $imageFormat) = getimagesize($filename);
switch ($imageFormat) {
case 1: // GIF, not supported by BIFF8, we convert to PNG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
ob_start();
imagepng(imagecreatefromgif($filename));
imagepng(imagecreatefromgif ($filename));
$blipData = ob_get_contents();
ob_end_clean();
break;
case 2: // JPEG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
$blipData = file_get_contents($filename);
break;
case 3: // PNG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
$blipData = file_get_contents($filename);
break;
case 6: // Windows DIB (BMP), we convert to PNG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
ob_start();
@ -495,9 +486,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$blipData = ob_get_contents();
ob_end_clean();
break;
default: continue 2;
default:
continue 2;
}
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
@ -508,23 +498,18 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$BSE->setBlip($blip);
$bstoreContainer->addBSE($BSE);
} else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
switch ($drawing->getRenderingFunction()) {
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
$renderingFunction = 'imagejpeg';
break;
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF:
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG:
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT:
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
$renderingFunction = 'imagepng';
break;
}
ob_start();
@ -552,8 +537,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the OLE Part for DocumentSummary Information
* @return string
*/
private function _writeDocumentSummaryInformation(){
private function _writeDocumentSummaryInformation()
{
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE);
// offset: 2; size: 2;
@ -586,7 +571,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
// GKPIDDSI_CATEGORY : Category
if($this->_phpExcel->getProperties()->getCategory()){
if ($this->_phpExcel->getProperties()->getCategory()) {
$dataProp = $this->_phpExcel->getProperties()->getCategory();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'),
@ -682,7 +667,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
// 4 Property count
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
foreach ($dataSection as $dataProp){
foreach ($dataSection as $dataProp) {
// Summary
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
// Offset
@ -690,25 +675,25 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
// DataType
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
// Data
if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer
if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif($dataProp['type']['data'] == 0x0B){ // Boolean
if($dataProp['data']['data'] == false){
elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
if ($dataProp['data']['data'] == false) {
$dataSection_Content .= pack('V', 0x0000);
} else {
$dataSection_Content .= pack('V', 0x0001);
}
$dataSection_Content_Offset += 4 + 4;
}
elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
// Null-terminated string
$dataProp['data']['data'] .= chr(0);
$dataProp['data']['length'] += 1;
@ -721,7 +706,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
}
elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 8;
@ -753,7 +738,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the OLE Part for Summary Information
* @return string
*/
private function _writeSummaryInformation(){
private function _writeSummaryInformation()
{
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE);
// offset: 2; size: 2;
@ -786,7 +772,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
// Title
if($this->_phpExcel->getProperties()->getTitle()){
if ($this->_phpExcel->getProperties()->getTitle()) {
$dataProp = $this->_phpExcel->getProperties()->getTitle();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'),
@ -795,7 +781,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Subject
if($this->_phpExcel->getProperties()->getSubject()){
if ($this->_phpExcel->getProperties()->getSubject()) {
$dataProp = $this->_phpExcel->getProperties()->getSubject();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03),
'offset' => array('pack' => 'V'),
@ -804,7 +790,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Author (Creator)
if($this->_phpExcel->getProperties()->getCreator()){
if ($this->_phpExcel->getProperties()->getCreator()) {
$dataProp = $this->_phpExcel->getProperties()->getCreator();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04),
'offset' => array('pack' => 'V'),
@ -813,7 +799,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Keywords
if($this->_phpExcel->getProperties()->getKeywords()){
if ($this->_phpExcel->getProperties()->getKeywords()) {
$dataProp = $this->_phpExcel->getProperties()->getKeywords();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05),
'offset' => array('pack' => 'V'),
@ -822,7 +808,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Comments (Description)
if($this->_phpExcel->getProperties()->getDescription()){
if ($this->_phpExcel->getProperties()->getDescription()) {
$dataProp = $this->_phpExcel->getProperties()->getDescription();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06),
'offset' => array('pack' => 'V'),
@ -831,7 +817,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Last Saved By (LastModifiedBy)
if($this->_phpExcel->getProperties()->getLastModifiedBy()){
if ($this->_phpExcel->getProperties()->getLastModifiedBy()) {
$dataProp = $this->_phpExcel->getProperties()->getLastModifiedBy();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08),
'offset' => array('pack' => 'V'),
@ -840,7 +826,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Created Date/Time
if($this->_phpExcel->getProperties()->getCreated()){
if ($this->_phpExcel->getProperties()->getCreated()) {
$dataProp = $this->_phpExcel->getProperties()->getCreated();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
'offset' => array('pack' => 'V'),
@ -849,7 +835,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Modified Date/Time
if($this->_phpExcel->getProperties()->getModified()){
if ($this->_phpExcel->getProperties()->getModified()) {
$dataProp = $this->_phpExcel->getProperties()->getModified();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
'offset' => array('pack' => 'V'),
@ -869,7 +855,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
// 4 Property count
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
foreach ($dataSection as $dataProp){
foreach ($dataSection as $dataProp) {
// Summary
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
// Offset
@ -877,17 +863,17 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
// DataType
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
// Data
if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer
if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
// Null-terminated string
$dataProp['data']['data'] .= chr(0);
$dataProp['data']['length'] += 1;
@ -900,7 +886,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
}
elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 8;

View File

@ -118,7 +118,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
$number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
if ($number == $teststr) {
$byte_order = 0; // Little Endian
} elseif ($number == strrev($teststr)){
} elseif ($number == strrev($teststr)) {
$byte_order = 1; // Big Endian
} else {
// Give up. I'll fix this in a later version.
@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* @param string $data binary data to append
* @access private
*/
function _append($data)
private function _append($data)
{
if (strlen($data) - 4 > $this->_limit) {
$data = $this->_addContinue($data);
@ -169,7 +169,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* 0x0010 Worksheet.
* @access private
*/
function _storeBof($type)
private function _storeBof($type)
{
$record = 0x0809; // Record identifier (BIFF5-BIFF8)
$length = 0x0010;
@ -192,7 +192,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
*
* @access private
*/
function _storeEof()
private function _storeEof()
{
$record = 0x000A; // Record identifier
$length = 0x0000; // Number of bytes to follow
@ -226,7 +226,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* @return string A very convenient string of continue blocks
* @access private
*/
function _addContinue($data)
private function _addContinue($data)
{
$limit = $this->_limit;
$record = 0x003C; // Record identifier
@ -251,5 +251,4 @@ class PHPExcel_Writer_Excel5_BIFFwriter
return $tmp;
}
}

View File

@ -78,7 +78,6 @@ class PHPExcel_Writer_Excel5_Escher
$this->_data = '';
switch (get_class($this->_object)) {
case 'PHPExcel_Shared_Escher':
if ($dggContainer = $this->_object->getDggContainer()) {
$writer = new PHPExcel_Writer_Excel5_Escher($dggContainer);
@ -90,7 +89,6 @@ class PHPExcel_Writer_Excel5_Escher
$this->_spTypes = $writer->getSpTypes();
}
break;
case 'PHPExcel_Shared_Escher_DggContainer':
// this is a container record
@ -107,11 +105,11 @@ class PHPExcel_Writer_Excel5_Escher
// dgg data
$dggData =
pack('VVVV'
, $this->_object->getSpIdMax() // maximum shape identifier increased by one
, $this->_object->getCDgSaved() + 1 // number of file identifier clusters increased by one
, $this->_object->getCSpSaved()
, $this->_object->getCDgSaved() // count total number of drawings saved
pack('VVVV',
$this->_object->getSpIdMax(), // maximum shape identifier increased by one
$this->_object->getCDgSaved() + 1, // number of file identifier clusters increased by one
$this->_object->getCSpSaved(),
$this->_object->getCDgSaved() // count total number of drawings saved
);
// add file identifier clusters (one per drawing)
@ -143,7 +141,6 @@ class PHPExcel_Writer_Excel5_Escher
$this->_data = $header . $innerData;
break;
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer':
// this is a container record
@ -171,7 +168,6 @@ class PHPExcel_Writer_Excel5_Escher
$this->_data = $header . $innerData;
break;
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE':
// this is a semi-container record
@ -221,13 +217,11 @@ class PHPExcel_Writer_Excel5_Escher
$this->_data .= $data;
break;
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip':
// this is an atom record
// write the record
switch ($this->_object->getParent()->getBlipType()) {
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG:
// initialize
$innerData = '';
@ -281,10 +275,8 @@ class PHPExcel_Writer_Excel5_Escher
$this->_data .= $innerData;
break;
}
break;
case 'PHPExcel_Shared_Escher_DgContainer':
// this is a container record
@ -338,7 +330,6 @@ class PHPExcel_Writer_Excel5_Escher
$this->_data = $header . $innerData;
break;
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer':
// this is a container record
@ -378,7 +369,6 @@ class PHPExcel_Writer_Excel5_Escher
$this->_spOffsets = $spOffsets;
$this->_spTypes = $spTypes;
break;
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer':
// initialize
$data = '';
@ -464,9 +454,7 @@ class PHPExcel_Writer_Excel5_Escher
// end offsetY
$endOffsetY = $this->_object->getEndOffsetY();
$clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(),
$c1, $startOffsetX, $r1, $startOffsetY,
$c2, $endOffsetX, $r2, $endOffsetY);
$clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(), $c1, $startOffsetX, $r1, $startOffsetY, $c2, $endOffsetX, $r2, $endOffsetY);
$length = strlen($clientAnchorData);
@ -507,7 +495,6 @@ class PHPExcel_Writer_Excel5_Escher
$this->_data = $header . $data;
break;
}
return $this->_data;
@ -532,6 +519,4 @@ class PHPExcel_Writer_Excel5_Escher
{
return $this->_spTypes;
}
}

View File

@ -107,12 +107,17 @@ class PHPExcel_Writer_Excel5_Font
$grbit |= 0x20;
}
$data = pack("vvvvvCCCC",
$this->_font->getSize() * 20, // Fontsize (in twips)
$data = pack(
"vvvvvCCCC",
// Fontsize (in twips)
$this->_font->getSize() * 20,
$grbit,
$icv, // Colour
self::_mapBold($this->_font->getBold()), // Font weight
$sss, // Superscript/Subscript
// Colour
$icv,
// Font weight
self::_mapBold($this->_font->getBold()),
// Superscript/Subscript
$sss,
self::_mapUnderline($this->_font->getUnderline()),
$bFamily,
$bCharSet,
@ -132,7 +137,8 @@ class PHPExcel_Writer_Excel5_Font
* @param boolean $bold
* @return int
*/
private static function _mapBold($bold) {
private static function _mapBold($bold)
{
if ($bold) {
return 0x2BC; // 700 = Bold font weight
}
@ -144,7 +150,8 @@ class PHPExcel_Writer_Excel5_Font
* @static array of int
*
*/
private static $_mapUnderline = array( PHPExcel_Style_Font::UNDERLINE_NONE => 0x00,
private static $_mapUnderline = array(
PHPExcel_Style_Font::UNDERLINE_NONE => 0x00,
PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01,
PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02,
PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21,
@ -156,10 +163,11 @@ class PHPExcel_Writer_Excel5_Font
* @param string
* @return int
*/
private static function _mapUnderline($underline) {
if (isset(self::$_mapUnderline[$underline]))
private static function _mapUnderline($underline)
{
if (isset(self::$_mapUnderline[$underline])) {
return self::$_mapUnderline[$underline];
}
return 0x00;
}
}

View File

@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel5_Parser
*
* @access private
*/
function _initializeHashes()
private function _initializeHashes()
{
// The Excel ptg indices
$this->ptg = array(
@ -512,7 +512,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param mixed $token The token to convert.
* @return mixed the converted token on success
*/
function _convert($token)
private function _convert($token)
{
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) {
return $this->_convertString($token);
@ -521,15 +521,15 @@ class PHPExcel_Writer_Excel5_Parser
return $this->_convertNumber($token);
// match references like A1 or $A$1
} elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/',$token)) {
} elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) {
return $this->_convertRef2d($token);
// match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u",$token)) {
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
return $this->_convertRef3d($token);
// match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u",$token)) {
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
return $this->_convertRef3d($token);
// match ranges like A1:B2 or $A$1:$B$2
@ -537,11 +537,11 @@ class PHPExcel_Writer_Excel5_Parser
return $this->_convertRange2d($token);
// match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u",$token)) {
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
return $this->_convertRange3d($token);
// match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u",$token)) {
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
return $this->_convertRange3d($token);
// operators (including parentheses)
@ -553,9 +553,9 @@ class PHPExcel_Writer_Excel5_Parser
return $this->_convertError($token);
// commented so argument number can be processed correctly. See toReversePolish().
/*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/",$token))
/*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token))
{
return($this->_convertFunction($token,$this->_func_args));
return($this->_convertFunction($token, $this->_func_args));
}*/
// if it's an argument, ignore the token (the argument remains)
@ -573,7 +573,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @param mixed $num an integer or double for conversion to its ptg value
*/
function _convertNumber($num)
private function _convertNumber($num)
{
// Integer in the range 0..2**16-1
if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
@ -593,7 +593,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $string A string for conversion to its ptg value.
* @return mixed the converted token on success
*/
function _convertString($string)
private function _convertString($string)
{
// chop away beggining and ending quotes
$string = substr($string, 1, strlen($string) - 2);
@ -613,16 +613,16 @@ class PHPExcel_Writer_Excel5_Parser
* @param integer $num_args The number of arguments the function receives.
* @return string The packed ptg for the function
*/
function _convertFunction($token, $num_args)
private function _convertFunction($token, $num_args)
{
$args = $this->_functions[$token][1];
// $volatile = $this->_functions[$token][3];
// Fixed number of args eg. TIME($i,$j,$k).
// Fixed number of args eg. TIME($i, $j, $k).
if ($args >= 0) {
return pack("Cv", $this->ptg['ptgFuncV'], $this->_functions[$token][0]);
}
// Variable number of args eg. SUM($i,$j,$k, ..).
// Variable number of args eg. SUM($i, $j, $k, ..).
if ($args == -1) {
return pack("CCv", $this->ptg['ptgFuncVarV'], $num_args, $this->_functions[$token][0]);
}
@ -635,7 +635,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $range An Excel range in the A1:A2
* @param int $class
*/
function _convertRange2d($range, $class=0)
private function _convertRange2d($range, $class = 0)
{
// TODO: possible class value 0,1,2 check Formula.pm
@ -673,7 +673,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $token An Excel range in the Sheet1!A1:A2 format.
* @return mixed The packed ptgArea3d token on success.
*/
function _convertRange3d($token)
private function _convertRange3d($token)
{
// $class = 0; // formulas like Sheet1!$A$1:$A$2 in list type data validation need this class (0x3B)
@ -715,7 +715,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $cell An Excel cell reference
* @return string The cell in packed() format with the corresponding ptg
*/
function _convertRef2d($cell)
private function _convertRef2d($cell)
{
// $class = 2; // as far as I know, this is magick.
@ -745,7 +745,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $cell An Excel cell reference
* @return mixed The packed ptgRef3d token on success.
*/
function _convertRef3d($cell)
private function _convertRef3d($cell)
{
// $class = 2; // as far as I know, this is magick.
@ -779,16 +779,23 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $errorCode The error code for conversion to its ptg value
* @return string The error code ptgErr
*/
function _convertError($errorCode)
private function _convertError($errorCode)
{
switch ($errorCode) {
case '#NULL!': return pack("C", 0x00);
case '#DIV/0!': return pack("C", 0x07);
case '#VALUE!': return pack("C", 0x0F);
case '#REF!': return pack("C", 0x17);
case '#NAME?': return pack("C", 0x1D);
case '#NUM!': return pack("C", 0x24);
case '#N/A': return pack("C", 0x2A);
case '#NULL!':
return pack("C", 0x00);
case '#DIV/0!':
return pack("C", 0x07);
case '#VALUE!':
return pack("C", 0x0F);
case '#REF!':
return pack("C", 0x17);
case '#NAME?':
return pack("C", 0x1D);
case '#NUM!':
return pack("C", 0x24);
case '#N/A':
return pack("C", 0x2A);
}
return pack("C", 0xFF);
}
@ -801,7 +808,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $ext_ref The name of the external reference
* @return string The reference index in packed() format
*/
function _packExtRef($ext_ref)
private function _packExtRef($ext_ref)
{
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
@ -846,7 +853,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $ext_ref The name of the external reference
* @return mixed The reference index in packed() format on success
*/
function _getRefIndex($ext_ref)
private function _getRefIndex($ext_ref)
{
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
@ -906,7 +913,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $sheet_name Sheet name
* @return integer The sheet index, -1 if the sheet was not found
*/
function _getSheetIndex($sheet_name)
private function _getSheetIndex($sheet_name)
{
if (!isset($this->_ext_sheets[$sheet_name])) {
return -1;
@ -925,7 +932,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $name The name of the worksheet being added
* @param integer $index The index of the worksheet being added
*/
function setExtSheet($name, $index)
public function setExtSheet($name, $index)
{
$this->_ext_sheets[$name] = $index;
}
@ -937,7 +944,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $cell The Excel cell reference to be packed
* @return array Array containing the row and column in packed() format
*/
function _cellToPackedRowcol($cell)
private function _cellToPackedRowcol($cell)
{
$cell = strtoupper($cell);
list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell);
@ -966,7 +973,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $range The Excel range to be packed
* @return array Array containing (row1,col1,row2,col2) in packed() format
*/
function _rangeToPackedRange($range)
private function _rangeToPackedRange($range)
{
preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match);
// return absolute rows if there is a $ in the ref
@ -1007,9 +1014,9 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $cell The Excel cell reference in A1 format.
* @return array
*/
function _cellToRowcol($cell)
private function _cellToRowcol($cell)
{
preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/',$cell,$match);
preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/', $cell, $match);
// return absolute column if there is a $ in the ref
$col_rel = empty($match[1]) ? 1 : 0;
$col_ref = $match[2];
@ -1037,7 +1044,7 @@ class PHPExcel_Writer_Excel5_Parser
*
* @access private
*/
function _advance()
private function _advance()
{
$i = $this->_current_char;
$formula_length = strlen($this->_formula);
@ -1088,7 +1095,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param mixed $token The token to check.
* @return mixed The checked token or false on failure
*/
function _match($token)
private function _match($token)
{
switch($token) {
case "+":
@ -1123,65 +1130,55 @@ class PHPExcel_Writer_Excel5_Parser
break;
default:
// if it's a reference A1 or $A$1 or $A1 or A$1
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$token) and
!preg_match("/[0-9]/",$this->_lookahead) and
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and
!preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.') and
($this->_lookahead != '!'))
{
($this->_lookahead != '!')) {
return $token;
}
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$token) and
!preg_match("/[0-9]/",$this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.'))
{
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
return $token;
}
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$token) and
!preg_match("/[0-9]/",$this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.'))
{
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
return $token;
}
// if it's a range A1:A2 or $A$1:$A$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) and
!preg_match("/[0-9]/",$this->_lookahead))
{
!preg_match("/[0-9]/", $this->_lookahead)) {
return $token;
}
// If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$token) and
!preg_match("/[0-9]/",$this->_lookahead))
{
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead)) {
return $token;
}
// If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$token) and
!preg_match("/[0-9]/",$this->_lookahead))
{
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead)) {
return $token;
}
// If it's a number (check that it's not a sheet name or range)
elseif (is_numeric($token) and
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
($this->_lookahead != '!') and ($this->_lookahead != ':'))
{
($this->_lookahead != '!') and ($this->_lookahead != ':')) {
return $token;
}
// If it's a string (of maximum 255 characters)
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/",$token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0))
{
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
return $token;
}
// If it's an error code
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A')
{
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
return $token;
}
// if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$token) and ($this->_lookahead == "("))
{
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
return $token;
}
// It's an argument of some description (e.g. a named range),
@ -1201,7 +1198,7 @@ class PHPExcel_Writer_Excel5_Parser
* sign (=).
* @return mixed true on success
*/
function parse($formula)
public function parse($formula)
{
$this->_current_char = 0;
$this->_formula = $formula;
@ -1218,7 +1215,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @return mixed The parsed ptg'd tree on success
*/
function _condition()
private function _condition()
{
$result = $this->_expression();
if ($this->_current_token == "<") {
@ -1264,7 +1261,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @return mixed The parsed ptg'd tree on success
*/
function _expression()
private function _expression()
{
// If it's a string return a string node
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) {
@ -1323,7 +1320,7 @@ class PHPExcel_Writer_Excel5_Parser
* @see _fact()
* @return array The parsed ptg'd tree
*/
function _parenthesizedExpression()
private function _parenthesizedExpression()
{
$result = $this->_createTree('ptgParen', $this->_expression(), '');
return $result;
@ -1336,7 +1333,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @return mixed The parsed ptg'd tree on success
*/
function _term()
private function _term()
{
$result = $this->_fact();
while (($this->_current_token == "*") or
@ -1366,7 +1363,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @return mixed The parsed ptg'd tree on success
*/
function _fact()
private function _fact()
{
if ($this->_current_token == "(") {
$this->_advance(); // eat the "("
@ -1378,29 +1375,29 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// if it's a reference
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$this->_current_token))
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->_current_token))
{
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$this->_current_token))
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
{
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$this->_current_token))
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
{
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// if it's a range A1:B2 or $A$1:$B$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/',$this->_current_token) or
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/',$this->_current_token))
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token))
{
// must be an error?
$result = $this->_createTree($this->_current_token, '', '');
@ -1408,7 +1405,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$this->_current_token))
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
{
// must be an error?
//$result = $this->_current_token;
@ -1417,7 +1414,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$this->_current_token))
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
{
// must be an error?
//$result = $this->_current_token;
@ -1438,7 +1435,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$this->_current_token))
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token))
{
$result = $this->_func();
return $result;
@ -1455,7 +1452,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @return mixed The parsed ptg'd tree on success
*/
function _func()
private function _func()
{
$num_args = 0; // number of arguments received
$function = strtoupper($this->_current_token);
@ -1485,7 +1482,7 @@ class PHPExcel_Writer_Excel5_Parser
throw new PHPExcel_Writer_Exception("Function $function() doesn't exist");
}
$args = $this->_functions[$function][1];
// If fixed number of args eg. TIME($i,$j,$k). Check that the number of args is valid.
// If fixed number of args eg. TIME($i, $j, $k). Check that the number of args is valid.
if (($args >= 0) and ($args != $num_args)) {
throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() ");
}
@ -1505,7 +1502,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param mixed $right The right array (sub-tree) or a final node.
* @return array A tree
*/
function _createTree($value, $left, $right)
private function _createTree($value, $left, $right)
{
return array('value' => $value, 'left' => $left, 'right' => $right);
}
@ -1537,7 +1534,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param array $tree The optional tree to convert.
* @return string The tree in reverse polish notation
*/
function toReversePolish($tree = array())
public function toReversePolish($tree = array())
{
$polish = ""; // the string we are going to return
if (empty($tree)) { // If it's the first call use _parse_tree
@ -1559,9 +1556,9 @@ class PHPExcel_Writer_Excel5_Parser
$polish .= $converted_tree;
}
// if it's a function convert it here (so we can set it's arguments)
if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/",$tree['value']) and
!preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/',$tree['value']) and
!preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/",$tree['value']) and
if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/", $tree['value']) and
!preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and
!preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/", $tree['value']) and
!is_numeric($tree['value']) and
!isset($this->ptg[$tree['value']]))
{
@ -1579,5 +1576,4 @@ class PHPExcel_Writer_Excel5_Parser
$polish .= $converted_tree;
return $polish;
}
}

View File

@ -200,9 +200,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
* @param array &$colors Colour Table
* @param mixed $parser The formula parser created for the Workbook
*/
public function __construct(PHPExcel $phpExcel = null,
&$str_total, &$str_unique, &$str_table, &$colors,
$parser )
public function __construct(PHPExcel $phpExcel = null, &$str_total, &$str_unique, &$str_table, &$colors, $parser)
{
// It needs to call its parent's constructor explicitly
parent::__construct();
@ -303,7 +301,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
public function _addFont(PHPExcel_Style_Font $font)
{
$fontHashCode = $font->getHashCode();
if(isset($this->_addedFonts[$fontHashCode])){
if (isset($this->_addedFonts[$fontHashCode])) {
$fontIndex = $this->_addedFonts[$fontHashCode];
} else {
$countFonts = count($this->_fontWriters);
@ -324,7 +322,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $rgb E.g. 'FF00AA'
* @return int Color index
*/
private function _addColor($rgb) {
private function _addColor($rgb)
{
if (!isset($this->_colors[$rgb])) {
if (count($this->_colors) < 57) {
// then we add a custom color altering the palette
@ -354,7 +353,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
*
* @access private
*/
function _setPaletteXl97()
private function _setPaletteXl97()
{
$this->_palette = array(
0x08 => array(0x00, 0x00, 0x00, 0x00),
@ -477,7 +476,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
*
* @access private
*/
function _calcSheetOffsets()
private function _calcSheetOffsets()
{
$boundsheet_length = 10; // fixed length for a BOUNDSHEET record
@ -612,7 +611,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
// Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
@ -658,7 +656,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// Loop named ranges
$namedRanges = $this->_phpExcel->getNamedRanges();
foreach ($namedRanges as $namedRange) {
// Create absolute coordinate
$range = PHPExcel_Cell::splitRange($namedRange->getRange());
for ($i = 0; $i < count($range); $i++) {
@ -688,7 +685,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
}
$chunk .= $this->writeData($this->_writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false));
} catch(PHPExcel_Exception $e) {
} catch (PHPExcel_Exception $e) {
// do nothing
}
}
@ -721,7 +718,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
// Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
@ -785,7 +781,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
for ($i = 0; $i < $total_worksheets; ++$i) {
$sheetAutoFilter = $this->_phpExcel->getSheet($i)->getAutoFilter();
$autoFilterRange = $sheetAutoFilter->getRange();
if(!empty($autoFilterRange)) {
if (!empty($autoFilterRange)) {
$rangeBounds = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
//Autofilter built in name
@ -842,7 +838,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
* @param boolean $isHidden
* @return string Complete binary record data
* */
private function _writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false){
private function _writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false)
{
$record = 0x0018;
// option flags
@ -854,7 +851,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$rangeBounds[0][1] - 1,
$rangeBounds[1][1] - 1,
$rangeBounds[0][0] - 1,
$rangeBounds[1][0] - 1);
$rangeBounds[1][0] - 1
);
// size of the formula (in bytes)
$sz = strlen($extra);
@ -909,10 +907,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet
$header = pack("vv", $record, $length);
$data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn,
$grbit,
$itabCur, $itabFirst,
$ctabsel, $wTabRatio);
$data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio);
$this->_append($header . $data);
}
@ -929,10 +924,18 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// sheet state
switch ($sheet->getSheetState()) {
case PHPExcel_Worksheet::SHEETSTATE_VISIBLE: $ss = 0x00; break;
case PHPExcel_Worksheet::SHEETSTATE_HIDDEN: $ss = 0x01; break;
case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN: $ss = 0x02; break;
default: $ss = 0x00; break;
case PHPExcel_Worksheet::SHEETSTATE_VISIBLE:
$ss = 0x00;
break;
case PHPExcel_Worksheet::SHEETSTATE_HIDDEN:
$ss = 0x01;
break;
case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN:
$ss = 0x02;
break;
default:
$ss = 0x00;
break;
}
// sheet type
@ -1307,7 +1310,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// loop through all (unique) strings in shared strings table
foreach (array_keys($this->_str_table) as $string) {
// here $string is a BIFF8 encoded string
// length = character count
@ -1320,7 +1322,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$finished = false;
while ($finished === false) {
// normally, there will be only one cycle, but if string cannot immediately be written as is
// there will be need for more than one cylcle, if string longer than one record data block, there
// may be need for even more cycles
@ -1369,7 +1370,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$effective_space_remaining = $space_remaining;
// for uncompressed strings, sometimes effective space remaining is reduced by 1
if ( $encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1 ) {
if ($encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1) {
--$effective_space_remaining;
}
@ -1422,7 +1423,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$header = pack("vv", $record, $length);
return $this->writeData($header . $data);
} else {
return '';
}

File diff suppressed because it is too large Load Diff

View File

@ -166,7 +166,7 @@ class PHPExcel_Writer_Excel5_Xf
*
* @return string The XF record
*/
function writeXf()
public function writeXf()
{
// Set the type of the XF record and some of the attributes.
if ($this->_isStyleXf) {
@ -256,11 +256,7 @@ class PHPExcel_Writer_Excel5_Xf
$biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
$data = pack("vvvC", $ifnt, $ifmt, $style, $align);
$data .= pack("CCC"
, self::_mapTextRotation($this->_style->getAlignment()->getTextRotation())
, $biff8_options
, $used_attrib
);
$data .= pack("CCC", self::_mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
$data .= pack("VVv", $border1, $border2, $icv);
return($header . $data);
@ -282,7 +278,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
function setBottomColor($colorIndex)
public function setBottomColor($colorIndex)
{
$this->_bottom_color = $colorIndex;
}
@ -293,7 +289,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
function setTopColor($colorIndex)
public function setTopColor($colorIndex)
{
$this->_top_color = $colorIndex;
}
@ -304,7 +300,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
function setLeftColor($colorIndex)
public function setLeftColor($colorIndex)
{
$this->_left_color = $colorIndex;
}
@ -315,7 +311,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
function setRightColor($colorIndex)
public function setRightColor($colorIndex)
{
$this->_right_color = $colorIndex;
}
@ -326,7 +322,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
function setDiagColor($colorIndex)
public function setDiagColor($colorIndex)
{
$this->_diag_color = $colorIndex;
}
@ -338,7 +334,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
function setFgColor($colorIndex)
public function setFgColor($colorIndex)
{
$this->_fg_color = $colorIndex;
}
@ -349,7 +345,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
function setBgColor($colorIndex)
public function setBgColor($colorIndex)
{
$this->_bg_color = $colorIndex;
}
@ -361,7 +357,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param integer $numberFormatIndex Index to format record
*/
function setNumberFormatIndex($numberFormatIndex)
public function setNumberFormatIndex($numberFormatIndex)
{
$this->_numberFormatIndex = $numberFormatIndex;
}
@ -403,9 +399,11 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $borderStyle
* @return int
*/
private static function _mapBorderStyle($borderStyle) {
if (isset(self::$_mapBorderStyle[$borderStyle]))
private static function _mapBorderStyle($borderStyle)
{
if (isset(self::$_mapBorderStyle[$borderStyle])) {
return self::$_mapBorderStyle[$borderStyle];
}
return 0x00;
}
@ -442,9 +440,11 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $fillType
* @return int
*/
private static function _mapFillType($fillType) {
if (isset(self::$_mapFillType[$fillType]))
private static function _mapFillType($fillType)
{
if (isset(self::$_mapFillType[$fillType])) {
return self::$_mapFillType[$fillType];
}
return 0x00;
}
@ -469,8 +469,9 @@ class PHPExcel_Writer_Excel5_Xf
*/
private function _mapHAlign($hAlign)
{
if (isset(self::$_mapHAlign[$hAlign]))
if (isset(self::$_mapHAlign[$hAlign])) {
return self::$_mapHAlign[$hAlign];
}
return 0;
}
@ -490,9 +491,11 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $vAlign
* @return int
*/
private static function _mapVAlign($vAlign) {
if (isset(self::$_mapVAlign[$vAlign]))
private static function _mapVAlign($vAlign)
{
if (isset(self::$_mapVAlign[$vAlign])) {
return self::$_mapVAlign[$vAlign];
}
return 2;
}
@ -502,7 +505,8 @@ class PHPExcel_Writer_Excel5_Xf
* @param int $textRotation
* @return int
*/
private static function _mapTextRotation($textRotation) {
private static function _mapTextRotation($textRotation)
{
if ($textRotation >= 0) {
return $textRotation;
}
@ -520,12 +524,17 @@ class PHPExcel_Writer_Excel5_Xf
* @param string
* @return int
*/
private static function _mapLocked($locked) {
private static function _mapLocked($locked)
{
switch ($locked) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 1;
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0;
default: return 1;
case PHPExcel_Style_Protection::PROTECTION_INHERIT:
return 1;
case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
return 1;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
return 0;
default:
return 1;
}
}
@ -535,13 +544,17 @@ class PHPExcel_Writer_Excel5_Xf
* @param string
* @return int
*/
private static function _mapHidden($hidden) {
private static function _mapHidden($hidden)
{
switch ($hidden) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 0;
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0;
default: return 0;
case PHPExcel_Style_Protection::PROTECTION_INHERIT:
return 0;
case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
return 1;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
return 0;
default:
return 0;
}
}
}

View File

@ -944,7 +944,7 @@ 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';
}
}
@ -1265,10 +1265,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
}
// General horizontal alignment: Actual horizontal alignment depends on dataType
$sharedStyle = $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() );
$sharedStyle = $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex());
if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL
&& isset($this->_cssStyles['.' . $cell->getDataType()]['text-align']))
{
&& isset($this->_cssStyles['.' . $cell->getDataType()]['text-align'])) {
$cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align'];
}
}
@ -1510,13 +1509,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
// loop through the individual cells in the individual merge
$r = $fr - 1;
while($r++ < $lr) {
while ($r++ < $lr) {
// also, flag this row as a HTML row that is candidate to be omitted
$candidateSpannedRow[$r] = $r;
$c = $fc - 1;
while($c++ < $lc) {
if ( !($c == $fc && $r == $fr) ) {
while ($c++ < $lc) {
if (!($c == $fc && $r == $fr)) {
// not the upper-left cell (should not be written in HTML)
$this->_isSpannedCell[$sheetIndex][$r][$c] = array(
'baseCell' => array($fr, $fc),
@ -1546,15 +1545,15 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
}
// For each of the omitted rows we found above, the affected rowspans should be subtracted by 1
if ( isset($this->_isSpannedRow[$sheetIndex]) ) {
if (isset($this->_isSpannedRow[$sheetIndex])) {
foreach ($this->_isSpannedRow[$sheetIndex] as $rowIndex) {
$adjustedBaseCells = array();
$c = -1;
$e = $countColumns - 1;
while($c++ < $e) {
while ($c++ < $e) {
$baseCell = $this->_isSpannedCell[$sheetIndex][$rowIndex][$c]['baseCell'];
if ( !in_array($baseCell, $adjustedBaseCells) ) {
if (!in_array($baseCell, $adjustedBaseCells)) {
// subtract rowspan by 1
--$this->_isBaseCell[$sheetIndex][ $baseCell[0] ][ $baseCell[1] ]['rowspan'];
$adjustedBaseCells[] = $baseCell;

View File

@ -34,5 +34,4 @@ interface PHPExcel_Writer_IWriter
* @throws PHPExcel_Writer_Exception
*/
public function save($pFilename = null);
}

View File

@ -27,7 +27,7 @@
"ext-xmlwriter": "*"
},
"require-dev": {
"squizlabs/php_codesniffer": "1.*"
"squizlabs/php_codesniffer": "2.*"
},
"recommend": {
"ext-zip": "*",