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: script:
## PHP_CodeSniffer ## 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
- phpunit -c ./unitTests/ - phpunit -c ./unitTests/

View File

@ -3657,6 +3657,301 @@ class PHPExcel_Calculation {
return strcmp($inversedStr1, $inversedStr2); 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) { private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
// Validate the two operands // Validate the two operands

View File

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

View File

@ -176,9 +176,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $minor_unit * @param string $minor_unit
* *
*/ */
public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = 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; $this->_axis_options['axis_labels'] = (string) $axis_labels;
($horizontal_crosses_value !== null) ($horizontal_crosses_value !== null)
@ -201,7 +199,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return string * @return string
*/ */
public function getAxisOptionsProperty($property) { public function getAxisOptionsProperty($property)
{
return $this->_axis_options[$property]; return $this->_axis_options[$property];
} }
@ -211,7 +210,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $orientation * @param string $orientation
* *
*/ */
public function setAxisOrientation($orientation) { public function setAxisOrientation($orientation)
{
$this->orientation = (string) $orientation; $this->orientation = (string) $orientation;
} }
@ -223,7 +223,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $type * @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); $this->_fill_properties = $this->setColorProperties($color, $alpha, $type);
} }
@ -235,7 +236,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $type * @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); $this->_line_properties = $this->setColorProperties($color, $alpha, $type);
} }
@ -246,7 +248,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return string * @return string
*/ */
public function getFillProperty($property) { public function getFillProperty($property)
{
return $this->_fill_properties[$property]; return $this->_fill_properties[$property];
} }
@ -257,7 +260,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return string * @return string
*/ */
public function getLineProperty($property) { public function getLineProperty($property)
{
return $this->_line_properties[$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, 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) {
$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) (!is_null($line_width)) ? $this->_line_style_properties['width'] = $this->getExcelPointsWidth((float) $line_width)
: null; : null;
(!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : null; (!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : null;
@ -304,7 +305,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @return string * @return string
*/ */
public function getLineStyleProperty($elements) { public function getLineStyleProperty($elements)
{
return $this->getArrayElementsValue($this->_line_style_properties, $elements); return $this->getArrayElementsValue($this->_line_style_properties, $elements);
} }
@ -316,7 +318,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @return string * @return string
*/ */
public function getLineStyleArrowWidth($arrow) { public function getLineStyleArrowWidth($arrow)
{
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w'); 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 * @return string
*/ */
public function getLineStyleArrowLength($arrow) { public function getLineStyleArrowLength($arrow)
{
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len'); return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len');
} }

View File

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

View File

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

View File

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

View File

@ -8,7 +8,6 @@
abstract class PHPExcel_Chart_Properties abstract class PHPExcel_Chart_Properties
{ {
const const
EXCEL_COLOR_TYPE_STANDARD = 'prstClr', EXCEL_COLOR_TYPE_STANDARD = 'prstClr',
EXCEL_COLOR_TYPE_SCHEME = 'schemeClr', EXCEL_COLOR_TYPE_SCHEME = 'schemeClr',
@ -114,19 +113,23 @@ abstract class PHPExcel_Chart_Properties
SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22, SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23; SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
protected function getExcelPointsWidth($width) { protected function getExcelPointsWidth($width)
{
return $width * 12700; return $width * 12700;
} }
protected function getExcelPointsAngle($angle) { protected function getExcelPointsAngle($angle)
{
return $angle * 60000; return $angle * 60000;
} }
protected function getTrueAlpha($alpha) { protected function getTrueAlpha($alpha)
{
return (string) 100 - $alpha . '000'; return (string) 100 - $alpha . '000';
} }
protected function setColorProperties($color, $alpha, $type) { protected function setColorProperties($color, $alpha, $type)
{
return array( return array(
'type' => (string) $type, 'type' => (string) $type,
'value' => (string) $color, 'value' => (string) $color,
@ -350,11 +353,8 @@ abstract class PHPExcel_Chart_Properties
foreach ($elements as $keys) { foreach ($elements as $keys) {
$reference = & $reference[$keys]; $reference = & $reference[$keys];
} }
return $reference; return $reference;
} }
return $this; 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 * @return boolean
*/ */
function isSecurityEnabled() public function isSecurityEnabled()
{ {
return $this->_lockRevision || return $this->_lockRevision ||
$this->_lockStructure || $this->_lockStructure ||
@ -92,7 +92,7 @@ class PHPExcel_DocumentSecurity
* *
* @return boolean * @return boolean
*/ */
function getLockRevision() public function getLockRevision()
{ {
return $this->_lockRevision; return $this->_lockRevision;
} }
@ -103,7 +103,7 @@ class PHPExcel_DocumentSecurity
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_DocumentSecurity * @return PHPExcel_DocumentSecurity
*/ */
function setLockRevision($pValue = false) public function setLockRevision($pValue = false)
{ {
$this->_lockRevision = $pValue; $this->_lockRevision = $pValue;
return $this; return $this;
@ -114,7 +114,7 @@ class PHPExcel_DocumentSecurity
* *
* @return boolean * @return boolean
*/ */
function getLockStructure() public function getLockStructure()
{ {
return $this->_lockStructure; return $this->_lockStructure;
} }
@ -125,7 +125,7 @@ class PHPExcel_DocumentSecurity
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_DocumentSecurity * @return PHPExcel_DocumentSecurity
*/ */
function setLockStructure($pValue = false) public function setLockStructure($pValue = false)
{ {
$this->_lockStructure = $pValue; $this->_lockStructure = $pValue;
return $this; return $this;
@ -136,7 +136,7 @@ class PHPExcel_DocumentSecurity
* *
* @return boolean * @return boolean
*/ */
function getLockWindows() public function getLockWindows()
{ {
return $this->_lockWindows; return $this->_lockWindows;
} }
@ -147,7 +147,7 @@ class PHPExcel_DocumentSecurity
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_DocumentSecurity * @return PHPExcel_DocumentSecurity
*/ */
function setLockWindows($pValue = false) public function setLockWindows($pValue = false)
{ {
$this->_lockWindows = $pValue; $this->_lockWindows = $pValue;
return $this; return $this;
@ -158,7 +158,7 @@ class PHPExcel_DocumentSecurity
* *
* @return string * @return string
*/ */
function getRevisionsPassword() public function getRevisionsPassword()
{ {
return $this->_revisionsPassword; return $this->_revisionsPassword;
} }
@ -170,7 +170,7 @@ class PHPExcel_DocumentSecurity
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_DocumentSecurity * @return PHPExcel_DocumentSecurity
*/ */
function setRevisionsPassword($pValue = '', $pAlreadyHashed = false) public function setRevisionsPassword($pValue = '', $pAlreadyHashed = false)
{ {
if (!$pAlreadyHashed) { if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
@ -184,7 +184,7 @@ class PHPExcel_DocumentSecurity
* *
* @return string * @return string
*/ */
function getWorkbookPassword() public function getWorkbookPassword()
{ {
return $this->_workbookPassword; return $this->_workbookPassword;
} }
@ -196,7 +196,7 @@ class PHPExcel_DocumentSecurity
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_DocumentSecurity * @return PHPExcel_DocumentSecurity
*/ */
function setWorkbookPassword($pValue = '', $pAlreadyHashed = false) public function setWorkbookPassword($pValue = '', $pAlreadyHashed = false)
{ {
if (!$pAlreadyHashed) { if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);

View File

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

View File

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

View File

@ -21,6 +21,20 @@
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Shared * @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) * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
@ -38,6 +52,7 @@ class PHPExcel_Shared_Date
* @public * @public
* @var string[] * @var string[]
*/ */
<<<<<<< HEAD
public static $monthNames = array( public static $monthNames = array(
'Jan' => 'January', 'Jan' => 'January',
'Feb' => 'February', 'Feb' => 'February',
@ -52,6 +67,21 @@ class PHPExcel_Shared_Date
'Nov' => 'November', 'Nov' => 'November',
'Dec' => 'December', '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 * Names of the months of the year, indexed by shortname
@ -60,12 +90,20 @@ class PHPExcel_Shared_Date
* @public * @public
* @var string[] * @var string[]
*/ */
<<<<<<< HEAD
public static $numberSuffixes = array( public static $numberSuffixes = array(
'st', 'st',
'nd', 'nd',
'rd', 'rd',
'th', 'th',
); );
=======
public static $_numberSuffixes = array( 'st',
'nd',
'rd',
'th',
);
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/* /*
* Base calendar year to use for calculations * Base calendar year to use for calculations
@ -73,7 +111,11 @@ class PHPExcel_Shared_Date
* @private * @private
* @var int * @var int
*/ */
<<<<<<< HEAD
protected static $excelBaseDate = self::CALENDAR_WINDOWS_1900; protected static $excelBaseDate = self::CALENDAR_WINDOWS_1900;
=======
protected static $_excelBaseDate = self::CALENDAR_WINDOWS_1900;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
* Set the Excel calendar (Windows 1900 or Mac 1904) * 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) * @param integer $baseDate Excel base date (1900 or 1904)
* @return boolean Success or failure * @return boolean Success or failure
*/ */
<<<<<<< HEAD
public static function setExcelCalendar($baseDate) public static function setExcelCalendar($baseDate)
{ {
if (($baseDate == self::CALENDAR_WINDOWS_1900) || if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
@ -90,6 +133,16 @@ class PHPExcel_Shared_Date
} }
return false; 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) * @return integer Excel base date (1900 or 1904)
*/ */
<<<<<<< HEAD
public static function getExcelCalendar() public static function getExcelCalendar()
{ {
return self::$excelBaseDate; 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 * @param string $timezone The timezone for finding the adjustment from UST
* @return long PHP serialized date/time * @return long PHP serialized date/time
*/ */
<<<<<<< HEAD
public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = false, $timezone = null) public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = false, $timezone = null)
{ {
if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) { if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) {
@ -122,11 +182,26 @@ class PHPExcel_Shared_Date
} }
} else { } else {
$myexcelBaseDate = 24107; $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 // Perform conversion
if ($dateValue >= 1) { if ($dateValue >= 1) {
<<<<<<< HEAD
$utcDays = $dateValue - $myexcelBaseDate; $utcDays = $dateValue - $myexcelBaseDate;
=======
$utcDays = $dateValue - $my_excelBaseDate;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$returnValue = round($utcDays * 86400); $returnValue = round($utcDays * 86400);
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) { if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
$returnValue = (integer) $returnValue; $returnValue = (integer) $returnValue;
@ -142,8 +217,14 @@ class PHPExcel_Shared_Date
PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) : PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) :
0; 0;
<<<<<<< HEAD
return $returnValue + $timezoneAdjustment; 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 * @param integer $dateValue Excel date/time value
* @return DateTime PHP date/time object * @return DateTime PHP date/time object
*/ */
<<<<<<< HEAD
public static function ExcelToPHPObject($dateValue = 0) public static function ExcelToPHPObject($dateValue = 0)
{ {
=======
public static function ExcelToPHPObject($dateValue = 0) {
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$dateTime = self::ExcelToPHP($dateValue); $dateTime = self::ExcelToPHP($dateValue);
$days = floor($dateTime / 86400); $days = floor($dateTime / 86400);
$time = round((($dateTime / 86400) - $days) * 86400); $time = round((($dateTime / 86400) - $days) * 86400);
@ -165,7 +250,11 @@ class PHPExcel_Shared_Date
$dateObj->setTime($hours,$minutes,$seconds); $dateObj->setTime($hours,$minutes,$seconds);
return $dateObj; return $dateObj;
<<<<<<< HEAD
} }
=======
} // function ExcelToPHPObject()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -178,11 +267,18 @@ class PHPExcel_Shared_Date
* @return mixed Excel date/time value * @return mixed Excel date/time value
* or boolean FALSE on failure * or boolean FALSE on failure
*/ */
<<<<<<< HEAD
public static function PHPToExcel($dateValue = 0, $adjustToTimezone = false, $timezone = null) public static function PHPToExcel($dateValue = 0, $adjustToTimezone = false, $timezone = null)
{ {
$saveTimeZone = date_default_timezone_get(); $saveTimeZone = date_default_timezone_get();
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
$retValue = false; $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)) { if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
$retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'), $retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'),
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s') $dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
@ -195,7 +291,11 @@ class PHPExcel_Shared_Date
date_default_timezone_set($saveTimeZone); date_default_timezone_set($saveTimeZone);
return $retValue; return $retValue;
<<<<<<< HEAD
} }
=======
} // function PHPToExcel()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -209,13 +309,19 @@ class PHPExcel_Shared_Date
* @param long $seconds * @param long $seconds
* @return long Excel date/time value * @return long Excel date/time value
*/ */
<<<<<<< HEAD
public static function FormattedPHPToExcel($year, $month, $day, $hours = 0, $minutes = 0, $seconds = 0) public static function FormattedPHPToExcel($year, $month, $day, $hours = 0, $minutes = 0, $seconds = 0)
{ {
if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) { 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 // 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 // This affects every date following 28th February 1900
// //
<<<<<<< HEAD
$excel1900isLeapYear = true; $excel1900isLeapYear = true;
if (($year == 1900) && ($month <= 2)) { if (($year == 1900) && ($month <= 2)) {
$excel1900isLeapYear = false; $excel1900isLeapYear = false;
@ -224,6 +330,14 @@ class PHPExcel_Shared_Date
} else { } else {
$myexcelBaseDate = 2416481; $myexcelBaseDate = 2416481;
$excel1900isLeapYear = false; $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 // 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) // 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); $century = substr($year,0,2);
$decade = substr($year,2,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 - $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; $excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;
return (float) $excelDate + $excelTime; return (float) $excelDate + $excelTime;
<<<<<<< HEAD
} }
=======
} // function FormattedPHPToExcel()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -251,14 +373,22 @@ class PHPExcel_Shared_Date
* @param PHPExcel_Cell $pCell * @param PHPExcel_Cell $pCell
* @return boolean * @return boolean
*/ */
<<<<<<< HEAD
public static function isDateTime(PHPExcel_Cell $pCell) public static function isDateTime(PHPExcel_Cell $pCell)
{ {
=======
public static function isDateTime(PHPExcel_Cell $pCell) {
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
return self::isDateTimeFormat( return self::isDateTimeFormat(
$pCell->getWorksheet()->getStyle( $pCell->getWorksheet()->getStyle(
$pCell->getCoordinate() $pCell->getCoordinate()
)->getNumberFormat() )->getNumberFormat()
); );
<<<<<<< HEAD
} }
=======
} // function isDateTime()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -267,10 +397,16 @@ class PHPExcel_Shared_Date
* @param PHPExcel_Style_NumberFormat $pFormat * @param PHPExcel_Style_NumberFormat $pFormat
* @return boolean * @return boolean
*/ */
<<<<<<< HEAD
public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat) public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat)
{ {
return self::isDateTimeFormatCode($pFormat->getFormatCode()); 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'; private static $possibleDateFormatCharacters = 'eymdHs';
@ -281,6 +417,7 @@ class PHPExcel_Shared_Date
* @param string $pFormatCode * @param string $pFormatCode
* @return boolean * @return boolean
*/ */
<<<<<<< HEAD
public static function isDateTimeFormatCode($pFormatCode = '') public static function isDateTimeFormatCode($pFormatCode = '')
{ {
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL)) 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)) if (preg_match('/[0#]E[+-]0/i', $pFormatCode))
// Scientific format // Scientific format
return false; 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 on formatcode
switch ($pFormatCode) { switch ($pFormatCode) {
// Explicitly defined date formats // 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_XLSX16:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17: case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22: case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22:
<<<<<<< HEAD
return true; return true;
} }
@ -342,6 +489,36 @@ class PHPExcel_Shared_Date
// No date... // No date...
return false; 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' * @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 * @return float|FALSE Excel date/time serial value
*/ */
<<<<<<< HEAD
public static function stringToExcel($dateValue = '') public static function stringToExcel($dateValue = '')
{ {
if (strlen($dateValue) < 2) if (strlen($dateValue) < 2)
return false; 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)) 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; 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); $dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue);
if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) { if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) {
<<<<<<< HEAD
return false; return false;
} }
@ -375,6 +561,24 @@ class PHPExcel_Shared_Date
public static function monthStringToNumber($month) 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; $monthIndex = 1;
foreach(self::$monthNames as $shortMonthName => $longMonthName) { foreach(self::$monthNames as $shortMonthName => $longMonthName) {
if (($month === $longMonthName) || ($month === $shortMonthName)) { if (($month === $longMonthName) || ($month === $shortMonthName)) {
@ -385,9 +589,14 @@ class PHPExcel_Shared_Date
return $month; return $month;
} }
<<<<<<< HEAD
public static function dayStringToNumber($day) public static function dayStringToNumber($day)
{ {
$strippedDayValue = (str_replace(self::$numberSuffixes, '', $day)); $strippedDayValue = (str_replace(self::$numberSuffixes, '', $day));
=======
public static function dayStringToNumber($day) {
$strippedDayValue = (str_replace(self::$_numberSuffixes,'',$day));
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
if (is_numeric($strippedDayValue)) { if (is_numeric($strippedDayValue)) {
return $strippedDayValue; return $strippedDayValue;
} }

View File

@ -52,9 +52,9 @@ class PHPExcel_Shared_TimeZone
*/ */
public static function _validateTimeZone($timezone) { public static function _validateTimeZone($timezone) {
if (in_array($timezone, DateTimeZone::listIdentifiers())) { 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) { public static function setTimeZone($timezone) {
if (self::_validateTimezone($timezone)) { if (self::_validateTimezone($timezone)) {
self::$_timezone = $timezone; self::$_timezone = $timezone;
return TRUE; return true;
} }
return FALSE; return false;
} // function setTimezone() } // function setTimezone()
@ -115,7 +115,7 @@ class PHPExcel_Shared_TimeZone
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public static function getTimeZoneAdjustment($timezone, $timestamp) { public static function getTimeZoneAdjustment($timezone, $timestamp) {
if ($timezone !== NULL) { if ($timezone !== null) {
if (!self::_validateTimezone($timezone)) { if (!self::_validateTimezone($timezone)) {
throw new PHPExcel_Exception("Invalid timezone " . $timezone); throw new PHPExcel_Exception("Invalid timezone " . $timezone);
} }
@ -136,5 +136,4 @@ class PHPExcel_Shared_TimeZone
return (count($transitions) > 0) ? $transitions[0]['offset'] : 0; 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 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @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 class PHPExcel_Shared_ZipArchive
{ {
/** constants */ /** constants */
<<<<<<< HEAD
const OVERWRITE = 'OVERWRITE'; const OVERWRITE = 'OVERWRITE';
const CREATE = 'CREATE'; const CREATE = 'CREATE';
=======
const OVERWRITE = 'OVERWRITE';
const CREATE = 'CREATE';
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -92,10 +114,14 @@ class PHPExcel_Shared_ZipArchive
fwrite($handle, $contents); fwrite($handle, $contents);
fclose($handle); fclose($handle);
<<<<<<< HEAD
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"], $res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"],
PCLZIP_OPT_REMOVE_PATH, $this->_tempDir, PCLZIP_OPT_REMOVE_PATH, $this->_tempDir,
PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"] 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) { if ($res == 0) {
throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true)); 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 * @param PHPExcel_Writer_IWriter $pWriter
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null) { public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null)
{
$this->_parentWriter = $pWriter; $this->_parentWriter = $pWriter;
} }
@ -58,7 +59,8 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
* @return PHPExcel_Writer_IWriter * @return PHPExcel_Writer_IWriter
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function getParentWriter() { public function getParentWriter()
{
if (!is_null($this->_parentWriter)) { if (!is_null($this->_parentWriter)) {
return $this->_parentWriter; return $this->_parentWriter;
} else { } else {
@ -72,10 +74,10 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
* @param PHPExcel_Writer_IWriter $pWriter * @param PHPExcel_Writer_IWriter $pWriter
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function __construct(PHPExcel_Writer_IWriter $pWriter = null) { public function __construct(PHPExcel_Writer_IWriter $pWriter = null)
{
if (!is_null($pWriter)) { if (!is_null($pWriter)) {
$this->_parentWriter = $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 * @param PHPExcel $phpExcel PHPExcel object
*/ */
public function __construct(PHPExcel $phpExcel) { public function __construct(PHPExcel $phpExcel)
{
$this->_phpExcel = $phpExcel; $this->_phpExcel = $phpExcel;
$this->_parser = new PHPExcel_Writer_Excel5_Parser(); $this->_parser = new PHPExcel_Writer_Excel5_Parser();
@ -107,13 +108,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* @param string $pFilename * @param string $pFilename
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function save($pFilename = null) { public function save($pFilename = null)
{
// garbage collect // garbage collect
$this->_phpExcel->garbageCollect(); $this->_phpExcel->garbageCollect();
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); $saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); 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(); $this->_colors = array();
// Initialise workbook writer // Initialise workbook writer
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser);
$this->_str_total, $this->_str_unique, $this->_str_table,
$this->_colors, $this->_parser);
// Initialise worksheet writers // Initialise worksheet writers
$countSheets = $this->_phpExcel->getSheetCount(); $countSheets = $this->_phpExcel->getSheetCount();
for ($i = 0; $i < $countSheets; ++$i) { for ($i = 0; $i < $countSheets; ++$i) {
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique, $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->_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. // build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
@ -229,7 +225,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* @throws PHPExcel_Writer_Exception when directory does not exist * @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_Excel5 * @return PHPExcel_Writer_Excel5
*/ */
public function setTempDir($pValue = '') { public function setTempDir($pValue = '')
{
return $this; return $this;
} }
@ -444,8 +441,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
++$sheetCountShapes; ++$sheetCountShapes;
++$totalCountShapes; ++$totalCountShapes;
$spId = $sheetCountShapes $spId = $sheetCountShapes | ($this->_phpExcel->getIndex($sheet) + 1) << 10;
| ($this->_phpExcel->getIndex($sheet) + 1) << 10;
$spIdMax = max($spId, $spIdMax); $spIdMax = max($spId, $spIdMax);
} }
} }
@ -463,13 +459,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
foreach ($this->_phpExcel->getAllsheets() as $sheet) { foreach ($this->_phpExcel->getAllsheets() as $sheet) {
foreach ($sheet->getDrawingCollection() as $drawing) { foreach ($sheet->getDrawingCollection() as $drawing) {
if ($drawing instanceof PHPExcel_Worksheet_Drawing) { if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
$filename = $drawing->getPath(); $filename = $drawing->getPath();
list($imagesx, $imagesy, $imageFormat) = getimagesize($filename); list($imagesx, $imagesy, $imageFormat) = getimagesize($filename);
switch ($imageFormat) { switch ($imageFormat) {
case 1: // GIF, not supported by BIFF8, we convert to PNG case 1: // GIF, not supported by BIFF8, we convert to PNG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
ob_start(); ob_start();
@ -477,17 +471,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$blipData = ob_get_contents(); $blipData = ob_get_contents();
ob_end_clean(); ob_end_clean();
break; break;
case 2: // JPEG case 2: // JPEG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
$blipData = file_get_contents($filename); $blipData = file_get_contents($filename);
break; break;
case 3: // PNG case 3: // PNG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
$blipData = file_get_contents($filename); $blipData = file_get_contents($filename);
break; break;
case 6: // Windows DIB (BMP), we convert to PNG case 6: // Windows DIB (BMP), we convert to PNG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
ob_start(); ob_start();
@ -495,9 +486,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$blipData = ob_get_contents(); $blipData = ob_get_contents();
ob_end_clean(); ob_end_clean();
break; break;
default:
default: continue 2; continue 2;
} }
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $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); $BSE->setBlip($blip);
$bstoreContainer->addBSE($BSE); $bstoreContainer->addBSE($BSE);
} else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) { } else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
switch ($drawing->getRenderingFunction()) { switch ($drawing->getRenderingFunction()) {
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG: case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
$renderingFunction = 'imagejpeg'; $renderingFunction = 'imagejpeg';
break; break;
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF: case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF:
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG: case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG:
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT: case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT:
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
$renderingFunction = 'imagepng'; $renderingFunction = 'imagepng';
break; break;
} }
ob_start(); ob_start();
@ -552,8 +537,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the OLE Part for DocumentSummary Information * Build the OLE Part for DocumentSummary Information
* @return string * @return string
*/ */
private function _writeDocumentSummaryInformation(){ private function _writeDocumentSummaryInformation()
{
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE); $data = pack('v', 0xFFFE);
// offset: 2; size: 2; // offset: 2; size: 2;
@ -753,7 +738,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the OLE Part for Summary Information * Build the OLE Part for Summary Information
* @return string * @return string
*/ */
private function _writeSummaryInformation(){ private function _writeSummaryInformation()
{
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE); $data = pack('v', 0xFFFE);
// offset: 2; size: 2; // offset: 2; size: 2;

View File

@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* @param string $data binary data to append * @param string $data binary data to append
* @access private * @access private
*/ */
function _append($data) private function _append($data)
{ {
if (strlen($data) - 4 > $this->_limit) { if (strlen($data) - 4 > $this->_limit) {
$data = $this->_addContinue($data); $data = $this->_addContinue($data);
@ -169,7 +169,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* 0x0010 Worksheet. * 0x0010 Worksheet.
* @access private * @access private
*/ */
function _storeBof($type) private function _storeBof($type)
{ {
$record = 0x0809; // Record identifier (BIFF5-BIFF8) $record = 0x0809; // Record identifier (BIFF5-BIFF8)
$length = 0x0010; $length = 0x0010;
@ -192,7 +192,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* *
* @access private * @access private
*/ */
function _storeEof() private function _storeEof()
{ {
$record = 0x000A; // Record identifier $record = 0x000A; // Record identifier
$length = 0x0000; // Number of bytes to follow $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 * @return string A very convenient string of continue blocks
* @access private * @access private
*/ */
function _addContinue($data) private function _addContinue($data)
{ {
$limit = $this->_limit; $limit = $this->_limit;
$record = 0x003C; // Record identifier $record = 0x003C; // Record identifier
@ -251,5 +251,4 @@ class PHPExcel_Writer_Excel5_BIFFwriter
return $tmp; return $tmp;
} }
} }

View File

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

View File

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

View File

@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel5_Parser
* *
* @access private * @access private
*/ */
function _initializeHashes() private function _initializeHashes()
{ {
// The Excel ptg indices // The Excel ptg indices
$this->ptg = array( $this->ptg = array(
@ -512,7 +512,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param mixed $token The token to convert. * @param mixed $token The token to convert.
* @return mixed the converted token on success * @return mixed the converted token on success
*/ */
function _convert($token) private function _convert($token)
{ {
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) { if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) {
return $this->_convertString($token); return $this->_convertString($token);
@ -573,7 +573,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private * @access private
* @param mixed $num an integer or double for conversion to its ptg value * @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 // Integer in the range 0..2**16-1
if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) { 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. * @param string $string A string for conversion to its ptg value.
* @return mixed the converted token on success * @return mixed the converted token on success
*/ */
function _convertString($string) private function _convertString($string)
{ {
// chop away beggining and ending quotes // chop away beggining and ending quotes
$string = substr($string, 1, strlen($string) - 2); $string = substr($string, 1, strlen($string) - 2);
@ -613,7 +613,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param integer $num_args The number of arguments the function receives. * @param integer $num_args The number of arguments the function receives.
* @return string The packed ptg for the function * @return string The packed ptg for the function
*/ */
function _convertFunction($token, $num_args) private function _convertFunction($token, $num_args)
{ {
$args = $this->_functions[$token][1]; $args = $this->_functions[$token][1];
// $volatile = $this->_functions[$token][3]; // $volatile = $this->_functions[$token][3];
@ -635,7 +635,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $range An Excel range in the A1:A2 * @param string $range An Excel range in the A1:A2
* @param int $class * @param int $class
*/ */
function _convertRange2d($range, $class=0) private function _convertRange2d($range, $class = 0)
{ {
// TODO: possible class value 0,1,2 check Formula.pm // 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. * @param string $token An Excel range in the Sheet1!A1:A2 format.
* @return mixed The packed ptgArea3d token on success. * @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) // $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 * @param string $cell An Excel cell reference
* @return string The cell in packed() format with the corresponding ptg * @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. // $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 * @param string $cell An Excel cell reference
* @return mixed The packed ptgRef3d token on success. * @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. // $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 * @param string $errorCode The error code for conversion to its ptg value
* @return string The error code ptgErr * @return string The error code ptgErr
*/ */
function _convertError($errorCode) private function _convertError($errorCode)
{ {
switch ($errorCode) { switch ($errorCode) {
case '#NULL!': return pack("C", 0x00); case '#NULL!':
case '#DIV/0!': return pack("C", 0x07); return pack("C", 0x00);
case '#VALUE!': return pack("C", 0x0F); case '#DIV/0!':
case '#REF!': return pack("C", 0x17); return pack("C", 0x07);
case '#NAME?': return pack("C", 0x1D); case '#VALUE!':
case '#NUM!': return pack("C", 0x24); return pack("C", 0x0F);
case '#N/A': return pack("C", 0x2A); 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); return pack("C", 0xFF);
} }
@ -801,7 +808,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $ext_ref The name of the external reference * @param string $ext_ref The name of the external reference
* @return string The reference index in packed() format * @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 leading ' if any.
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' 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 * @param string $ext_ref The name of the external reference
* @return mixed The reference index in packed() format on success * @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 leading ' if any.
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' 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 * @param string $sheet_name Sheet name
* @return integer The sheet index, -1 if the sheet was not found * @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])) { if (!isset($this->_ext_sheets[$sheet_name])) {
return -1; return -1;
@ -925,7 +932,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $name The name of the worksheet being added * @param string $name The name of the worksheet being added
* @param integer $index The index 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; $this->_ext_sheets[$name] = $index;
} }
@ -937,7 +944,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $cell The Excel cell reference to be packed * @param string $cell The Excel cell reference to be packed
* @return array Array containing the row and column in packed() format * @return array Array containing the row and column in packed() format
*/ */
function _cellToPackedRowcol($cell) private function _cellToPackedRowcol($cell)
{ {
$cell = strtoupper($cell); $cell = strtoupper($cell);
list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($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 * @param string $range The Excel range to be packed
* @return array Array containing (row1,col1,row2,col2) in packed() format * @return array Array containing (row1,col1,row2,col2) in packed() format
*/ */
function _rangeToPackedRange($range) private function _rangeToPackedRange($range)
{ {
preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match); preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match);
// return absolute rows if there is a $ in the ref // return absolute rows if there is a $ in the ref
@ -1007,7 +1014,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $cell The Excel cell reference in A1 format. * @param string $cell The Excel cell reference in A1 format.
* @return array * @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 // return absolute column if there is a $ in the ref
@ -1037,7 +1044,7 @@ class PHPExcel_Writer_Excel5_Parser
* *
* @access private * @access private
*/ */
function _advance() private function _advance()
{ {
$i = $this->_current_char; $i = $this->_current_char;
$formula_length = strlen($this->_formula); $formula_length = strlen($this->_formula);
@ -1088,7 +1095,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param mixed $token The token to check. * @param mixed $token The token to check.
* @return mixed The checked token or false on failure * @return mixed The checked token or false on failure
*/ */
function _match($token) private function _match($token)
{ {
switch($token) { switch($token) {
case "+": case "+":
@ -1126,62 +1133,52 @@ class PHPExcel_Writer_Excel5_Parser
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and
!preg_match("/[0-9]/", $this->_lookahead) and !preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.') and ($this->_lookahead != ':') and ($this->_lookahead != '.') and
($this->_lookahead != '!')) ($this->_lookahead != '!')) {
{
return $token; return $token;
} }
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1) // 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 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 !preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.')) ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
{
return $token; return $token;
} }
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1) // 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 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 !preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.')) ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
{
return $token; return $token;
} }
// if it's a range A1:A2 or $A$1:$A$2 // 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 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; 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 // 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 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)) !preg_match("/[0-9]/", $this->_lookahead)) {
{
return $token; 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 // 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 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)) !preg_match("/[0-9]/", $this->_lookahead)) {
{
return $token; return $token;
} }
// If it's a number (check that it's not a sheet name or range) // If it's a number (check that it's not a sheet name or range)
elseif (is_numeric($token) and elseif (is_numeric($token) and
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and (!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
($this->_lookahead != '!') and ($this->_lookahead != ':')) ($this->_lookahead != '!') and ($this->_lookahead != ':')) {
{
return $token; return $token;
} }
// If it's a string (of maximum 255 characters) // 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; return $token;
} }
// If it's an error code // 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; return $token;
} }
// if it's a function call // 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; return $token;
} }
// It's an argument of some description (e.g. a named range), // It's an argument of some description (e.g. a named range),
@ -1201,7 +1198,7 @@ class PHPExcel_Writer_Excel5_Parser
* sign (=). * sign (=).
* @return mixed true on success * @return mixed true on success
*/ */
function parse($formula) public function parse($formula)
{ {
$this->_current_char = 0; $this->_current_char = 0;
$this->_formula = $formula; $this->_formula = $formula;
@ -1218,7 +1215,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private * @access private
* @return mixed The parsed ptg'd tree on success * @return mixed The parsed ptg'd tree on success
*/ */
function _condition() private function _condition()
{ {
$result = $this->_expression(); $result = $this->_expression();
if ($this->_current_token == "<") { if ($this->_current_token == "<") {
@ -1264,7 +1261,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private * @access private
* @return mixed The parsed ptg'd tree on success * @return mixed The parsed ptg'd tree on success
*/ */
function _expression() private function _expression()
{ {
// If it's a string return a string node // If it's a string return a string node
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) { if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) {
@ -1323,7 +1320,7 @@ class PHPExcel_Writer_Excel5_Parser
* @see _fact() * @see _fact()
* @return array The parsed ptg'd tree * @return array The parsed ptg'd tree
*/ */
function _parenthesizedExpression() private function _parenthesizedExpression()
{ {
$result = $this->_createTree('ptgParen', $this->_expression(), ''); $result = $this->_createTree('ptgParen', $this->_expression(), '');
return $result; return $result;
@ -1336,7 +1333,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private * @access private
* @return mixed The parsed ptg'd tree on success * @return mixed The parsed ptg'd tree on success
*/ */
function _term() private function _term()
{ {
$result = $this->_fact(); $result = $this->_fact();
while (($this->_current_token == "*") or while (($this->_current_token == "*") or
@ -1366,7 +1363,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private * @access private
* @return mixed The parsed ptg'd tree on success * @return mixed The parsed ptg'd tree on success
*/ */
function _fact() private function _fact()
{ {
if ($this->_current_token == "(") { if ($this->_current_token == "(") {
$this->_advance(); // eat the "(" $this->_advance(); // eat the "("
@ -1455,7 +1452,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private * @access private
* @return mixed The parsed ptg'd tree on success * @return mixed The parsed ptg'd tree on success
*/ */
function _func() private function _func()
{ {
$num_args = 0; // number of arguments received $num_args = 0; // number of arguments received
$function = strtoupper($this->_current_token); $function = strtoupper($this->_current_token);
@ -1505,7 +1502,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param mixed $right The right array (sub-tree) or a final node. * @param mixed $right The right array (sub-tree) or a final node.
* @return array A tree * @return array A tree
*/ */
function _createTree($value, $left, $right) private function _createTree($value, $left, $right)
{ {
return array('value' => $value, 'left' => $left, 'right' => $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. * @param array $tree The optional tree to convert.
* @return string The tree in reverse polish notation * @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 $polish = ""; // the string we are going to return
if (empty($tree)) { // If it's the first call use _parse_tree if (empty($tree)) { // If it's the first call use _parse_tree
@ -1579,5 +1576,4 @@ class PHPExcel_Writer_Excel5_Parser
$polish .= $converted_tree; $polish .= $converted_tree;
return $polish; return $polish;
} }
} }

View File

@ -200,9 +200,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
* @param array &$colors Colour Table * @param array &$colors Colour Table
* @param mixed $parser The formula parser created for the Workbook * @param mixed $parser The formula parser created for the Workbook
*/ */
public function __construct(PHPExcel $phpExcel = null, public function __construct(PHPExcel $phpExcel = null, &$str_total, &$str_unique, &$str_table, &$colors, $parser)
&$str_total, &$str_unique, &$str_table, &$colors,
$parser )
{ {
// It needs to call its parent's constructor explicitly // It needs to call its parent's constructor explicitly
parent::__construct(); parent::__construct();
@ -324,7 +322,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $rgb E.g. 'FF00AA' * @param string $rgb E.g. 'FF00AA'
* @return int Color index * @return int Color index
*/ */
private function _addColor($rgb) { private function _addColor($rgb)
{
if (!isset($this->_colors[$rgb])) { if (!isset($this->_colors[$rgb])) {
if (count($this->_colors) < 57) { if (count($this->_colors) < 57) {
// then we add a custom color altering the palette // 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 * @access private
*/ */
function _setPaletteXl97() private function _setPaletteXl97()
{ {
$this->_palette = array( $this->_palette = array(
0x08 => array(0x00, 0x00, 0x00, 0x00), 0x08 => array(0x00, 0x00, 0x00, 0x00),
@ -477,7 +476,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
* *
* @access private * @access private
*/ */
function _calcSheetOffsets() private function _calcSheetOffsets()
{ {
$boundsheet_length = 10; // fixed length for a BOUNDSHEET record $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 // (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) { } else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
// Columns to repeat // Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) { if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft(); $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
@ -658,7 +656,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// Loop named ranges // Loop named ranges
$namedRanges = $this->_phpExcel->getNamedRanges(); $namedRanges = $this->_phpExcel->getNamedRanges();
foreach ($namedRanges as $namedRange) { foreach ($namedRanges as $namedRange) {
// Create absolute coordinate // Create absolute coordinate
$range = PHPExcel_Cell::splitRange($namedRange->getRange()); $range = PHPExcel_Cell::splitRange($namedRange->getRange());
for ($i = 0; $i < count($range); $i++) { for ($i = 0; $i < count($range); $i++) {
@ -721,7 +718,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// (exclusive) either repeatColumns or repeatRows // (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) { } else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
// Columns to repeat // Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) { if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft(); $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
@ -842,7 +838,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
* @param boolean $isHidden * @param boolean $isHidden
* @return string Complete binary record data * @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; $record = 0x0018;
// option flags // option flags
@ -854,7 +851,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$rangeBounds[0][1] - 1, $rangeBounds[0][1] - 1,
$rangeBounds[1][1] - 1, $rangeBounds[1][1] - 1,
$rangeBounds[0][0] - 1, $rangeBounds[0][0] - 1,
$rangeBounds[1][0] - 1); $rangeBounds[1][0] - 1
);
// size of the formula (in bytes) // size of the formula (in bytes)
$sz = strlen($extra); $sz = strlen($extra);
@ -909,10 +907,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet $itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);
$data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, $data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio);
$grbit,
$itabCur, $itabFirst,
$ctabsel, $wTabRatio);
$this->_append($header . $data); $this->_append($header . $data);
} }
@ -929,10 +924,18 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// sheet state // sheet state
switch ($sheet->getSheetState()) { switch ($sheet->getSheetState()) {
case PHPExcel_Worksheet::SHEETSTATE_VISIBLE: $ss = 0x00; break; case PHPExcel_Worksheet::SHEETSTATE_VISIBLE:
case PHPExcel_Worksheet::SHEETSTATE_HIDDEN: $ss = 0x01; break; $ss = 0x00;
case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN: $ss = 0x02; break; break;
default: $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 // 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 // loop through all (unique) strings in shared strings table
foreach (array_keys($this->_str_table) as $string) { foreach (array_keys($this->_str_table) as $string) {
// here $string is a BIFF8 encoded string // here $string is a BIFF8 encoded string
// length = character count // length = character count
@ -1320,7 +1322,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$finished = false; $finished = false;
while ($finished === false) { while ($finished === false) {
// normally, there will be only one cycle, but if string cannot immediately be written as is // 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 // 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 // may be need for even more cycles
@ -1422,7 +1423,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);
return $this->writeData($header . $data); return $this->writeData($header . $data);
} else { } else {
return ''; 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 * @return string The XF record
*/ */
function writeXf() public function writeXf()
{ {
// Set the type of the XF record and some of the attributes. // Set the type of the XF record and some of the attributes.
if ($this->_isStyleXf) { if ($this->_isStyleXf) {
@ -256,11 +256,7 @@ class PHPExcel_Writer_Excel5_Xf
$biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4; $biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
$data = pack("vvvC", $ifnt, $ifmt, $style, $align); $data = pack("vvvC", $ifnt, $ifmt, $style, $align);
$data .= pack("CCC" $data .= pack("CCC", self::_mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
, self::_mapTextRotation($this->_style->getAlignment()->getTextRotation())
, $biff8_options
, $used_attrib
);
$data .= pack("VVv", $border1, $border2, $icv); $data .= pack("VVv", $border1, $border2, $icv);
return($header . $data); return($header . $data);
@ -282,7 +278,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setBottomColor($colorIndex) public function setBottomColor($colorIndex)
{ {
$this->_bottom_color = $colorIndex; $this->_bottom_color = $colorIndex;
} }
@ -293,7 +289,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setTopColor($colorIndex) public function setTopColor($colorIndex)
{ {
$this->_top_color = $colorIndex; $this->_top_color = $colorIndex;
} }
@ -304,7 +300,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setLeftColor($colorIndex) public function setLeftColor($colorIndex)
{ {
$this->_left_color = $colorIndex; $this->_left_color = $colorIndex;
} }
@ -315,7 +311,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setRightColor($colorIndex) public function setRightColor($colorIndex)
{ {
$this->_right_color = $colorIndex; $this->_right_color = $colorIndex;
} }
@ -326,7 +322,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setDiagColor($colorIndex) public function setDiagColor($colorIndex)
{ {
$this->_diag_color = $colorIndex; $this->_diag_color = $colorIndex;
} }
@ -338,7 +334,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setFgColor($colorIndex) public function setFgColor($colorIndex)
{ {
$this->_fg_color = $colorIndex; $this->_fg_color = $colorIndex;
} }
@ -349,7 +345,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setBgColor($colorIndex) public function setBgColor($colorIndex)
{ {
$this->_bg_color = $colorIndex; $this->_bg_color = $colorIndex;
} }
@ -361,7 +357,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param integer $numberFormatIndex Index to format record * @param integer $numberFormatIndex Index to format record
*/ */
function setNumberFormatIndex($numberFormatIndex) public function setNumberFormatIndex($numberFormatIndex)
{ {
$this->_numberFormatIndex = $numberFormatIndex; $this->_numberFormatIndex = $numberFormatIndex;
} }
@ -403,9 +399,11 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $borderStyle * @param string $borderStyle
* @return int * @return int
*/ */
private static function _mapBorderStyle($borderStyle) { private static function _mapBorderStyle($borderStyle)
if (isset(self::$_mapBorderStyle[$borderStyle])) {
if (isset(self::$_mapBorderStyle[$borderStyle])) {
return self::$_mapBorderStyle[$borderStyle]; return self::$_mapBorderStyle[$borderStyle];
}
return 0x00; return 0x00;
} }
@ -442,9 +440,11 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $fillType * @param string $fillType
* @return int * @return int
*/ */
private static function _mapFillType($fillType) { private static function _mapFillType($fillType)
if (isset(self::$_mapFillType[$fillType])) {
if (isset(self::$_mapFillType[$fillType])) {
return self::$_mapFillType[$fillType]; return self::$_mapFillType[$fillType];
}
return 0x00; return 0x00;
} }
@ -469,8 +469,9 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
private function _mapHAlign($hAlign) private function _mapHAlign($hAlign)
{ {
if (isset(self::$_mapHAlign[$hAlign])) if (isset(self::$_mapHAlign[$hAlign])) {
return self::$_mapHAlign[$hAlign]; return self::$_mapHAlign[$hAlign];
}
return 0; return 0;
} }
@ -490,9 +491,11 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $vAlign * @param string $vAlign
* @return int * @return int
*/ */
private static function _mapVAlign($vAlign) { private static function _mapVAlign($vAlign)
if (isset(self::$_mapVAlign[$vAlign])) {
if (isset(self::$_mapVAlign[$vAlign])) {
return self::$_mapVAlign[$vAlign]; return self::$_mapVAlign[$vAlign];
}
return 2; return 2;
} }
@ -502,7 +505,8 @@ class PHPExcel_Writer_Excel5_Xf
* @param int $textRotation * @param int $textRotation
* @return int * @return int
*/ */
private static function _mapTextRotation($textRotation) { private static function _mapTextRotation($textRotation)
{
if ($textRotation >= 0) { if ($textRotation >= 0) {
return $textRotation; return $textRotation;
} }
@ -520,12 +524,17 @@ class PHPExcel_Writer_Excel5_Xf
* @param string * @param string
* @return int * @return int
*/ */
private static function _mapLocked($locked) { private static function _mapLocked($locked)
{
switch ($locked) { switch ($locked) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 1; case PHPExcel_Style_Protection::PROTECTION_INHERIT:
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1; return 1;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0; case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
default: return 1; return 1;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
return 0;
default:
return 1;
} }
} }
@ -535,13 +544,17 @@ class PHPExcel_Writer_Excel5_Xf
* @param string * @param string
* @return int * @return int
*/ */
private static function _mapHidden($hidden) { private static function _mapHidden($hidden)
{
switch ($hidden) { switch ($hidden) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 0; case PHPExcel_Style_Protection::PROTECTION_INHERIT:
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1; return 0;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0; case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
default: return 0; return 1;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
return 0;
default:
return 0;
} }
} }
} }

View File

@ -1267,8 +1267,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
// General horizontal alignment: Actual horizontal alignment depends on dataType // 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 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']; $cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align'];
} }
} }

View File

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

View File

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