Merge branch 'psr2' into develop

This commit is contained in:
MarkBaker 2015-05-18 18:57:39 +01:00
commit f94dcb9852
119 changed files with 16343 additions and 15205 deletions

File diff suppressed because it is too large Load Diff

View File

@ -126,7 +126,7 @@ class PHPExcel_Calculation_Database
$k = array_search($criteriaName, $fieldNames); $k = array_search($criteriaName, $fieldNames);
if (isset($dataValues[$k])) { if (isset($dataValues[$k])) {
$dataValue = $dataValues[$k]; $dataValue = $dataValues[$k];
$dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::_wrapResult(strtoupper($dataValue)) : $dataValue; $dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::wrapResult(strtoupper($dataValue)) : $dataValue;
$testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList); $testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList);
} }
} }

View File

@ -323,7 +323,7 @@ class PHPExcel_Calculation_Functions
} }
if (!in_array($condition{0}, array('>', '<', '='))) { if (!in_array($condition{0}, array('>', '<', '='))) {
if (!is_numeric($condition)) { if (!is_numeric($condition)) {
$condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); $condition = PHPExcel_Calculation::wrapResult(strtoupper($condition));
} }
return '=' . $condition; return '=' . $condition;
} else { } else {
@ -332,7 +332,7 @@ class PHPExcel_Calculation_Functions
if (!is_numeric($operand)) { if (!is_numeric($operand)) {
$operand = str_replace('"', '""', $operand); $operand = str_replace('"', '""', $operand);
$operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand)); $operand = PHPExcel_Calculation::wrapResult(strtoupper($operand));
} }
return $operator.$operand; return $operator.$operand;

View File

@ -1206,7 +1206,7 @@ class PHPExcel_Calculation_MathTrig
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = str_replace('"', '""', $arg); $arg = str_replace('"', '""', $arg);
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;

View File

@ -877,7 +877,7 @@ class PHPExcel_Calculation_Statistical
$aCount = 0; $aCount = 0;
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
@ -1298,7 +1298,7 @@ class PHPExcel_Calculation_Statistical
// Loop through arguments // Loop through arguments
foreach ($aArgs as $arg) { foreach ($aArgs as $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
@ -2290,7 +2290,7 @@ class PHPExcel_Calculation_Statistical
// Loop through arguments // Loop through arguments
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
@ -2449,7 +2449,7 @@ class PHPExcel_Calculation_Statistical
// Loop through arguments // Loop through arguments
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {

View File

@ -27,7 +27,6 @@
*/ */
class PHPExcel_Cell class PHPExcel_Cell
{ {
/** /**
* Default range variable constant * Default range variable constant
* *
@ -227,6 +226,7 @@ class PHPExcel_Cell
break; break;
case PHPExcel_Cell_DataType::TYPE_STRING2: case PHPExcel_Cell_DataType::TYPE_STRING2:
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING; $pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
// no break
case PHPExcel_Cell_DataType::TYPE_STRING: case PHPExcel_Cell_DataType::TYPE_STRING:
// Synonym for string // Synonym for string
case PHPExcel_Cell_DataType::TYPE_INLINE: case PHPExcel_Cell_DataType::TYPE_INLINE:

View File

@ -32,98 +32,98 @@ class PHPExcel_Chart
* *
* @var string * @var string
*/ */
private $_name = ''; private $name = '';
/** /**
* Worksheet * Worksheet
* *
* @var PHPExcel_Worksheet * @var PHPExcel_Worksheet
*/ */
private $_worksheet = null; private $worksheet;
/** /**
* Chart Title * Chart Title
* *
* @var PHPExcel_Chart_Title * @var PHPExcel_Chart_Title
*/ */
private $_title = null; private $title;
/** /**
* Chart Legend * Chart Legend
* *
* @var PHPExcel_Chart_Legend * @var PHPExcel_Chart_Legend
*/ */
private $_legend = null; private $legend;
/** /**
* X-Axis Label * X-Axis Label
* *
* @var PHPExcel_Chart_Title * @var PHPExcel_Chart_Title
*/ */
private $_xAxisLabel = null; private $xAxisLabel;
/** /**
* Y-Axis Label * Y-Axis Label
* *
* @var PHPExcel_Chart_Title * @var PHPExcel_Chart_Title
*/ */
private $_yAxisLabel = null; private $yAxisLabel;
/** /**
* Chart Plot Area * Chart Plot Area
* *
* @var PHPExcel_Chart_PlotArea * @var PHPExcel_Chart_PlotArea
*/ */
private $_plotArea = null; private $plotArea;
/** /**
* Plot Visible Only * Plot Visible Only
* *
* @var boolean * @var boolean
*/ */
private $_plotVisibleOnly = true; private $plotVisibleOnly = true;
/** /**
* Display Blanks as * Display Blanks as
* *
* @var string * @var string
*/ */
private $_displayBlanksAs = '0'; private $displayBlanksAs = '0';
/** /**
* Chart Asix Y as * Chart Asix Y as
* *
* @var PHPExcel_Chart_Axis * @var PHPExcel_Chart_Axis
*/ */
private $_yAxis = null; private $yAxis;
/** /**
* Chart Asix X as * Chart Asix X as
* *
* @var PHPExcel_Chart_Axis * @var PHPExcel_Chart_Axis
*/ */
private $_xAxis = null; private $xAxis;
/** /**
* Chart Major Gridlines as * Chart Major Gridlines as
* *
* @var PHPExcel_Chart_GridLines * @var PHPExcel_Chart_GridLines
*/ */
private $_majorGridlines = null; private $majorGridlines;
/** /**
* Chart Minor Gridlines as * Chart Minor Gridlines as
* *
* @var PHPExcel_Chart_GridLines * @var PHPExcel_Chart_GridLines
*/ */
private $_minorGridlines = null; private $minorGridlines;
/** /**
* Top-Left Cell Position * Top-Left Cell Position
* *
* @var string * @var string
*/ */
private $_topLeftCellRef = 'A1'; private $topLeftCellRef = 'A1';
/** /**
@ -131,7 +131,7 @@ class PHPExcel_Chart
* *
* @var integer * @var integer
*/ */
private $_topLeftXOffset = 0; private $topLeftXOffset = 0;
/** /**
@ -139,7 +139,7 @@ class PHPExcel_Chart
* *
* @var integer * @var integer
*/ */
private $_topLeftYOffset = 0; private $topLeftYOffset = 0;
/** /**
@ -147,7 +147,7 @@ class PHPExcel_Chart
* *
* @var string * @var string
*/ */
private $_bottomRightCellRef = 'A1'; private $bottomRightCellRef = 'A1';
/** /**
@ -155,7 +155,7 @@ class PHPExcel_Chart
* *
* @var integer * @var integer
*/ */
private $_bottomRightXOffset = 10; private $bottomRightXOffset = 10;
/** /**
@ -163,7 +163,7 @@ class PHPExcel_Chart
* *
* @var integer * @var integer
*/ */
private $_bottomRightYOffset = 10; private $bottomRightYOffset = 10;
/** /**
@ -171,18 +171,18 @@ class PHPExcel_Chart
*/ */
public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null) public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null)
{ {
$this->_name = $name; $this->name = $name;
$this->_title = $title; $this->title = $title;
$this->_legend = $legend; $this->legend = $legend;
$this->_xAxisLabel = $xAxisLabel; $this->xAxisLabel = $xAxisLabel;
$this->_yAxisLabel = $yAxisLabel; $this->yAxisLabel = $yAxisLabel;
$this->_plotArea = $plotArea; $this->plotArea = $plotArea;
$this->_plotVisibleOnly = $plotVisibleOnly; $this->plotVisibleOnly = $plotVisibleOnly;
$this->_displayBlanksAs = $displayBlanksAs; $this->displayBlanksAs = $displayBlanksAs;
$this->_xAxis = $xAxis; $this->xAxis = $xAxis;
$this->_yAxis = $yAxis; $this->yAxis = $yAxis;
$this->_majorGridlines = $majorGridlines; $this->majorGridlines = $majorGridlines;
$this->_minorGridlines = $minorGridlines; $this->minorGridlines = $minorGridlines;
} }
/** /**
@ -192,7 +192,7 @@ class PHPExcel_Chart
*/ */
public function getName() public function getName()
{ {
return $this->_name; return $this->name;
} }
/** /**
@ -202,7 +202,7 @@ class PHPExcel_Chart
*/ */
public function getWorksheet() public function getWorksheet()
{ {
return $this->_worksheet; return $this->worksheet;
} }
/** /**
@ -214,7 +214,7 @@ class PHPExcel_Chart
*/ */
public function setWorksheet(PHPExcel_Worksheet $pValue = null) public function setWorksheet(PHPExcel_Worksheet $pValue = null)
{ {
$this->_worksheet = $pValue; $this->worksheet = $pValue;
return $this; return $this;
} }
@ -226,7 +226,7 @@ class PHPExcel_Chart
*/ */
public function getTitle() public function getTitle()
{ {
return $this->_title; return $this->title;
} }
/** /**
@ -237,7 +237,7 @@ class PHPExcel_Chart
*/ */
public function setTitle(PHPExcel_Chart_Title $title) public function setTitle(PHPExcel_Chart_Title $title)
{ {
$this->_title = $title; $this->title = $title;
return $this; return $this;
} }
@ -249,7 +249,7 @@ class PHPExcel_Chart
*/ */
public function getLegend() public function getLegend()
{ {
return $this->_legend; return $this->legend;
} }
/** /**
@ -260,7 +260,7 @@ class PHPExcel_Chart
*/ */
public function setLegend(PHPExcel_Chart_Legend $legend) public function setLegend(PHPExcel_Chart_Legend $legend)
{ {
$this->_legend = $legend; $this->legend = $legend;
return $this; return $this;
} }
@ -272,7 +272,7 @@ class PHPExcel_Chart
*/ */
public function getXAxisLabel() public function getXAxisLabel()
{ {
return $this->_xAxisLabel; return $this->xAxisLabel;
} }
/** /**
@ -283,7 +283,7 @@ class PHPExcel_Chart
*/ */
public function setXAxisLabel(PHPExcel_Chart_Title $label) public function setXAxisLabel(PHPExcel_Chart_Title $label)
{ {
$this->_xAxisLabel = $label; $this->xAxisLabel = $label;
return $this; return $this;
} }
@ -295,7 +295,7 @@ class PHPExcel_Chart
*/ */
public function getYAxisLabel() public function getYAxisLabel()
{ {
return $this->_yAxisLabel; return $this->yAxisLabel;
} }
/** /**
@ -306,7 +306,7 @@ class PHPExcel_Chart
*/ */
public function setYAxisLabel(PHPExcel_Chart_Title $label) public function setYAxisLabel(PHPExcel_Chart_Title $label)
{ {
$this->_yAxisLabel = $label; $this->yAxisLabel = $label;
return $this; return $this;
} }
@ -318,7 +318,7 @@ class PHPExcel_Chart
*/ */
public function getPlotArea() public function getPlotArea()
{ {
return $this->_plotArea; return $this->plotArea;
} }
/** /**
@ -328,7 +328,7 @@ class PHPExcel_Chart
*/ */
public function getPlotVisibleOnly() public function getPlotVisibleOnly()
{ {
return $this->_plotVisibleOnly; return $this->plotVisibleOnly;
} }
/** /**
@ -339,7 +339,7 @@ class PHPExcel_Chart
*/ */
public function setPlotVisibleOnly($plotVisibleOnly = true) public function setPlotVisibleOnly($plotVisibleOnly = true)
{ {
$this->_plotVisibleOnly = $plotVisibleOnly; $this->plotVisibleOnly = $plotVisibleOnly;
return $this; return $this;
} }
@ -351,7 +351,7 @@ class PHPExcel_Chart
*/ */
public function getDisplayBlanksAs() public function getDisplayBlanksAs()
{ {
return $this->_displayBlanksAs; return $this->displayBlanksAs;
} }
/** /**
@ -362,7 +362,7 @@ class PHPExcel_Chart
*/ */
public function setDisplayBlanksAs($displayBlanksAs = '0') public function setDisplayBlanksAs($displayBlanksAs = '0')
{ {
$this->_displayBlanksAs = $displayBlanksAs; $this->displayBlanksAs = $displayBlanksAs;
} }
@ -373,8 +373,8 @@ class PHPExcel_Chart
*/ */
public function getChartAxisY() public function getChartAxisY()
{ {
if ($this->_yAxis !== null) { if ($this->yAxis !== null) {
return $this->_yAxis; return $this->yAxis;
} }
return new PHPExcel_Chart_Axis(); return new PHPExcel_Chart_Axis();
@ -387,8 +387,8 @@ class PHPExcel_Chart
*/ */
public function getChartAxisX() public function getChartAxisX()
{ {
if ($this->_xAxis !== null) { if ($this->xAxis !== null) {
return $this->_xAxis; return $this->xAxis;
} }
return new PHPExcel_Chart_Axis(); return new PHPExcel_Chart_Axis();
@ -401,8 +401,8 @@ class PHPExcel_Chart
*/ */
public function getMajorGridlines() public function getMajorGridlines()
{ {
if ($this->_majorGridlines !== null) { if ($this->majorGridlines !== null) {
return $this->_majorGridlines; return $this->majorGridlines;
} }
return new PHPExcel_Chart_GridLines(); return new PHPExcel_Chart_GridLines();
@ -415,8 +415,8 @@ class PHPExcel_Chart
*/ */
public function getMinorGridlines() public function getMinorGridlines()
{ {
if ($this->_minorGridlines !== null) { if ($this->minorGridlines !== null) {
return $this->_minorGridlines; return $this->minorGridlines;
} }
return new PHPExcel_Chart_GridLines(); return new PHPExcel_Chart_GridLines();
@ -433,7 +433,7 @@ class PHPExcel_Chart
*/ */
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null) public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
{ {
$this->_topLeftCellRef = $cell; $this->topLeftCellRef = $cell;
if (!is_null($xOffset)) { if (!is_null($xOffset)) {
$this->setTopLeftXOffset($xOffset); $this->setTopLeftXOffset($xOffset);
} }
@ -452,9 +452,9 @@ class PHPExcel_Chart
public function getTopLeftPosition() public function getTopLeftPosition()
{ {
return array( return array(
'cell' => $this->_topLeftCellRef, 'cell' => $this->topLeftCellRef,
'xOffset' => $this->_topLeftXOffset, 'xOffset' => $this->topLeftXOffset,
'yOffset' => $this->_topLeftYOffset 'yOffset' => $this->topLeftYOffset
); );
} }
@ -465,7 +465,7 @@ class PHPExcel_Chart
*/ */
public function getTopLeftCell() public function getTopLeftCell()
{ {
return $this->_topLeftCellRef; return $this->topLeftCellRef;
} }
/** /**
@ -476,7 +476,7 @@ class PHPExcel_Chart
*/ */
public function setTopLeftCell($cell) public function setTopLeftCell($cell)
{ {
$this->_topLeftCellRef = $cell; $this->topLeftCellRef = $cell;
return $this; return $this;
} }
@ -508,33 +508,33 @@ class PHPExcel_Chart
public function getTopLeftOffset() public function getTopLeftOffset()
{ {
return array( return array(
'X' => $this->_topLeftXOffset, 'X' => $this->topLeftXOffset,
'Y' => $this->_topLeftYOffset 'Y' => $this->topLeftYOffset
); );
} }
public function setTopLeftXOffset($xOffset) public function setTopLeftXOffset($xOffset)
{ {
$this->_topLeftXOffset = $xOffset; $this->topLeftXOffset = $xOffset;
return $this; return $this;
} }
public function getTopLeftXOffset() public function getTopLeftXOffset()
{ {
return $this->_topLeftXOffset; return $this->topLeftXOffset;
} }
public function setTopLeftYOffset($yOffset) public function setTopLeftYOffset($yOffset)
{ {
$this->_topLeftYOffset = $yOffset; $this->topLeftYOffset = $yOffset;
return $this; return $this;
} }
public function getTopLeftYOffset() public function getTopLeftYOffset()
{ {
return $this->_topLeftYOffset; return $this->topLeftYOffset;
} }
/** /**
@ -547,7 +547,7 @@ class PHPExcel_Chart
*/ */
public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null) public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null)
{ {
$this->_bottomRightCellRef = $cell; $this->bottomRightCellRef = $cell;
if (!is_null($xOffset)) { if (!is_null($xOffset)) {
$this->setBottomRightXOffset($xOffset); $this->setBottomRightXOffset($xOffset);
} }
@ -566,15 +566,15 @@ class PHPExcel_Chart
public function getBottomRightPosition() public function getBottomRightPosition()
{ {
return array( return array(
'cell' => $this->_bottomRightCellRef, 'cell' => $this->bottomRightCellRef,
'xOffset' => $this->_bottomRightXOffset, 'xOffset' => $this->bottomRightXOffset,
'yOffset' => $this->_bottomRightYOffset 'yOffset' => $this->bottomRightYOffset
); );
} }
public function setBottomRightCell($cell) public function setBottomRightCell($cell)
{ {
$this->_bottomRightCellRef = $cell; $this->bottomRightCellRef = $cell;
return $this; return $this;
} }
@ -586,7 +586,7 @@ class PHPExcel_Chart
*/ */
public function getBottomRightCell() public function getBottomRightCell()
{ {
return $this->_bottomRightCellRef; return $this->bottomRightCellRef;
} }
/** /**
@ -616,40 +616,40 @@ class PHPExcel_Chart
public function getBottomRightOffset() public function getBottomRightOffset()
{ {
return array( return array(
'X' => $this->_bottomRightXOffset, 'X' => $this->bottomRightXOffset,
'Y' => $this->_bottomRightYOffset 'Y' => $this->bottomRightYOffset
); );
} }
public function setBottomRightXOffset($xOffset) public function setBottomRightXOffset($xOffset)
{ {
$this->_bottomRightXOffset = $xOffset; $this->bottomRightXOffset = $xOffset;
return $this; return $this;
} }
public function getBottomRightXOffset() public function getBottomRightXOffset()
{ {
return $this->_bottomRightXOffset; return $this->bottomRightXOffset;
} }
public function setBottomRightYOffset($yOffset) public function setBottomRightYOffset($yOffset)
{ {
$this->_bottomRightYOffset = $yOffset; $this->bottomRightYOffset = $yOffset;
return $this; return $this;
} }
public function getBottomRightYOffset() public function getBottomRightYOffset()
{ {
return $this->_bottomRightYOffset; return $this->bottomRightYOffset;
} }
public function refresh() public function refresh()
{ {
if ($this->_worksheet !== null) { if ($this->worksheet !== null) {
$this->_plotArea->refresh($this->_worksheet); $this->plotArea->refresh($this->worksheet);
} }
} }

View File

@ -288,7 +288,7 @@ class PHPExcel_Chart_DataSeriesValues
{ {
if ($this->dataSource !== null) { if ($this->dataSource !== null) {
$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent()); $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
$newDataValues = PHPExcel_Calculation::_unwrapResult( $newDataValues = PHPExcel_Calculation::unwrapResult(
$calcEngine->_calculateFormulaValue( $calcEngine->_calculateFormulaValue(
'='.$this->dataSource, '='.$this->dataSource,
null, null,

View File

@ -32,63 +32,63 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @var string * @var string
*/ */
private $_author; private $author;
/** /**
* Rich text comment * Rich text comment
* *
* @var PHPExcel_RichText * @var PHPExcel_RichText
*/ */
private $_text; private $text;
/** /**
* Comment width (CSS style, i.e. XXpx or YYpt) * Comment width (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_width = '96pt'; private $width = '96pt';
/** /**
* Left margin (CSS style, i.e. XXpx or YYpt) * Left margin (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_marginLeft = '59.25pt'; private $marginLeft = '59.25pt';
/** /**
* Top margin (CSS style, i.e. XXpx or YYpt) * Top margin (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_marginTop = '1.5pt'; private $marginTop = '1.5pt';
/** /**
* Visible * Visible
* *
* @var boolean * @var boolean
*/ */
private $_visible = false; private $visible = false;
/** /**
* Comment height (CSS style, i.e. XXpx or YYpt) * Comment height (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_height = '55.5pt'; private $height = '55.5pt';
/** /**
* Comment fill color * Comment fill color
* *
* @var PHPExcel_Style_Color * @var PHPExcel_Style_Color
*/ */
private $_fillColor; private $fillColor;
/** /**
* Alignment * Alignment
* *
* @var string * @var string
*/ */
private $_alignment; private $alignment;
/** /**
* Create a new PHPExcel_Comment * Create a new PHPExcel_Comment
@ -98,10 +98,10 @@ class PHPExcel_Comment implements PHPExcel_IComparable
public function __construct() public function __construct()
{ {
// Initialise variables // Initialise variables
$this->_author = 'Author'; $this->author = 'Author';
$this->_text = new PHPExcel_RichText(); $this->text = new PHPExcel_RichText();
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1'); $this->fillColor = new PHPExcel_Style_Color('FFFFFFE1');
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; $this->alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
} }
/** /**
@ -111,7 +111,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getAuthor() public function getAuthor()
{ {
return $this->_author; return $this->author;
} }
/** /**
@ -122,7 +122,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setAuthor($pValue = '') public function setAuthor($pValue = '')
{ {
$this->_author = $pValue; $this->author = $pValue;
return $this; return $this;
} }
@ -133,7 +133,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getText() public function getText()
{ {
return $this->_text; return $this->text;
} }
/** /**
@ -144,7 +144,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setText(PHPExcel_RichText $pValue) public function setText(PHPExcel_RichText $pValue)
{ {
$this->_text = $pValue; $this->text = $pValue;
return $this; return $this;
} }
@ -155,7 +155,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getWidth() public function getWidth()
{ {
return $this->_width; return $this->width;
} }
/** /**
@ -166,7 +166,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setWidth($value = '96pt') public function setWidth($value = '96pt')
{ {
$this->_width = $value; $this->width = $value;
return $this; return $this;
} }
@ -177,7 +177,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getHeight() public function getHeight()
{ {
return $this->_height; return $this->height;
} }
/** /**
@ -188,7 +188,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setHeight($value = '55.5pt') public function setHeight($value = '55.5pt')
{ {
$this->_height = $value; $this->height = $value;
return $this; return $this;
} }
@ -199,7 +199,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getMarginLeft() public function getMarginLeft()
{ {
return $this->_marginLeft; return $this->marginLeft;
} }
/** /**
@ -210,7 +210,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setMarginLeft($value = '59.25pt') public function setMarginLeft($value = '59.25pt')
{ {
$this->_marginLeft = $value; $this->marginLeft = $value;
return $this; return $this;
} }
@ -221,7 +221,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getMarginTop() public function getMarginTop()
{ {
return $this->_marginTop; return $this->marginTop;
} }
/** /**
@ -232,7 +232,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setMarginTop($value = '1.5pt') public function setMarginTop($value = '1.5pt')
{ {
$this->_marginTop = $value; $this->marginTop = $value;
return $this; return $this;
} }
@ -243,7 +243,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getVisible() public function getVisible()
{ {
return $this->_visible; return $this->visible;
} }
/** /**
@ -254,7 +254,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setVisible($value = false) public function setVisible($value = false)
{ {
$this->_visible = $value; $this->visible = $value;
return $this; return $this;
} }
@ -265,7 +265,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getFillColor() public function getFillColor()
{ {
return $this->_fillColor; return $this->fillColor;
} }
/** /**
@ -276,7 +276,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
{ {
$this->_alignment = $pValue; $this->alignment = $pValue;
return $this; return $this;
} }
@ -287,7 +287,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getAlignment() public function getAlignment()
{ {
return $this->_alignment; return $this->alignment;
} }
/** /**
@ -298,16 +298,16 @@ class PHPExcel_Comment implements PHPExcel_IComparable
public function getHashCode() public function getHashCode()
{ {
return md5( return md5(
$this->_author $this->author .
. $this->_text->getHashCode() $this->text->getHashCode() .
. $this->_width $this->width .
. $this->_height $this->height .
. $this->_marginLeft $this->marginLeft .
. $this->_marginTop $this->marginTop .
. ($this->_visible ? 1 : 0) ($this->visible ? 1 : 0) .
. $this->_fillColor->getHashCode() $this->fillColor->getHashCode() .
. $this->_alignment $this->alignment .
. __CLASS__ __CLASS__
); );
} }
@ -333,6 +333,6 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function __toString() public function __toString()
{ {
return $this->_text->getPlainText(); return $this->text->getPlainText();
} }
} }

View File

@ -40,84 +40,84 @@ class PHPExcel_DocumentProperties
* *
* @var string * @var string
*/ */
private $_creator = 'Unknown Creator'; private $creator = 'Unknown Creator';
/** /**
* LastModifiedBy * LastModifiedBy
* *
* @var string * @var string
*/ */
private $_lastModifiedBy; private $lastModifiedBy;
/** /**
* Created * Created
* *
* @var datetime * @var datetime
*/ */
private $_created; private $created;
/** /**
* Modified * Modified
* *
* @var datetime * @var datetime
*/ */
private $_modified; private $modified;
/** /**
* Title * Title
* *
* @var string * @var string
*/ */
private $_title = 'Untitled Spreadsheet'; private $title = 'Untitled Spreadsheet';
/** /**
* Description * Description
* *
* @var string * @var string
*/ */
private $_description = ''; private $description = '';
/** /**
* Subject * Subject
* *
* @var string * @var string
*/ */
private $_subject = ''; private $subject = '';
/** /**
* Keywords * Keywords
* *
* @var string * @var string
*/ */
private $_keywords = ''; private $keywords = '';
/** /**
* Category * Category
* *
* @var string * @var string
*/ */
private $_category = ''; private $category = '';
/** /**
* Manager * Manager
* *
* @var string * @var string
*/ */
private $_manager = ''; private $manager = '';
/** /**
* Company * Company
* *
* @var string * @var string
*/ */
private $_company = 'Microsoft Corporation'; private $company = 'Microsoft Corporation';
/** /**
* Custom Properties * Custom Properties
* *
* @var string * @var string
*/ */
private $_customProperties = array(); private $customProperties = array();
/** /**
@ -126,9 +126,9 @@ class PHPExcel_DocumentProperties
public function __construct() public function __construct()
{ {
// Initialise values // Initialise values
$this->_lastModifiedBy = $this->_creator; $this->lastModifiedBy = $this->creator;
$this->_created = time(); $this->created = time();
$this->_modified = time(); $this->modified = time();
} }
/** /**
@ -138,7 +138,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getCreator() public function getCreator()
{ {
return $this->_creator; return $this->creator;
} }
/** /**
@ -149,7 +149,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setCreator($pValue = '') public function setCreator($pValue = '')
{ {
$this->_creator = $pValue; $this->creator = $pValue;
return $this; return $this;
} }
@ -160,7 +160,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getLastModifiedBy() public function getLastModifiedBy()
{ {
return $this->_lastModifiedBy; return $this->lastModifiedBy;
} }
/** /**
@ -171,7 +171,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setLastModifiedBy($pValue = '') public function setLastModifiedBy($pValue = '')
{ {
$this->_lastModifiedBy = $pValue; $this->lastModifiedBy = $pValue;
return $this; return $this;
} }
@ -182,7 +182,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getCreated() public function getCreated()
{ {
return $this->_created; return $this->created;
} }
/** /**
@ -203,7 +203,7 @@ class PHPExcel_DocumentProperties
} }
} }
$this->_created = $pValue; $this->created = $pValue;
return $this; return $this;
} }
@ -214,7 +214,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getModified() public function getModified()
{ {
return $this->_modified; return $this->modified;
} }
/** /**
@ -235,7 +235,7 @@ class PHPExcel_DocumentProperties
} }
} }
$this->_modified = $pValue; $this->modified = $pValue;
return $this; return $this;
} }
@ -246,7 +246,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getTitle() public function getTitle()
{ {
return $this->_title; return $this->title;
} }
/** /**
@ -257,7 +257,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setTitle($pValue = '') public function setTitle($pValue = '')
{ {
$this->_title = $pValue; $this->title = $pValue;
return $this; return $this;
} }
@ -268,7 +268,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getDescription() public function getDescription()
{ {
return $this->_description; return $this->description;
} }
/** /**
@ -279,7 +279,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setDescription($pValue = '') public function setDescription($pValue = '')
{ {
$this->_description = $pValue; $this->description = $pValue;
return $this; return $this;
} }
@ -290,7 +290,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getSubject() public function getSubject()
{ {
return $this->_subject; return $this->subject;
} }
/** /**
@ -301,7 +301,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setSubject($pValue = '') public function setSubject($pValue = '')
{ {
$this->_subject = $pValue; $this->subject = $pValue;
return $this; return $this;
} }
@ -312,7 +312,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getKeywords() public function getKeywords()
{ {
return $this->_keywords; return $this->keywords;
} }
/** /**
@ -323,7 +323,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setKeywords($pValue = '') public function setKeywords($pValue = '')
{ {
$this->_keywords = $pValue; $this->keywords = $pValue;
return $this; return $this;
} }
@ -334,7 +334,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getCategory() public function getCategory()
{ {
return $this->_category; return $this->category;
} }
/** /**
@ -345,7 +345,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setCategory($pValue = '') public function setCategory($pValue = '')
{ {
$this->_category = $pValue; $this->category = $pValue;
return $this; return $this;
} }
@ -356,7 +356,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getCompany() public function getCompany()
{ {
return $this->_company; return $this->company;
} }
/** /**
@ -367,7 +367,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setCompany($pValue = '') public function setCompany($pValue = '')
{ {
$this->_company = $pValue; $this->company = $pValue;
return $this; return $this;
} }
@ -378,7 +378,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getManager() public function getManager()
{ {
return $this->_manager; return $this->manager;
} }
/** /**
@ -389,7 +389,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setManager($pValue = '') public function setManager($pValue = '')
{ {
$this->_manager = $pValue; $this->manager = $pValue;
return $this; return $this;
} }
@ -400,7 +400,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getCustomProperties() public function getCustomProperties()
{ {
return array_keys($this->_customProperties); return array_keys($this->customProperties);
} }
/** /**
@ -411,7 +411,7 @@ class PHPExcel_DocumentProperties
*/ */
public function isCustomPropertySet($propertyName) public function isCustomPropertySet($propertyName)
{ {
return isset($this->_customProperties[$propertyName]); return isset($this->customProperties[$propertyName]);
} }
/** /**
@ -422,8 +422,8 @@ class PHPExcel_DocumentProperties
*/ */
public function getCustomPropertyValue($propertyName) public function getCustomPropertyValue($propertyName)
{ {
if (isset($this->_customProperties[$propertyName])) { if (isset($this->customProperties[$propertyName])) {
return $this->_customProperties[$propertyName]['value']; return $this->customProperties[$propertyName]['value'];
} }
} }
@ -436,8 +436,8 @@ class PHPExcel_DocumentProperties
*/ */
public function getCustomPropertyType($propertyName) public function getCustomPropertyType($propertyName)
{ {
if (isset($this->_customProperties[$propertyName])) { if (isset($this->customProperties[$propertyName])) {
return $this->_customProperties[$propertyName]['type']; return $this->customProperties[$propertyName]['type'];
} }
} }
@ -475,7 +475,7 @@ class PHPExcel_DocumentProperties
} }
} }
$this->_customProperties[$propertyName] = array( $this->customProperties[$propertyName] = array(
'value' => $propertyValue, 'value' => $propertyValue,
'type' => $propertyType 'type' => $propertyType
); );

View File

@ -32,14 +32,14 @@ class PHPExcel_HashTable
* *
* @var array * @var array
*/ */
public $_items = array(); protected $items = array();
/** /**
* HashTable key map * HashTable key map
* *
* @var array * @var array
*/ */
public $_keyMap = array(); protected $keyMap = array();
/** /**
* Create a new PHPExcel_HashTable * Create a new PHPExcel_HashTable
@ -84,9 +84,9 @@ class PHPExcel_HashTable
public function add(PHPExcel_IComparable $pSource = null) public function add(PHPExcel_IComparable $pSource = null)
{ {
$hash = $pSource->getHashCode(); $hash = $pSource->getHashCode();
if (!isset($this->_items[$hash])) { if (!isset($this->items[$hash])) {
$this->_items[$hash] = $pSource; $this->items[$hash] = $pSource;
$this->_keyMap[count($this->_items) - 1] = $hash; $this->keyMap[count($this->items) - 1] = $hash;
} }
} }
@ -99,20 +99,20 @@ class PHPExcel_HashTable
public function remove(PHPExcel_IComparable $pSource = null) public function remove(PHPExcel_IComparable $pSource = null)
{ {
$hash = $pSource->getHashCode(); $hash = $pSource->getHashCode();
if (isset($this->_items[$hash])) { if (isset($this->items[$hash])) {
unset($this->_items[$hash]); unset($this->items[$hash]);
$deleteKey = -1; $deleteKey = -1;
foreach ($this->_keyMap as $key => $value) { foreach ($this->keyMap as $key => $value) {
if ($deleteKey >= 0) { if ($deleteKey >= 0) {
$this->_keyMap[$key - 1] = $value; $this->keyMap[$key - 1] = $value;
} }
if ($value == $hash) { if ($value == $hash) {
$deleteKey = $key; $deleteKey = $key;
} }
} }
unset($this->_keyMap[count($this->_keyMap) - 1]); unset($this->keyMap[count($this->keyMap) - 1]);
} }
} }
@ -122,8 +122,8 @@ class PHPExcel_HashTable
*/ */
public function clear() public function clear()
{ {
$this->_items = array(); $this->items = array();
$this->_keyMap = array(); $this->keyMap = array();
} }
/** /**
@ -133,7 +133,7 @@ class PHPExcel_HashTable
*/ */
public function count() public function count()
{ {
return count($this->_items); return count($this->items);
} }
/** /**
@ -144,7 +144,7 @@ class PHPExcel_HashTable
*/ */
public function getIndexForHashCode($pHashCode = '') public function getIndexForHashCode($pHashCode = '')
{ {
return array_search($pHashCode, $this->_keyMap); return array_search($pHashCode, $this->keyMap);
} }
/** /**
@ -156,8 +156,8 @@ class PHPExcel_HashTable
*/ */
public function getByIndex($pIndex = 0) public function getByIndex($pIndex = 0)
{ {
if (isset($this->_keyMap[$pIndex])) { if (isset($this->keyMap[$pIndex])) {
return $this->getByHashCode($this->_keyMap[$pIndex]); return $this->getByHashCode($this->keyMap[$pIndex]);
} }
return null; return null;
@ -172,8 +172,8 @@ class PHPExcel_HashTable
*/ */
public function getByHashCode($pHashCode = '') public function getByHashCode($pHashCode = '')
{ {
if (isset($this->_items[$pHashCode])) { if (isset($this->items[$pHashCode])) {
return $this->_items[$pHashCode]; return $this->items[$pHashCode];
} }
return null; return null;
@ -186,7 +186,7 @@ class PHPExcel_HashTable
*/ */
public function toArray() public function toArray()
{ {
return $this->_items; return $this->items;
} }
/** /**

View File

@ -43,7 +43,7 @@ class PHPExcel_IOFactory
* @access private * @access private
* @static * @static
*/ */
private static $_searchLocations = array( private static $searchLocations = array(
array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ), array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ),
array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' ) array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' )
); );
@ -55,7 +55,7 @@ class PHPExcel_IOFactory
* @access private * @access private
* @static * @static
*/ */
private static $_autoResolveClasses = array( private static $autoResolveClasses = array(
'Excel2007', 'Excel2007',
'Excel5', 'Excel5',
'Excel2003XML', 'Excel2003XML',
@ -82,7 +82,7 @@ class PHPExcel_IOFactory
*/ */
public static function getSearchLocations() public static function getSearchLocations()
{ {
return self::$_searchLocations; return self::$searchLocations;
} }
/** /**
@ -96,7 +96,7 @@ class PHPExcel_IOFactory
public static function setSearchLocations($value) public static function setSearchLocations($value)
{ {
if (is_array($value)) { if (is_array($value)) {
self::$_searchLocations = $value; self::$searchLocations = $value;
} else { } else {
throw new PHPExcel_Reader_Exception('Invalid parameter passed.'); throw new PHPExcel_Reader_Exception('Invalid parameter passed.');
} }
@ -113,7 +113,7 @@ class PHPExcel_IOFactory
*/ */
public static function addSearchLocation($type = '', $location = '', $classname = '') public static function addSearchLocation($type = '', $location = '', $classname = '')
{ {
self::$_searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname ); self::$searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname );
} }
/** /**
@ -132,7 +132,7 @@ class PHPExcel_IOFactory
$searchType = 'IWriter'; $searchType = 'IWriter';
// Include class // Include class
foreach (self::$_searchLocations as $searchLocation) { foreach (self::$searchLocations as $searchLocation) {
if ($searchLocation['type'] == $searchType) { if ($searchLocation['type'] == $searchType) {
$className = str_replace('{0}', $writerType, $searchLocation['class']); $className = str_replace('{0}', $writerType, $searchLocation['class']);
@ -162,7 +162,7 @@ class PHPExcel_IOFactory
$searchType = 'IReader'; $searchType = 'IReader';
// Include class // Include class
foreach (self::$_searchLocations as $searchLocation) { foreach (self::$searchLocations as $searchLocation) {
if ($searchLocation['type'] == $searchType) { if ($searchLocation['type'] == $searchType) {
$className = str_replace('{0}', $readerType, $searchLocation['class']); $className = str_replace('{0}', $readerType, $searchLocation['class']);
@ -273,8 +273,8 @@ class PHPExcel_IOFactory
} }
// If we reach here then "lucky guess" didn't give any result // If we reach here then "lucky guess" didn't give any result
// Try walking through all the options in self::$_autoResolveClasses // Try walking through all the options in self::$autoResolveClasses
foreach (self::$_autoResolveClasses as $autoResolveClass) { foreach (self::$autoResolveClasses as $autoResolveClass) {
// Ignore our original guess, we know that won't work // Ignore our original guess, we know that won't work
if ($autoResolveClass !== $extensionType) { if ($autoResolveClass !== $extensionType) {
$reader = self::createReader($autoResolveClass); $reader = self::createReader($autoResolveClass);

View File

@ -32,35 +32,35 @@ class PHPExcel_NamedRange
* *
* @var string * @var string
*/ */
private $_name; private $name;
/** /**
* Worksheet on which the named range can be resolved * Worksheet on which the named range can be resolved
* *
* @var PHPExcel_Worksheet * @var PHPExcel_Worksheet
*/ */
private $_worksheet; private $worksheet;
/** /**
* Range of the referenced cells * Range of the referenced cells
* *
* @var string * @var string
*/ */
private $_range; private $range;
/** /**
* Is the named range local? (i.e. can only be used on $this->_worksheet) * Is the named range local? (i.e. can only be used on $this->worksheet)
* *
* @var bool * @var bool
*/ */
private $_localOnly; private $localOnly;
/** /**
* Scope * Scope
* *
* @var PHPExcel_Worksheet * @var PHPExcel_Worksheet
*/ */
private $_scope; private $scope;
/** /**
* Create a new NamedRange * Create a new NamedRange
@ -80,12 +80,11 @@ class PHPExcel_NamedRange
} }
// Set local members // Set local members
$this->_name = $pName; $this->name = $pName;
$this->_worksheet = $pWorksheet; $this->worksheet = $pWorksheet;
$this->_range = $pRange; $this->range = $pRange;
$this->_localOnly = $pLocalOnly; $this->localOnly = $pLocalOnly;
$this->_scope = ($pLocalOnly == true) ? $this->scope = ($pLocalOnly == true) ? (($pScope == null) ? $pWorksheet : $pScope) : null;
(($pScope == null) ? $pWorksheet : $pScope) : null;
} }
/** /**
@ -95,7 +94,7 @@ class PHPExcel_NamedRange
*/ */
public function getName() public function getName()
{ {
return $this->_name; return $this->name;
} }
/** /**
@ -108,21 +107,21 @@ class PHPExcel_NamedRange
{ {
if ($value !== null) { if ($value !== null) {
// Old title // Old title
$oldTitle = $this->_name; $oldTitle = $this->name;
// Re-attach // Re-attach
if ($this->_worksheet !== null) { if ($this->worksheet !== null) {
$this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet); $this->worksheet->getParent()->removeNamedRange($this->name, $this->worksheet);
} }
$this->_name = $value; $this->name = $value;
if ($this->_worksheet !== null) { if ($this->worksheet !== null) {
$this->_worksheet->getParent()->addNamedRange($this); $this->worksheet->getParent()->addNamedRange($this);
} }
// New title // New title
$newTitle = $this->_name; $newTitle = $this->name;
PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_worksheet->getParent(), $oldTitle, $newTitle); PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->worksheet->getParent(), $oldTitle, $newTitle);
} }
return $this; return $this;
} }
@ -134,7 +133,7 @@ class PHPExcel_NamedRange
*/ */
public function getWorksheet() public function getWorksheet()
{ {
return $this->_worksheet; return $this->worksheet;
} }
/** /**
@ -146,7 +145,7 @@ class PHPExcel_NamedRange
public function setWorksheet(PHPExcel_Worksheet $value = null) public function setWorksheet(PHPExcel_Worksheet $value = null)
{ {
if ($value !== null) { if ($value !== null) {
$this->_worksheet = $value; $this->worksheet = $value;
} }
return $this; return $this;
} }
@ -158,7 +157,7 @@ class PHPExcel_NamedRange
*/ */
public function getRange() public function getRange()
{ {
return $this->_range; return $this->range;
} }
/** /**
@ -170,7 +169,7 @@ class PHPExcel_NamedRange
public function setRange($value = null) public function setRange($value = null)
{ {
if ($value !== null) { if ($value !== null) {
$this->_range = $value; $this->range = $value;
} }
return $this; return $this;
} }
@ -182,7 +181,7 @@ class PHPExcel_NamedRange
*/ */
public function getLocalOnly() public function getLocalOnly()
{ {
return $this->_localOnly; return $this->localOnly;
} }
/** /**
@ -193,8 +192,8 @@ class PHPExcel_NamedRange
*/ */
public function setLocalOnly($value = false) public function setLocalOnly($value = false)
{ {
$this->_localOnly = $value; $this->localOnly = $value;
$this->_scope = $value ? $this->_worksheet : null; $this->scope = $value ? $this->worksheet : null;
return $this; return $this;
} }
@ -205,7 +204,7 @@ class PHPExcel_NamedRange
*/ */
public function getScope() public function getScope()
{ {
return $this->_scope; return $this->scope;
} }
/** /**
@ -216,8 +215,8 @@ class PHPExcel_NamedRange
*/ */
public function setScope(PHPExcel_Worksheet $value = null) public function setScope(PHPExcel_Worksheet $value = null)
{ {
$this->_scope = $value; $this->scope = $value;
$this->_localOnly = ($value == null) ? false : true; $this->localOnly = ($value == null) ? false : true;
return $this; return $this;
} }

View File

@ -50,7 +50,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private * @access private
* @var string * @var string
*/ */
private $_inputEncoding = 'UTF-8'; private $inputEncoding = 'UTF-8';
/** /**
* Delimiter * Delimiter
@ -58,7 +58,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private * @access private
* @var string * @var string
*/ */
private $_delimiter = ','; private $delimiter = ',';
/** /**
* Enclosure * Enclosure
@ -66,7 +66,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private * @access private
* @var string * @var string
*/ */
private $_enclosure = '"'; private $enclosure = '"';
/** /**
* Sheet index to read * Sheet index to read
@ -74,7 +74,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private * @access private
* @var int * @var int
*/ */
private $_sheetIndex = 0; private $sheetIndex = 0;
/** /**
* Load rows contiguously * Load rows contiguously
@ -82,20 +82,21 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private * @access private
* @var int * @var int
*/ */
private $_contiguous = false; private $contiguous = false;
/** /**
* Row counter for loading rows contiguously * Row counter for loading rows contiguously
* *
* @var int * @var int
*/ */
private $_contiguousRow = -1; private $contiguousRow = -1;
/** /**
* Create a new PHPExcel_Reader_CSV * Create a new PHPExcel_Reader_CSV
*/ */
public function __construct() { public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
} }
@ -106,7 +107,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*/ */
protected function _isValidFormat() protected function _isValidFormat()
{ {
return TRUE; return true;
} }
/** /**
@ -116,7 +117,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*/ */
public function setInputEncoding($pValue = 'UTF-8') public function setInputEncoding($pValue = 'UTF-8')
{ {
$this->_inputEncoding = $pValue; $this->inputEncoding = $pValue;
return $this; return $this;
} }
@ -127,7 +128,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*/ */
public function getInputEncoding() public function getInputEncoding()
{ {
return $this->_inputEncoding; return $this->inputEncoding;
} }
/** /**
@ -138,7 +139,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
{ {
rewind($this->_fileHandle); rewind($this->_fileHandle);
switch ($this->_inputEncoding) { switch ($this->inputEncoding) {
case 'UTF-8': case 'UTF-8':
fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ? fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ?
fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0); fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0);
@ -183,7 +184,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Skip BOM, if any // Skip BOM, if any
$this->_skipBOM(); $this->_skipBOM();
$escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure ); $escapeEnclosures = array( "\\" . $this->enclosure, $this->enclosure . $this->enclosure );
$worksheetInfo = array(); $worksheetInfo = array();
$worksheetInfo[0]['worksheetName'] = 'Worksheet'; $worksheetInfo[0]['worksheetName'] = 'Worksheet';
@ -193,7 +194,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
$worksheetInfo[0]['totalColumns'] = 0; $worksheetInfo[0]['totalColumns'] = 0;
// Loop through each line of the file in turn // Loop through each line of the file in turn
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) { while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) {
$worksheetInfo[0]['totalRows']++; $worksheetInfo[0]['totalRows']++;
$worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1); $worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1);
} }
@ -248,32 +249,32 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
$this->_skipBOM(); $this->_skipBOM();
// Create new PHPExcel object // Create new PHPExcel object
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
$objPHPExcel->createSheet(); $objPHPExcel->createSheet();
} }
$sheet = $objPHPExcel->setActiveSheetIndex($this->_sheetIndex); $sheet = $objPHPExcel->setActiveSheetIndex($this->sheetIndex);
$escapeEnclosures = array( "\\" . $this->_enclosure, $escapeEnclosures = array( "\\" . $this->enclosure,
$this->_enclosure . $this->_enclosure $this->enclosure . $this->enclosure
); );
// Set our starting row based on whether we're in contiguous mode or not // Set our starting row based on whether we're in contiguous mode or not
$currentRow = 1; $currentRow = 1;
if ($this->_contiguous) { if ($this->contiguous) {
$currentRow = ($this->_contiguousRow == -1) ? $sheet->getHighestRow(): $this->_contiguousRow; $currentRow = ($this->contiguousRow == -1) ? $sheet->getHighestRow(): $this->contiguousRow;
} }
// Loop through each line of the file in turn // Loop through each line of the file in turn
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) { while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) {
$columnLetter = 'A'; $columnLetter = 'A';
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) { if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) {
// Unescape enclosures // Unescape enclosures
$rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum); $rowDatum = str_replace($escapeEnclosures, $this->enclosure, $rowDatum);
// Convert encoding if necessary // Convert encoding if necessary
if ($this->_inputEncoding !== 'UTF-8') { if ($this->inputEncoding !== 'UTF-8') {
$rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->_inputEncoding); $rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->inputEncoding);
} }
// Set cell value // Set cell value
@ -287,8 +288,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Close file // Close file
fclose($fileHandle); fclose($fileHandle);
if ($this->_contiguous) { if ($this->contiguous) {
$this->_contiguousRow = $currentRow; $this->contiguousRow = $currentRow;
} }
ini_set('auto_detect_line_endings', $lineEnding); ini_set('auto_detect_line_endings', $lineEnding);
@ -302,8 +303,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return string * @return string
*/ */
public function getDelimiter() { public function getDelimiter()
return $this->_delimiter; {
return $this->delimiter;
} }
/** /**
@ -312,8 +314,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param string $pValue Delimiter, defaults to , * @param string $pValue Delimiter, defaults to ,
* @return PHPExcel_Reader_CSV * @return PHPExcel_Reader_CSV
*/ */
public function setDelimiter($pValue = ',') { public function setDelimiter($pValue = ',')
$this->_delimiter = $pValue; {
$this->delimiter = $pValue;
return $this; return $this;
} }
@ -322,8 +325,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return string * @return string
*/ */
public function getEnclosure() { public function getEnclosure()
return $this->_enclosure; {
return $this->enclosure;
} }
/** /**
@ -332,11 +336,12 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param string $pValue Enclosure, defaults to " * @param string $pValue Enclosure, defaults to "
* @return PHPExcel_Reader_CSV * @return PHPExcel_Reader_CSV
*/ */
public function setEnclosure($pValue = '"') { public function setEnclosure($pValue = '"')
{
if ($pValue == '') { if ($pValue == '') {
$pValue = '"'; $pValue = '"';
} }
$this->_enclosure = $pValue; $this->enclosure = $pValue;
return $this; return $this;
} }
@ -345,8 +350,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return integer * @return integer
*/ */
public function getSheetIndex() { public function getSheetIndex()
return $this->_sheetIndex; {
return $this->sheetIndex;
} }
/** /**
@ -355,8 +361,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param integer $pValue Sheet index * @param integer $pValue Sheet index
* @return PHPExcel_Reader_CSV * @return PHPExcel_Reader_CSV
*/ */
public function setSheetIndex($pValue = 0) { public function setSheetIndex($pValue = 0)
$this->_sheetIndex = $pValue; {
$this->sheetIndex = $pValue;
return $this; return $this;
} }
@ -365,11 +372,11 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @param boolean $contiguous * @param boolean $contiguous
*/ */
public function setContiguous($contiguous = FALSE) public function setContiguous($contiguous = false)
{ {
$this->_contiguous = (bool) $contiguous; $this->contiguous = (bool) $contiguous;
if (!$contiguous) { if (!$contiguous) {
$this->_contiguousRow = -1; $this->contiguousRow = -1;
} }
return $this; return $this;
@ -380,8 +387,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return boolean * @return boolean
*/ */
public function getContiguous() { public function getContiguous()
return $this->_contiguous; {
return $this->contiguous;
} }
} }

View File

@ -52,7 +52,8 @@ class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
* @param $worksheetName Optional worksheet name * @param $worksheetName Optional worksheet name
* @return boolean * @return boolean
*/ */
public function readCell($column, $row, $worksheetName = '') { public function readCell($column, $row, $worksheetName = '')
{
return true; return true;
} }
} }

View File

@ -1,6 +1,16 @@
<?php <?php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/** /**
* PHPExcel * @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_Excel2003XML
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,24 +34,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_Excel2003XML
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{ {
/** /**
@ -49,15 +41,14 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
* *
* @var array * @var array
*/ */
protected $_styles = array(); protected $styles = array();
/** /**
* Character set used in the file * Character set used in the file
* *
* @var string * @var string
*/ */
protected $_charSet = 'UTF-8'; protected $charSet = 'UTF-8';
/** /**
* Create a new PHPExcel_Reader_Excel2003XML * Create a new PHPExcel_Reader_Excel2003XML
@ -112,9 +103,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// Retrieve charset encoding // Retrieve charset encoding
if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) { if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) {
$this->_charSet = strtoupper($matches[1]); $this->charSet = strtoupper($matches[1]);
} }
// echo 'Character Set is ', $this->_charSet,'<br />'; // echo 'Character Set is ', $this->charSet,'<br />';
return $valid; return $valid;
} }
@ -144,7 +135,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$xml_ss = $xml->children($namespaces['ss']); $xml_ss = $xml->children($namespaces['ss']);
foreach ($xml_ss->Worksheet as $worksheet) { foreach ($xml_ss->Worksheet as $worksheet) {
$worksheet_ss = $worksheet->attributes($namespaces['ss']); $worksheet_ss = $worksheet->attributes($namespaces['ss']);
$worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet); $worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet);
} }
return $worksheetNames; return $worksheetNames;
@ -338,39 +329,39 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) { foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
switch ($propertyName) { switch ($propertyName) {
case 'Title': case 'Title':
$docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Subject': case 'Subject':
$docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Author': case 'Author':
$docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Created': case 'Created':
$creationDate = strtotime($propertyValue); $creationDate = strtotime($propertyValue);
$docProps->setCreated($creationDate); $docProps->setCreated($creationDate);
break; break;
case 'LastAuthor': case 'LastAuthor':
$docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'LastSaved': case 'LastSaved':
$lastSaveDate = strtotime($propertyValue); $lastSaveDate = strtotime($propertyValue);
$docProps->setModified($lastSaveDate); $docProps->setModified($lastSaveDate);
break; break;
case 'Company': case 'Company':
$docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Category': case 'Category':
$docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Manager': case 'Manager':
$docProps->setManager(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setManager(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Keywords': case 'Keywords':
$docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Description': case 'Description':
$docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
} }
} }
@ -411,9 +402,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$styleID = (string) $style_ss['ID']; $styleID = (string) $style_ss['ID'];
// echo 'Style ID = '.$styleID.'<br />'; // echo 'Style ID = '.$styleID.'<br />';
if ($styleID == 'Default') { if ($styleID == 'Default') {
$this->_styles['Default'] = array(); $this->styles['Default'] = array();
} else { } else {
$this->_styles[$styleID] = $this->_styles['Default']; $this->styles[$styleID] = $this->styles['Default'];
} }
foreach ($style as $styleType => $styleData) { foreach ($style as $styleType => $styleData) {
$styleAttributes = $styleData->attributes($namespaces['ss']); $styleAttributes = $styleData->attributes($namespaces['ss']);
@ -426,16 +417,16 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
switch ($styleAttributeKey) { switch ($styleAttributeKey) {
case 'Vertical': case 'Vertical':
if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) { if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['alignment']['vertical'] = $styleAttributeValue; $this->styles[$styleID]['alignment']['vertical'] = $styleAttributeValue;
} }
break; break;
case 'Horizontal': case 'Horizontal':
if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) { if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue; $this->styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue;
} }
break; break;
case 'WrapText': case 'WrapText':
$this->_styles[$styleID]['alignment']['wrap'] = true; $this->styles[$styleID]['alignment']['wrap'] = true;
break; break;
} }
} }
@ -465,7 +456,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
} }
if (!empty($thisBorder)) { if (!empty($thisBorder)) {
if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) { if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) {
$this->_styles[$styleID]['borders'][$borderPosition] = $thisBorder; $this->styles[$styleID]['borders'][$borderPosition] = $thisBorder;
} }
} }
} }
@ -476,23 +467,23 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$styleAttributeValue = (string) $styleAttributeValue; $styleAttributeValue = (string) $styleAttributeValue;
switch ($styleAttributeKey) { switch ($styleAttributeKey) {
case 'FontName': case 'FontName':
$this->_styles[$styleID]['font']['name'] = $styleAttributeValue; $this->styles[$styleID]['font']['name'] = $styleAttributeValue;
break; break;
case 'Size': case 'Size':
$this->_styles[$styleID]['font']['size'] = $styleAttributeValue; $this->styles[$styleID]['font']['size'] = $styleAttributeValue;
break; break;
case 'Color': case 'Color':
$this->_styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue,1); $this->styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue, 1);
break; break;
case 'Bold': case 'Bold':
$this->_styles[$styleID]['font']['bold'] = true; $this->styles[$styleID]['font']['bold'] = true;
break; break;
case 'Italic': case 'Italic':
$this->_styles[$styleID]['font']['italic'] = true; $this->styles[$styleID]['font']['italic'] = true;
break; break;
case 'Underline': case 'Underline':
if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) { if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['font']['underline'] = $styleAttributeValue; $this->styles[$styleID]['font']['underline'] = $styleAttributeValue;
} }
break; break;
} }
@ -503,7 +494,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
switch ($styleAttributeKey) { switch ($styleAttributeKey) {
case 'Color': case 'Color':
$this->_styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue,1); $this->styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1);
break; break;
} }
} }
@ -518,7 +509,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
break; break;
} }
if ($styleAttributeValue > '') { if ($styleAttributeValue > '') {
$this->_styles[$styleID]['numberformat']['code'] = $styleAttributeValue; $this->styles[$styleID]['numberformat']['code'] = $styleAttributeValue;
} }
} }
break; break;
@ -529,7 +520,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
break; break;
} }
} }
// print_r($this->_styles[$styleID]); // print_r($this->styles[$styleID]);
// echo '<hr />'; // echo '<hr />';
} }
// echo '<hr />'; // echo '<hr />';
@ -551,7 +542,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$objPHPExcel->createSheet(); $objPHPExcel->createSheet();
$objPHPExcel->setActiveSheetIndex($worksheetID); $objPHPExcel->setActiveSheetIndex($worksheetID);
if (isset($worksheet_ss['Name'])) { if (isset($worksheet_ss['Name'])) {
$worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet); $worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet);
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in
// formula cells... during the load, all formulae should be correct, and we're simply bringing // formula cells... during the load, all formulae should be correct, and we're simply bringing
// the worksheet name in line with the formula, not the reverse // the worksheet name in line with the formula, not the reverse
@ -641,7 +632,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
const TYPE_ERROR = 'e'; const TYPE_ERROR = 'e';
*/ */
case 'String': case 'String':
$cellValue = self::_convertStringEncoding($cellValue, $this->_charSet); $cellValue = self::_convertStringEncoding($cellValue, $this->charSet);
$type = PHPExcel_Cell_DataType::TYPE_STRING; $type = PHPExcel_Cell_DataType::TYPE_STRING;
break; break;
case 'Number': case 'Number':
@ -749,20 +740,20 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// echo $annotation,'<br />'; // echo $annotation,'<br />';
$annotation = strip_tags($node); $annotation = strip_tags($node);
// echo 'Annotation: ', $annotation,'<br />'; // echo 'Annotation: ', $annotation,'<br />';
$objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::_convertStringEncoding($author , $this->_charSet))->setText($this->_parseRichText($annotation) ); $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::_convertStringEncoding($author, $this->charSet))->setText($this->_parseRichText($annotation));
} }
if (($cellIsSet) && (isset($cell_ss['StyleID']))) { if (($cellIsSet) && (isset($cell_ss['StyleID']))) {
$style = (string) $cell_ss['StyleID']; $style = (string) $cell_ss['StyleID'];
// echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />'; // echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />';
if ((isset($this->_styles[$style])) && (!empty($this->_styles[$style]))) { if ((isset($this->styles[$style])) && (!empty($this->styles[$style]))) {
// echo 'Cell '.$columnID.$rowID.'<br />'; // echo 'Cell '.$columnID.$rowID.'<br />';
// print_r($this->_styles[$style]); // print_r($this->styles[$style]);
// echo '<br />'; // echo '<br />';
if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) { if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) {
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(null); $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(null);
} }
$objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]); $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->styles[$style]);
} }
} }
++$columnID; ++$columnID;
@ -807,7 +798,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
{ {
$value = new PHPExcel_RichText(); $value = new PHPExcel_RichText();
$value->createText(self::_convertStringEncoding($is, $this->_charSet)); $value->createText(self::_convertStringEncoding($is, $this->charSet));
return $value; return $value;
} }

View File

@ -1,6 +1,16 @@
<?php <?php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/** /**
* PHPExcel * @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_Excel2007
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,24 +34,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_Excel2007
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{ {
/** /**
@ -49,25 +41,24 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
* *
* @var PHPExcel_ReferenceHelper * @var PHPExcel_ReferenceHelper
*/ */
private $_referenceHelper = NULL; private $referenceHelper = null;
/** /**
* PHPExcel_Reader_Excel2007_Theme instance * PHPExcel_Reader_Excel2007_Theme instance
* *
* @var PHPExcel_Reader_Excel2007_Theme * @var PHPExcel_Reader_Excel2007_Theme
*/ */
private static $_theme = NULL; private static $theme = null;
/** /**
* Create a new PHPExcel_Reader_Excel2007 instance * Create a new PHPExcel_Reader_Excel2007 instance
*/ */
public function __construct() { public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance(); $this->referenceHelper = PHPExcel_ReferenceHelper::getInstance();
} }
/** /**
* Can the current PHPExcel_Reader_IReader read the file? * Can the current PHPExcel_Reader_IReader read the file?
* *
@ -85,7 +76,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$zipClass = PHPExcel_Settings::getZipClass(); $zipClass = PHPExcel_Settings::getZipClass();
// Check if zip class exists // Check if zip class exists
// if (!class_exists($zipClass, FALSE)) { // if (!class_exists($zipClass, false)) {
// throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled"); // throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled");
// } // }
@ -240,34 +231,34 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
return $worksheetInfo; return $worksheetInfo;
} }
private static function castToBoolean($c)
private static function _castToBool($c) { {
// echo 'Initial Cast to Boolean', PHP_EOL; // echo 'Initial Cast to Boolean', PHP_EOL;
$value = isset($c->v) ? (string) $c->v : NULL; $value = isset($c->v) ? (string) $c->v : null;
if ($value == '0') { if ($value == '0') {
return FALSE; return false;
} elseif ($value == '1') { } elseif ($value == '1') {
return TRUE; return true;
} else { } else {
return (bool)$c->v; return (bool)$c->v;
} }
return $value; return $value;
} // function _castToBool() }
private static function castToError($c)
private static function _castToError($c) { {
// echo 'Initial Cast to Error', PHP_EOL; // echo 'Initial Cast to Error', PHP_EOL;
return isset($c->v) ? (string) $c->v : NULL; return isset($c->v) ? (string) $c->v : null;
} // function _castToError() }
private static function castToString($c)
private static function _castToString($c) { {
// echo 'Initial Cast to String, PHP_EOL; // echo 'Initial Cast to String, PHP_EOL;
return isset($c->v) ? (string) $c->v : NULL; return isset($c->v) ? (string) $c->v : null;
} // function _castToString() }
private function castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType)
private function _castToFormula($c, $r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas, $castBaseType) { {
// echo 'Formula', PHP_EOL; // echo 'Formula', PHP_EOL;
// echo '$c->f is ', $c->f, PHP_EOL; // echo '$c->f is ', $c->f, PHP_EOL;
$cellDataType = 'f'; $cellDataType = 'f';
@ -287,9 +278,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// echo 'SETTING NEW SHARED FORMULA', PHP_EOL; // echo 'SETTING NEW SHARED FORMULA', PHP_EOL;
// echo 'Master is ', $r, PHP_EOL; // echo 'Master is ', $r, PHP_EOL;
// echo 'Formula is ', $value, PHP_EOL; // echo 'Formula is ', $value, PHP_EOL;
$sharedFormulas[$instance] = array( 'master' => $r, $sharedFormulas[$instance] = array('master' => $r, 'formula' => $value);
'formula' => $value
);
// echo 'New Shared Formula Array:', PHP_EOL; // echo 'New Shared Formula Array:', PHP_EOL;
// print_r($sharedFormulas); // print_r($sharedFormulas);
} else { } else {
@ -303,11 +292,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$difference[0] = PHPExcel_Cell::columnIndexFromString($current[0]) - PHPExcel_Cell::columnIndexFromString($master[0]); $difference[0] = PHPExcel_Cell::columnIndexFromString($current[0]) - PHPExcel_Cell::columnIndexFromString($master[0]);
$difference[1] = $current[1] - $master[1]; $difference[1] = $current[1] - $master[1];
$value = $this->_referenceHelper->updateFormulaReferences( $sharedFormulas[$instance]['formula'], $value = $this->referenceHelper->updateFormulaReferences($sharedFormulas[$instance]['formula'], 'A1', $difference[0], $difference[1]);
'A1',
$difference[0],
$difference[1]
);
// echo 'Adjusted Formula is ', $value, PHP_EOL; // echo 'Adjusted Formula is ', $value, PHP_EOL;
} }
} }
@ -317,16 +302,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
public function _getFromZipArchive($archive, $fileName = '') public function _getFromZipArchive($archive, $fileName = '')
{ {
// Root-relative paths // Root-relative paths
if (strpos($fileName, '//') !== false) if (strpos($fileName, '//') !== false) {
{
$fileName = substr($fileName, strpos($fileName, '//') + 1); $fileName = substr($fileName, strpos($fileName, '//') + 1);
} }
$fileName = PHPExcel_Shared_File::realpath($fileName); $fileName = PHPExcel_Shared_File::realpath($fileName);
// Apache POI fixes // Apache POI fixes
$contents = $archive->getFromName($fileName); $contents = $archive->getFromName($fileName);
if ($contents === false) if ($contents === false) {
{
$contents = $archive->getFromName(substr($fileName, 1)); $contents = $archive->getFromName(substr($fileName, 1));
} }
@ -393,7 +376,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$themeColours[$themePos] = $xmlColourData['val']; $themeColours[$themePos] = $xmlColourData['val'];
} }
} }
self::$_theme = new PHPExcel_Reader_Excel2007_Theme($themeName, $colourSchemeName, $themeColours); self::$theme = new PHPExcel_Reader_Excel2007_Theme($themeName, $colourSchemeName, $themeColours);
} }
break; break;
} }
@ -420,18 +403,18 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$docProps->setCategory((string) self::array_item($xmlCore->xpath("cp:category"))); $docProps->setCategory((string) self::array_item($xmlCore->xpath("cp:category")));
} }
break; break;
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties": case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties":
$xmlCore = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $xmlCore = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
if (is_object($xmlCore)) { if (is_object($xmlCore)) {
$docProps = $excel->getProperties(); $docProps = $excel->getProperties();
if (isset($xmlCore->Company)) if (isset($xmlCore->Company)) {
$docProps->setCompany((string) $xmlCore->Company); $docProps->setCompany((string) $xmlCore->Company);
if (isset($xmlCore->Manager)) }
if (isset($xmlCore->Manager)) {
$docProps->setManager((string) $xmlCore->Manager); $docProps->setManager((string) $xmlCore->Manager);
} }
}
break; break;
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties": case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties":
$xmlCore = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $xmlCore = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
if (is_object($xmlCore)) { if (is_object($xmlCore)) {
@ -454,7 +437,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
case "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility": case "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility":
$customUI = $rel['Target']; $customUI = $rel['Target'];
if (!is_null($customUI)) { if (!is_null($customUI)) {
$this->_readRibbon($excel, $customUI, $zip); $this->readRibbon($excel, $customUI, $zip);
} }
break; break;
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
@ -470,13 +453,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (isset($val->t)) { if (isset($val->t)) {
$sharedStrings[] = PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $val->t); $sharedStrings[] = PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $val->t);
} elseif (isset($val->r)) { } elseif (isset($val->r)) {
$sharedStrings[] = $this->_parseRichText($val); $sharedStrings[] = $this->parseRichText($val);
} }
} }
} }
$worksheets = array(); $worksheets = array();
$macros = $customUI = NULL; $macros = $customUI = null;
foreach ($relsWorkbook->Relationship as $ele) { foreach ($relsWorkbook->Relationship as $ele) {
switch ($ele['Type']) { switch ($ele['Type']) {
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet": case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet":
@ -496,10 +479,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$excel->setHasMacros(true); $excel->setHasMacros(true);
//short-circuit : not reading vbaProject.bin.rel to get Signature =>allways vbaProjectSignature.bin in 'xl' dir //short-circuit : not reading vbaProject.bin.rel to get Signature =>allways vbaProjectSignature.bin in 'xl' dir
$Certificate = $this->_getFromZipArchive($zip, 'xl/vbaProjectSignature.bin'); $Certificate = $this->_getFromZipArchive($zip, 'xl/vbaProjectSignature.bin');
if ($Certificate !== false) if ($Certificate !== false) {
$excel->setMacrosCertificate($Certificate); $excel->setMacrosCertificate($Certificate);
} }
} }
}
$styles = array(); $styles = array();
$cellStyles = array(); $cellStyles = array();
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']")); $xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
@ -508,7 +492,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if ($xmlStyles && $xmlStyles->numFmts[0]) { if ($xmlStyles && $xmlStyles->numFmts[0]) {
$numFmts = $xmlStyles->numFmts[0]; $numFmts = $xmlStyles->numFmts[0];
} }
if (isset($numFmts) && ($numFmts !== NULL)) { if (isset($numFmts) && ($numFmts !== null)) {
$numFmts->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); $numFmts->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main");
} }
if (!$this->_readDataOnly && $xmlStyles) { if (!$this->_readDataOnly && $xmlStyles) {
@ -548,7 +532,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// add style to cellXf collection // add style to cellXf collection
$objStyle = new PHPExcel_Style; $objStyle = new PHPExcel_Style;
self::_readStyle($objStyle, $style); self::readStyle($objStyle, $style);
$excel->addCellXf($objStyle); $excel->addCellXf($objStyle);
} }
@ -576,7 +560,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// add style to cellStyleXf collection // add style to cellStyleXf collection
$objStyle = new PHPExcel_Style; $objStyle = new PHPExcel_Style;
self::_readStyle($objStyle, $cellStyle); self::readStyle($objStyle, $cellStyle);
$excel->addCellStyleXf($objStyle); $excel->addCellStyleXf($objStyle);
} }
} }
@ -586,8 +570,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// Conditional Styles // Conditional Styles
if ($xmlStyles->dxfs) { if ($xmlStyles->dxfs) {
foreach ($xmlStyles->dxfs->dxf as $dxf) { foreach ($xmlStyles->dxfs->dxf as $dxf) {
$style = new PHPExcel_Style(FALSE, TRUE); $style = new PHPExcel_Style(false, true);
self::_readStyle($style, $dxf); self::readStyle($style, $dxf);
$dxfs[] = $style; $dxfs[] = $style;
} }
} }
@ -598,7 +582,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (isset($cellStyles[intval($cellStyle['xfId'])])) { if (isset($cellStyles[intval($cellStyle['xfId'])])) {
// Set default style // Set default style
$style = new PHPExcel_Style; $style = new PHPExcel_Style;
self::_readStyle($style, $cellStyles[intval($cellStyle['xfId'])]); self::readStyle($style, $cellStyles[intval($cellStyle['xfId'])]);
// normal style, currently not using it for anything // normal style, currently not using it for anything
} }
@ -624,7 +608,6 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$countSkippedSheets = 0; // keep track of number of skipped sheets $countSkippedSheets = 0; // keep track of number of skipped sheets
$mapSheetId = array(); // mapping of sheet ids from old to new $mapSheetId = array(); // mapping of sheet ids from old to new
$charts = $chartDetails = array(); $charts = $chartDetails = array();
if ($xmlWorkbook->sheets) { if ($xmlWorkbook->sheets) {
@ -662,27 +645,21 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) { if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) {
$docSheet->getSheetView()->setZoomScale(intval($xmlSheet->sheetViews->sheetView['zoomScale'])); $docSheet->getSheetView()->setZoomScale(intval($xmlSheet->sheetViews->sheetView['zoomScale']));
} }
if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) { if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) {
$docSheet->getSheetView()->setZoomScaleNormal(intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])); $docSheet->getSheetView()->setZoomScaleNormal(intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']));
} }
if (isset($xmlSheet->sheetViews->sheetView['view'])) { if (isset($xmlSheet->sheetViews->sheetView['view'])) {
$docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']); $docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']);
} }
if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) { if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) {
$docSheet->setShowGridLines(self::boolean((string)$xmlSheet->sheetViews->sheetView['showGridLines'])); $docSheet->setShowGridLines(self::boolean((string)$xmlSheet->sheetViews->sheetView['showGridLines']));
} }
if (isset($xmlSheet->sheetViews->sheetView['showRowColHeaders'])) { if (isset($xmlSheet->sheetViews->sheetView['showRowColHeaders'])) {
$docSheet->setShowRowColHeaders(self::boolean((string)$xmlSheet->sheetViews->sheetView['showRowColHeaders'])); $docSheet->setShowRowColHeaders(self::boolean((string)$xmlSheet->sheetViews->sheetView['showRowColHeaders']));
} }
if (isset($xmlSheet->sheetViews->sheetView['rightToLeft'])) { if (isset($xmlSheet->sheetViews->sheetView['rightToLeft'])) {
$docSheet->setRightToLeft(self::boolean((string)$xmlSheet->sheetViews->sheetView['rightToLeft'])); $docSheet->setRightToLeft(self::boolean((string)$xmlSheet->sheetViews->sheetView['rightToLeft']));
} }
if (isset($xmlSheet->sheetViews->sheetView->pane)) { if (isset($xmlSheet->sheetViews->sheetView->pane)) {
if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) { if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) {
$docSheet->freezePane((string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell']); $docSheet->freezePane((string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell']);
@ -710,7 +687,6 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$docSheet->setSelectedCells($sqref); $docSheet->setSelectedCells($sqref);
} }
} }
} }
if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->tabColor)) { if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->tabColor)) {
@ -724,25 +700,25 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->outlinePr)) { if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->outlinePr)) {
if (isset($xmlSheet->sheetPr->outlinePr['summaryRight']) && if (isset($xmlSheet->sheetPr->outlinePr['summaryRight']) &&
!self::boolean((string) $xmlSheet->sheetPr->outlinePr['summaryRight'])) { !self::boolean((string) $xmlSheet->sheetPr->outlinePr['summaryRight'])) {
$docSheet->setShowSummaryRight(FALSE); $docSheet->setShowSummaryRight(false);
} else { } else {
$docSheet->setShowSummaryRight(TRUE); $docSheet->setShowSummaryRight(true);
} }
if (isset($xmlSheet->sheetPr->outlinePr['summaryBelow']) && if (isset($xmlSheet->sheetPr->outlinePr['summaryBelow']) &&
!self::boolean((string) $xmlSheet->sheetPr->outlinePr['summaryBelow'])) { !self::boolean((string) $xmlSheet->sheetPr->outlinePr['summaryBelow'])) {
$docSheet->setShowSummaryBelow(FALSE); $docSheet->setShowSummaryBelow(false);
} else { } else {
$docSheet->setShowSummaryBelow(TRUE); $docSheet->setShowSummaryBelow(true);
} }
} }
if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->pageSetUpPr)) { if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->pageSetUpPr)) {
if (isset($xmlSheet->sheetPr->pageSetUpPr['fitToPage']) && if (isset($xmlSheet->sheetPr->pageSetUpPr['fitToPage']) &&
!self::boolean((string) $xmlSheet->sheetPr->pageSetUpPr['fitToPage'])) { !self::boolean((string) $xmlSheet->sheetPr->pageSetUpPr['fitToPage'])) {
$docSheet->getPageSetup()->setFitToPage(FALSE); $docSheet->getPageSetup()->setFitToPage(false);
} else { } else {
$docSheet->getPageSetup()->setFitToPage(TRUE); $docSheet->getPageSetup()->setFitToPage(true);
} }
} }
@ -768,14 +744,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setXfIndex(intval($col["style"])); $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setXfIndex(intval($col["style"]));
} }
if (self::boolean($col["bestFit"])) { if (self::boolean($col["bestFit"])) {
//$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(TRUE); //$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(true);
} }
if (self::boolean($col["hidden"])) { if (self::boolean($col["hidden"])) {
// echo PHPExcel_Cell::stringFromColumnIndex($i), ': HIDDEN COLUMN',PHP_EOL; // echo PHPExcel_Cell::stringFromColumnIndex($i), ': HIDDEN COLUMN',PHP_EOL;
$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setVisible(FALSE); $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setVisible(false);
} }
if (self::boolean($col["collapsed"])) { if (self::boolean($col["collapsed"])) {
$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setCollapsed(TRUE); $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setCollapsed(true);
} }
if ($col["outlineLevel"] > 0) { if ($col["outlineLevel"] > 0) {
$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setOutlineLevel(intval($col["outlineLevel"])); $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setOutlineLevel(intval($col["outlineLevel"]));
@ -791,18 +767,16 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (isset($xmlSheet->printOptions) && !$this->_readDataOnly) { if (isset($xmlSheet->printOptions) && !$this->_readDataOnly) {
if (self::boolean((string) $xmlSheet->printOptions['gridLinesSet'])) { if (self::boolean((string) $xmlSheet->printOptions['gridLinesSet'])) {
$docSheet->setShowGridlines(TRUE); $docSheet->setShowGridlines(true);
} }
if (self::boolean((string) $xmlSheet->printOptions['gridLines'])) { if (self::boolean((string) $xmlSheet->printOptions['gridLines'])) {
$docSheet->setPrintGridlines(TRUE); $docSheet->setPrintGridlines(true);
} }
if (self::boolean((string) $xmlSheet->printOptions['horizontalCentered'])) { if (self::boolean((string) $xmlSheet->printOptions['horizontalCentered'])) {
$docSheet->getPageSetup()->setHorizontalCentered(TRUE); $docSheet->getPageSetup()->setHorizontalCentered(true);
} }
if (self::boolean((string) $xmlSheet->printOptions['verticalCentered'])) { if (self::boolean((string) $xmlSheet->printOptions['verticalCentered'])) {
$docSheet->getPageSetup()->setVerticalCentered(TRUE); $docSheet->getPageSetup()->setVerticalCentered(true);
} }
} }
@ -812,10 +786,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$docSheet->getRowDimension(intval($row["r"]))->setRowHeight(floatval($row["ht"])); $docSheet->getRowDimension(intval($row["r"]))->setRowHeight(floatval($row["ht"]));
} }
if (self::boolean($row["hidden"]) && !$this->_readDataOnly) { if (self::boolean($row["hidden"]) && !$this->_readDataOnly) {
$docSheet->getRowDimension(intval($row["r"]))->setVisible(FALSE); $docSheet->getRowDimension(intval($row["r"]))->setVisible(false);
} }
if (self::boolean($row["collapsed"])) { if (self::boolean($row["collapsed"])) {
$docSheet->getRowDimension(intval($row["r"]))->setCollapsed(TRUE); $docSheet->getRowDimension(intval($row["r"]))->setCollapsed(true);
} }
if ($row["outlineLevel"] > 0) { if ($row["outlineLevel"] > 0) {
$docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"])); $docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"]));
@ -831,7 +805,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$calculatedValue = null; $calculatedValue = null;
// Read cell? // Read cell?
if ($this->getReadFilter() !== NULL) { if ($this->getReadFilter() !== null) {
$coordinates = PHPExcel_Cell::coordinateFromString($r); $coordinates = PHPExcel_Cell::coordinateFromString($r);
if (!$this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) { if (!$this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) {
@ -857,15 +831,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
} else { } else {
$value = ''; $value = '';
} }
break; break;
case "b": case "b":
// echo 'Boolean', PHP_EOL; // echo 'Boolean', PHP_EOL;
if (!isset($c->f)) { if (!isset($c->f)) {
$value = self::_castToBool($c); $value = self::castToBoolean($c);
} else { } else {
// Formula // Formula
$this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas,'_castToBool'); $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToBoolean');
if (isset($c->f['t'])) { if (isset($c->f['t'])) {
$att = array(); $att = array();
$att = $c->f; $att = $c->f;
@ -876,42 +849,42 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
break; break;
case "inlineStr": case "inlineStr":
// echo 'Inline String', PHP_EOL; // echo 'Inline String', PHP_EOL;
$value = $this->_parseRichText($c->is); $value = $this->parseRichText($c->is);
break; break;
case "e": case "e":
// echo 'Error', PHP_EOL; // echo 'Error', PHP_EOL;
if (!isset($c->f)) { if (!isset($c->f)) {
$value = self::_castToError($c); $value = self::castToError($c);
} else { } else {
// Formula // Formula
$this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas,'_castToError'); $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToError');
// echo '$calculatedValue = ', $calculatedValue, PHP_EOL; // echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
} }
break; break;
default: default:
// echo 'Default', PHP_EOL; // echo 'Default', PHP_EOL;
if (!isset($c->f)) { if (!isset($c->f)) {
// echo 'Not a Formula', PHP_EOL; // echo 'Not a Formula', PHP_EOL;
$value = self::_castToString($c); $value = self::castToString($c);
} else { } else {
// echo 'Treat as Formula', PHP_EOL; // echo 'Treat as Formula', PHP_EOL;
// Formula // Formula
$this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas,'_castToString'); $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToString');
// echo '$calculatedValue = ', $calculatedValue, PHP_EOL; // echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
} }
break; break;
} }
// echo 'Value is ', $value, PHP_EOL; // echo 'Value is ', $value, PHP_EOL;
// Check for numeric values // Check for numeric values
if (is_numeric($value) && $cellDataType != 's') { if (is_numeric($value) && $cellDataType != 's') {
if ($value == (int)$value) $value = (int)$value; if ($value == (int)$value) {
elseif ($value == (float)$value) $value = (float)$value; $value = (int)$value;
elseif ($value == (double)$value) $value = (double)$value; } elseif ($value == (float)$value) {
$value = (float)$value;
} elseif ($value == (double)$value) {
$value = (double)$value;
}
} }
// Rich text? // Rich text?
@ -926,7 +899,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
} else { } else {
$cell->setValue($value); $cell->setValue($value);
} }
if ($calculatedValue !== NULL) { if ($calculatedValue !== null) {
$cell->setCalculatedValue($calculatedValue); $cell->setCalculatedValue($calculatedValue);
} }
@ -944,14 +917,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) {
foreach ($xmlSheet->conditionalFormatting as $conditional) { foreach ($xmlSheet->conditionalFormatting as $conditional) {
foreach ($conditional->cfRule as $cfRule) { foreach ($conditional->cfRule as $cfRule) {
if ( if (((string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) && isset($dxfs[intval($cfRule["dxfId"])])) {
(
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE ||
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS ||
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT ||
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
) && isset($dxfs[intval($cfRule["dxfId"])])
) {
$conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule; $conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule;
} }
} }
@ -997,7 +963,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
} }
if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) {
$docSheet->getProtection()->setPassword((string) $xmlSheet->sheetProtection["password"], TRUE); $docSheet->getProtection()->setPassword((string) $xmlSheet->sheetProtection["password"], true);
if ($xmlSheet->protectedRanges->protectedRange) { if ($xmlSheet->protectedRanges->protectedRange) {
foreach ($xmlSheet->protectedRanges->protectedRange as $protectedRange) { foreach ($xmlSheet->protectedRanges->protectedRange as $protectedRange) {
$docSheet->protectCells((string) $protectedRange["sqref"], (string) $protectedRange["password"], true); $docSheet->protectCells((string) $protectedRange["sqref"], (string) $protectedRange["password"], true);
@ -1018,25 +984,20 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER); $column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER);
$filters = $filterColumn->filters; $filters = $filterColumn->filters;
if ((isset($filters["blank"])) && ($filters["blank"] == 1)) { if ((isset($filters["blank"])) && ($filters["blank"] == 1)) {
$column->createRule()->setRule( // Operator is undefined, but always treated as EQUAL
NULL, // Operator is undefined, but always treated as EQUAL $column->createRule()->setRule(null, '')->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
''
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
} }
// Standard filters are always an OR join, so no join rule needs to be set // Standard filters are always an OR join, so no join rule needs to be set
// Entries can be either filter elements // Entries can be either filter elements
foreach ($filters->filter as $filterRule) { foreach ($filters->filter as $filterRule) {
$column->createRule()->setRule( // Operator is undefined, but always treated as EQUAL
NULL, // Operator is undefined, but always treated as EQUAL $column->createRule()->setRule(null, (string) $filterRule["val"])->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
(string) $filterRule["val"]
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
} }
// Or Date Group elements // Or Date Group elements
foreach ($filters->dateGroupItem as $dateGroupItem) { foreach ($filters->dateGroupItem as $dateGroupItem) {
$column->createRule()->setRule( $column->createRule()->setRule(
NULL, // Operator is undefined, but always treated as EQUAL // Operator is undefined, but always treated as EQUAL
null,
array( array(
'year' => (string) $dateGroupItem["year"], 'year' => (string) $dateGroupItem["year"],
'month' => (string) $dateGroupItem["month"], 'month' => (string) $dateGroupItem["month"],
@ -1073,7 +1034,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// We should only ever have one dynamic filter // We should only ever have one dynamic filter
foreach ($filterColumn->dynamicFilter as $filterRule) { foreach ($filterColumn->dynamicFilter as $filterRule) {
$column->createRule()->setRule( $column->createRule()->setRule(
NULL, // Operator is undefined, but always treated as EQUAL // Operator is undefined, but always treated as EQUAL
null,
(string) $filterRule["val"], (string) $filterRule["val"],
(string) $filterRule["type"] (string) $filterRule["type"]
) )
@ -1112,7 +1074,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->_readDataOnly) { if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->_readDataOnly) {
foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) { foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) {
$mergeRef = (string) $mergeCell["ref"]; $mergeRef = (string) $mergeCell["ref"];
if (strpos($mergeRef,':') !== FALSE) { if (strpos($mergeRef, ':') !== false) {
$docSheet->mergeCells((string) $mergeCell["ref"]); $docSheet->mergeCells((string) $mergeCell["ref"]);
} }
} }
@ -1138,13 +1100,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$docPageSetup->setPaperSize(intval($xmlSheet->pageSetup["paperSize"])); $docPageSetup->setPaperSize(intval($xmlSheet->pageSetup["paperSize"]));
} }
if (isset($xmlSheet->pageSetup["scale"])) { if (isset($xmlSheet->pageSetup["scale"])) {
$docPageSetup->setScale(intval($xmlSheet->pageSetup["scale"]), FALSE); $docPageSetup->setScale(intval($xmlSheet->pageSetup["scale"]), false);
} }
if (isset($xmlSheet->pageSetup["fitToHeight"]) && intval($xmlSheet->pageSetup["fitToHeight"]) >= 0) { if (isset($xmlSheet->pageSetup["fitToHeight"]) && intval($xmlSheet->pageSetup["fitToHeight"]) >= 0) {
$docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup["fitToHeight"]), FALSE); $docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup["fitToHeight"]), false);
} }
if (isset($xmlSheet->pageSetup["fitToWidth"]) && intval($xmlSheet->pageSetup["fitToWidth"]) >= 0) { if (isset($xmlSheet->pageSetup["fitToWidth"]) && intval($xmlSheet->pageSetup["fitToWidth"]) >= 0) {
$docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup["fitToWidth"]), FALSE); $docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup["fitToWidth"]), false);
} }
if (isset($xmlSheet->pageSetup["firstPageNumber"]) && isset($xmlSheet->pageSetup["useFirstPageNumber"]) && if (isset($xmlSheet->pageSetup["firstPageNumber"]) && isset($xmlSheet->pageSetup["useFirstPageNumber"]) &&
self::boolean((string) $xmlSheet->pageSetup["useFirstPageNumber"])) { self::boolean((string) $xmlSheet->pageSetup["useFirstPageNumber"])) {
@ -1157,27 +1119,27 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (isset($xmlSheet->headerFooter["differentOddEven"]) && if (isset($xmlSheet->headerFooter["differentOddEven"]) &&
self::boolean((string)$xmlSheet->headerFooter["differentOddEven"])) { self::boolean((string)$xmlSheet->headerFooter["differentOddEven"])) {
$docHeaderFooter->setDifferentOddEven(TRUE); $docHeaderFooter->setDifferentOddEven(true);
} else { } else {
$docHeaderFooter->setDifferentOddEven(FALSE); $docHeaderFooter->setDifferentOddEven(false);
} }
if (isset($xmlSheet->headerFooter["differentFirst"]) && if (isset($xmlSheet->headerFooter["differentFirst"]) &&
self::boolean((string)$xmlSheet->headerFooter["differentFirst"])) { self::boolean((string)$xmlSheet->headerFooter["differentFirst"])) {
$docHeaderFooter->setDifferentFirst(TRUE); $docHeaderFooter->setDifferentFirst(true);
} else { } else {
$docHeaderFooter->setDifferentFirst(FALSE); $docHeaderFooter->setDifferentFirst(false);
} }
if (isset($xmlSheet->headerFooter["scaleWithDoc"]) && if (isset($xmlSheet->headerFooter["scaleWithDoc"]) &&
!self::boolean((string)$xmlSheet->headerFooter["scaleWithDoc"])) { !self::boolean((string)$xmlSheet->headerFooter["scaleWithDoc"])) {
$docHeaderFooter->setScaleWithDocument(FALSE); $docHeaderFooter->setScaleWithDocument(false);
} else { } else {
$docHeaderFooter->setScaleWithDocument(TRUE); $docHeaderFooter->setScaleWithDocument(true);
} }
if (isset($xmlSheet->headerFooter["alignWithMargins"]) && if (isset($xmlSheet->headerFooter["alignWithMargins"]) &&
!self::boolean((string)$xmlSheet->headerFooter["alignWithMargins"])) { !self::boolean((string)$xmlSheet->headerFooter["alignWithMargins"])) {
$docHeaderFooter->setAlignWithMargins(FALSE); $docHeaderFooter->setAlignWithMargins(false);
} else { } else {
$docHeaderFooter->setAlignWithMargins(TRUE); $docHeaderFooter->setAlignWithMargins(true);
} }
$docHeaderFooter->setOddHeader((string) $xmlSheet->headerFooter->oddHeader); $docHeaderFooter->setOddHeader((string) $xmlSheet->headerFooter->oddHeader);
@ -1307,9 +1269,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// Loop through contents // Loop through contents
foreach ($commentsFile->commentList->comment as $comment) { foreach ($commentsFile->commentList->comment as $comment) {
if (!empty($comment['authorId'])) if (!empty($comment['authorId'])) {
$docSheet->getComment((string)$comment['ref'])->setAuthor($authors[(string)$comment['authorId']]); $docSheet->getComment((string)$comment['ref'])->setAuthor($authors[(string)$comment['authorId']]);
$docSheet->getComment( (string)$comment['ref'] )->setText( $this->_parseRichText($comment->text) ); }
$docSheet->getComment((string)$comment['ref'])->setText($this->parseRichText($comment->text));
} }
} }
@ -1336,14 +1299,18 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note') { if (isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note') {
$temp = $clientData->xpath('.//x:Row'); $temp = $clientData->xpath('.//x:Row');
if (is_array($temp)) $row = $temp[0]; if (is_array($temp)) {
$row = $temp[0];
}
$temp = $clientData->xpath('.//x:Column'); $temp = $clientData->xpath('.//x:Column');
if (is_array($temp)) $column = $temp[0]; if (is_array($temp)) {
$column = $temp[0];
}
} }
} }
if (($column !== NULL) && ($row !== NULL)) { if (($column !== null) && ($row !== null)) {
// Set comment properties // Set comment properties
$comment = $docSheet->getCommentByColumnAndRow((string) $column, $row + 1); $comment = $docSheet->getCommentByColumnAndRow((string) $column, $row + 1);
$comment->getFillColor()->setRGB($fillColor); $comment->getFillColor()->setRGB($fillColor);
@ -1353,12 +1320,21 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
foreach ($styleArray as $stylePair) { foreach ($styleArray as $stylePair) {
$stylePair = explode(':', $stylePair); $stylePair = explode(':', $stylePair);
if ($stylePair[0] == 'margin-left') $comment->setMarginLeft($stylePair[1]); if ($stylePair[0] == 'margin-left') {
if ($stylePair[0] == 'margin-top') $comment->setMarginTop($stylePair[1]); $comment->setMarginLeft($stylePair[1]);
if ($stylePair[0] == 'width') $comment->setWidth($stylePair[1]); }
if ($stylePair[0] == 'height') $comment->setHeight($stylePair[1]); if ($stylePair[0] == 'margin-top') {
if ($stylePair[0] == 'visibility') $comment->setVisible( $stylePair[1] == 'visible' ); $comment->setMarginTop($stylePair[1]);
}
if ($stylePair[0] == 'width') {
$comment->setWidth($stylePair[1]);
}
if ($stylePair[0] == 'height') {
$comment->setHeight($stylePair[1]);
}
if ($stylePair[0] == 'visibility') {
$comment->setVisible($stylePair[1] == 'visible');
}
} }
} }
} }
@ -1446,7 +1422,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]); $images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]);
} elseif ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart") { } elseif ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart") {
if ($this->_includeCharts) { if ($this->_includeCharts) {
$charts[self::dir_add($fileDrawing, $ele["Target"])] = array('id' => (string) $ele["Id"], $charts[self::dir_add($fileDrawing, $ele["Target"])] = array(
'id' => (string) $ele["Id"],
'sheet' => $docSheet->getTitle() 'sheet' => $docSheet->getTitle()
); );
} }
@ -1537,8 +1514,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart; $chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart;
$thisChart = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"); $thisChart = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships");
$chartDetails[$docSheet->getTitle().'!'.$thisChart] = $chartDetails[$docSheet->getTitle().'!'.$thisChart] = array(
array( 'fromCoordinate' => $fromCoordinate, 'fromCoordinate' => $fromCoordinate,
'fromOffsetX' => $fromOffsetX, 'fromOffsetX' => $fromOffsetX,
'fromOffsetY' => $fromOffsetY, 'fromOffsetY' => $fromOffsetY,
'toCoordinate' => $toCoordinate, 'toCoordinate' => $toCoordinate,
@ -1549,7 +1526,6 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
} }
} }
} }
} }
} }
} }
@ -1567,7 +1543,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
} }
// Valid range? // Valid range?
if (stripos((string)$definedName, '#REF!') !== FALSE || $extractedRange == '') { if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') {
continue; continue;
} }
@ -1575,7 +1551,6 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if ((string)$definedName['localSheetId'] != '' && (string)$definedName['localSheetId'] == $sheetId) { if ((string)$definedName['localSheetId'] != '' && (string)$definedName['localSheetId'] == $sheetId) {
// Switch on type // Switch on type
switch ((string)$definedName['name']) { switch ((string)$definedName['name']) {
case '_xlnm._FilterDatabase': case '_xlnm._FilterDatabase':
if ((string)$definedName['hidden'] !== '1') { if ((string)$definedName['hidden'] !== '1') {
$extractedRange = explode(',', $extractedRange); $extractedRange = explode(',', $extractedRange);
@ -1587,7 +1562,6 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
} }
} }
break; break;
case '_xlnm.Print_Titles': case '_xlnm.Print_Titles':
// Split $extractedRange // Split $extractedRange
$extractedRange = explode(',', $extractedRange); $extractedRange = explode(',', $extractedRange);
@ -1600,21 +1574,19 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// check for repeating columns, e g. 'A:A' or 'A:D' // check for repeating columns, e g. 'A:A' or 'A:D'
if (preg_match('/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) { if (preg_match('/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) {
$docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($matches[1], $matches[2])); $docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($matches[1], $matches[2]));
} } elseif (preg_match('/!?(\d+)\:(\d+)$/', $range, $matches)) {
// check for repeating rows, e.g. '1:1' or '1:5' // check for repeating rows, e.g. '1:1' or '1:5'
elseif (preg_match('/!?(\d+)\:(\d+)$/', $range, $matches)) {
$docSheet->getPageSetup()->setRowsToRepeatAtTop(array($matches[1], $matches[2])); $docSheet->getPageSetup()->setRowsToRepeatAtTop(array($matches[1], $matches[2]));
} }
} }
break; break;
case '_xlnm.Print_Area': case '_xlnm.Print_Area':
$rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma? $rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma?
$newRangeSets = array(); $newRangeSets = array();
foreach ($rangeSets as $rangeSet) { foreach ($rangeSets as $rangeSet) {
$range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark? $range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark?
$rangeSet = isset($range[1]) ? $range[1] : $range[0]; $rangeSet = isset($range[1]) ? $range[1] : $range[0];
if (strpos($rangeSet, ':') === FALSE) { if (strpos($rangeSet, ':') === false) {
$rangeSet = $rangeSet . ':' . $rangeSet; $rangeSet = $rangeSet . ':' . $rangeSet;
} }
$newRangeSets[] = str_replace('$', '', $rangeSet); $newRangeSets[] = str_replace('$', '', $rangeSet);
@ -1655,12 +1627,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// Local defined name // Local defined name
// Switch on type // Switch on type
switch ((string)$definedName['name']) { switch ((string)$definedName['name']) {
case '_xlnm._FilterDatabase': case '_xlnm._FilterDatabase':
case '_xlnm.Print_Titles': case '_xlnm.Print_Titles':
case '_xlnm.Print_Area': case '_xlnm.Print_Area':
break; break;
default: default:
if ($mapSheetId[(integer) $definedName['localSheetId']] !== null) { if ($mapSheetId[(integer) $definedName['localSheetId']] !== null) {
$range = explode('!', (string)$definedName); $range = explode('!', (string)$definedName);
@ -1693,7 +1663,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$extractedRange = isset($range[1]) ? $range[1] : $range[0]; $extractedRange = isset($range[1]) ? $range[1] : $range[0];
} }
if ($locatedSheet !== NULL) { if ($locatedSheet !== null) {
$excel->addNamedRange(new PHPExcel_NamedRange((string)$definedName['name'], $locatedSheet, $extractedRange, false)); $excel->addNamedRange(new PHPExcel_NamedRange((string)$definedName['name'], $locatedSheet, $extractedRange, false));
} }
} }
@ -1717,10 +1687,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
} }
break; break;
} }
} }
if (!$this->_readDataOnly) { if (!$this->_readDataOnly) {
$contentTypes = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "[Content_Types].xml")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $contentTypes = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "[Content_Types].xml")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
foreach ($contentTypes->Override as $contentType) { foreach ($contentTypes->Override as $contentType) {
@ -1742,14 +1710,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart); $excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart);
$objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet'])); $objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet']));
$objChart->setTopLeftPosition( $chartDetails[$chartPositionRef]['fromCoordinate'], $objChart->setTopLeftPosition($chartDetails[$chartPositionRef]['fromCoordinate'], $chartDetails[$chartPositionRef]['fromOffsetX'], $chartDetails[$chartPositionRef]['fromOffsetY']);
$chartDetails[$chartPositionRef]['fromOffsetX'], $objChart->setBottomRightPosition($chartDetails[$chartPositionRef]['toCoordinate'], $chartDetails[$chartPositionRef]['toOffsetX'], $chartDetails[$chartPositionRef]['toOffsetY']);
$chartDetails[$chartPositionRef]['fromOffsetY']
);
$objChart->setBottomRightPosition( $chartDetails[$chartPositionRef]['toCoordinate'],
$chartDetails[$chartPositionRef]['toOffsetX'],
$chartDetails[$chartPositionRef]['toOffsetY']
);
} }
} }
} }
@ -1762,15 +1724,15 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
return $excel; return $excel;
} }
private static function readColor($color, $background = false)
private static function _readColor($color, $background=FALSE) { {
if (isset($color["rgb"])) { if (isset($color["rgb"])) {
return (string)$color["rgb"]; return (string)$color["rgb"];
} elseif (isset($color["indexed"])) { } elseif (isset($color["indexed"])) {
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB(); return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB();
} elseif (isset($color["theme"])) { } elseif (isset($color["theme"])) {
if (self::$_theme !== NULL) { if (self::$theme !== null) {
$returnColour = self::$_theme->getColourByIndex((int)$color["theme"]); $returnColour = self::$theme->getColourByIndex((int)$color["theme"]);
if (isset($color["tint"])) { if (isset($color["tint"])) {
$tintAdjust = (float) $color["tint"]; $tintAdjust = (float) $color["tint"];
$returnColour = PHPExcel_Style_Color::changeBrightness($returnColour, $tintAdjust); $returnColour = PHPExcel_Style_Color::changeBrightness($returnColour, $tintAdjust);
@ -1785,8 +1747,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
return 'FF000000'; return 'FF000000';
} }
private static function readStyle($docStyle, $style)
private static function _readStyle($docStyle, $style) { {
// format code // format code
// if (isset($style->numFmt)) { // if (isset($style->numFmt)) {
// if (isset($style->numFmt['formatCode'])) { // if (isset($style->numFmt['formatCode'])) {
@ -1809,7 +1771,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (isset($style->font->strike)) { if (isset($style->font->strike)) {
$docStyle->getFont()->setStrikethrough(!isset($style->font->strike["val"]) || self::boolean((string) $style->font->strike["val"])); $docStyle->getFont()->setStrikethrough(!isset($style->font->strike["val"]) || self::boolean((string) $style->font->strike["val"]));
} }
$docStyle->getFont()->getColor()->setARGB(self::_readColor($style->font->color)); $docStyle->getFont()->getColor()->setARGB(self::readColor($style->font->color));
if (isset($style->font->u) && !isset($style->font->u["val"])) { if (isset($style->font->u) && !isset($style->font->u["val"])) {
$docStyle->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); $docStyle->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
@ -1837,18 +1799,18 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
} }
$docStyle->getFill()->setRotation(floatval($gradientFill["degree"])); $docStyle->getFill()->setRotation(floatval($gradientFill["degree"]));
$gradientFill->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); $gradientFill->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main");
$docStyle->getFill()->getStartColor()->setARGB(self::_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color) ); $docStyle->getFill()->getStartColor()->setARGB(self::readColor(self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color));
$docStyle->getFill()->getEndColor()->setARGB(self::_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color) ); $docStyle->getFill()->getEndColor()->setARGB(self::readColor(self::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color));
} elseif ($style->fill->patternFill) { } elseif ($style->fill->patternFill) {
$patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid'; $patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid';
$docStyle->getFill()->setFillType($patternType); $docStyle->getFill()->setFillType($patternType);
if ($style->fill->patternFill->fgColor) { if ($style->fill->patternFill->fgColor) {
$docStyle->getFill()->getStartColor()->setARGB(self::_readColor($style->fill->patternFill->fgColor,true)); $docStyle->getFill()->getStartColor()->setARGB(self::readColor($style->fill->patternFill->fgColor, true));
} else { } else {
$docStyle->getFill()->getStartColor()->setARGB('FF000000'); $docStyle->getFill()->getStartColor()->setARGB('FF000000');
} }
if ($style->fill->patternFill->bgColor) { if ($style->fill->patternFill->bgColor) {
$docStyle->getFill()->getEndColor()->setARGB(self::_readColor($style->fill->patternFill->bgColor,true)); $docStyle->getFill()->getEndColor()->setARGB(self::readColor($style->fill->patternFill->bgColor, true));
} }
} }
} }
@ -1866,11 +1828,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
} else { } else {
$docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_BOTH); $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_BOTH);
} }
self::_readBorder($docStyle->getBorders()->getLeft(), $style->border->left); self::readBorder($docStyle->getBorders()->getLeft(), $style->border->left);
self::_readBorder($docStyle->getBorders()->getRight(), $style->border->right); self::readBorder($docStyle->getBorders()->getRight(), $style->border->right);
self::_readBorder($docStyle->getBorders()->getTop(), $style->border->top); self::readBorder($docStyle->getBorders()->getTop(), $style->border->top);
self::_readBorder($docStyle->getBorders()->getBottom(), $style->border->bottom); self::readBorder($docStyle->getBorders()->getBottom(), $style->border->bottom);
self::_readBorder($docStyle->getBorders()->getDiagonal(), $style->border->diagonal); self::readBorder($docStyle->getBorders()->getDiagonal(), $style->border->diagonal);
} }
// alignment // alignment
@ -1917,18 +1879,18 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
} }
} }
private static function readBorder($docBorder, $eleBorder)
private static function _readBorder($docBorder, $eleBorder) { {
if (isset($eleBorder["style"])) { if (isset($eleBorder["style"])) {
$docBorder->setBorderStyle((string) $eleBorder["style"]); $docBorder->setBorderStyle((string) $eleBorder["style"]);
} }
if (isset($eleBorder->color)) { if (isset($eleBorder->color)) {
$docBorder->getColor()->setARGB(self::_readColor($eleBorder->color)); $docBorder->getColor()->setARGB(self::readColor($eleBorder->color));
} }
} }
private function parseRichText($is = null)
private function _parseRichText($is = null) { {
$value = new PHPExcel_RichText(); $value = new PHPExcel_RichText();
if (isset($is->t)) { if (isset($is->t)) {
@ -1945,44 +1907,37 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (isset($run->rPr->rFont["val"])) { if (isset($run->rPr->rFont["val"])) {
$objText->getFont()->setName((string) $run->rPr->rFont["val"]); $objText->getFont()->setName((string) $run->rPr->rFont["val"]);
} }
if (isset($run->rPr->sz["val"])) { if (isset($run->rPr->sz["val"])) {
$objText->getFont()->setSize((string) $run->rPr->sz["val"]); $objText->getFont()->setSize((string) $run->rPr->sz["val"]);
} }
if (isset($run->rPr->color)) { if (isset($run->rPr->color)) {
$objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($run->rPr->color) ) ); $objText->getFont()->setColor(new PHPExcel_Style_Color(self::readColor($run->rPr->color)));
} }
if ((isset($run->rPr->b["val"]) && self::boolean((string) $run->rPr->b["val"])) || if ((isset($run->rPr->b["val"]) && self::boolean((string) $run->rPr->b["val"])) ||
(isset($run->rPr->b) && !isset($run->rPr->b["val"]))) { (isset($run->rPr->b) && !isset($run->rPr->b["val"]))) {
$objText->getFont()->setBold(TRUE); $objText->getFont()->setBold(true);
} }
if ((isset($run->rPr->i["val"]) && self::boolean((string) $run->rPr->i["val"])) || if ((isset($run->rPr->i["val"]) && self::boolean((string) $run->rPr->i["val"])) ||
(isset($run->rPr->i) && !isset($run->rPr->i["val"]))) { (isset($run->rPr->i) && !isset($run->rPr->i["val"]))) {
$objText->getFont()->setItalic(TRUE); $objText->getFont()->setItalic(true);
} }
if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign["val"])) { if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign["val"])) {
$vertAlign = strtolower((string)$run->rPr->vertAlign["val"]); $vertAlign = strtolower((string)$run->rPr->vertAlign["val"]);
if ($vertAlign == 'superscript') { if ($vertAlign == 'superscript') {
$objText->getFont()->setSuperScript(TRUE); $objText->getFont()->setSuperScript(true);
} }
if ($vertAlign == 'subscript') { if ($vertAlign == 'subscript') {
$objText->getFont()->setSubScript(TRUE); $objText->getFont()->setSubScript(true);
} }
} }
if (isset($run->rPr->u) && !isset($run->rPr->u["val"])) { if (isset($run->rPr->u) && !isset($run->rPr->u["val"])) {
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
} elseif (isset($run->rPr->u) && isset($run->rPr->u["val"])) { } elseif (isset($run->rPr->u) && isset($run->rPr->u["val"])) {
$objText->getFont()->setUnderline((string)$run->rPr->u["val"]); $objText->getFont()->setUnderline((string)$run->rPr->u["val"]);
} }
if ((isset($run->rPr->strike["val"]) && self::boolean((string) $run->rPr->strike["val"])) || if ((isset($run->rPr->strike["val"]) && self::boolean((string) $run->rPr->strike["val"])) ||
(isset($run->rPr->strike) && !isset($run->rPr->strike["val"]))) { (isset($run->rPr->strike) && !isset($run->rPr->strike["val"]))) {
$objText->getFont()->setStrikethrough(TRUE); $objText->getFont()->setStrikethrough(true);
} }
} }
} }
@ -1992,7 +1947,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
return $value; return $value;
} }
private function _readRibbon($excel, $customUITarget, $zip) private function readRibbon($excel, $customUITarget, $zip)
{ {
$baseDir = dirname($customUITarget); $baseDir = dirname($customUITarget);
$nameCustomUI = basename($customUITarget); $nameCustomUI = basename($customUITarget);
@ -2022,25 +1977,26 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (count($customUIImagesNames) > 0 && count($customUIImagesBinaries) > 0) { if (count($customUIImagesNames) > 0 && count($customUIImagesBinaries) > 0) {
$excel->setRibbonBinObjects($customUIImagesNames, $customUIImagesBinaries); $excel->setRibbonBinObjects($customUIImagesNames, $customUIImagesBinaries);
} else { } else {
$excel->setRibbonBinObjects(NULL); $excel->setRibbonBinObjects(null);
} }
} else { } else {
$excel->setRibbonXMLData(NULL); $excel->setRibbonXMLData(null);
$excel->setRibbonBinObjects(NULL); $excel->setRibbonBinObjects(null);
} }
} }
private static function array_item($array, $key = 0) { private static function array_item($array, $key = 0)
{
return (isset($array[$key]) ? $array[$key] : null); return (isset($array[$key]) ? $array[$key] : null);
} }
private static function dir_add($base, $add)
private static function dir_add($base, $add) { {
return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add"); return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add");
} }
private static function toCSSArray($style)
private static function toCSSArray($style) { {
$style = str_replace(array("\r","\n"), "", $style); $style = str_replace(array("\r","\n"), "", $style);
$temp = explode(';', $style); $temp = explode(';', $style);
@ -2070,7 +2026,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
return $style; return $style;
} }
private static function boolean($value = NULL) private static function boolean($value = null)
{ {
if (is_object($value)) { if (is_object($value)) {
$value = (string) $value; $value = (string) $value;

View File

@ -34,7 +34,8 @@
*/ */
class PHPExcel_Reader_Excel2007_Chart class PHPExcel_Reader_Excel2007_Chart
{ {
private static function _getAttribute($component, $name, $format) { private static function getAttribute($component, $name, $format)
{
$attributes = $component->attributes(); $attributes = $component->attributes();
if (isset($attributes[$name])) { if (isset($attributes[$name])) {
if ($format == 'string') { if ($format == 'string') {
@ -48,10 +49,11 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
return null; return null;
} // function _getAttribute() }
private static function _readColor($color, $background=false) { private static function readColor($color, $background = false)
{
if (isset($color["rgb"])) { if (isset($color["rgb"])) {
return (string)$color["rgb"]; return (string)$color["rgb"];
} elseif (isset($color["indexed"])) { } elseif (isset($color["indexed"])) {
@ -59,13 +61,13 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
public static function readChart($chartElements, $chartName)
public static function readChart($chartElements, $chartName) { {
$namespacesChartMeta = $chartElements->getNamespaces(true); $namespacesChartMeta = $chartElements->getNamespaces(true);
$chartElementsC = $chartElements->children($namespacesChartMeta['c']); $chartElementsC = $chartElements->children($namespacesChartMeta['c']);
$XaxisLabel = $YaxisLabel = $legend = $title = NULL; $XaxisLabel = $YaxisLabel = $legend = $title = null;
$dispBlanksAs = $plotVisOnly = NULL; $dispBlanksAs = $plotVisOnly = null;
foreach ($chartElementsC as $chartElementKey => $chartElement) { foreach ($chartElementsC as $chartElementKey => $chartElement) {
switch ($chartElementKey) { switch ($chartElementKey) {
@ -79,99 +81,99 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($chartDetails as $chartDetailKey => $chartDetail) { foreach ($chartDetails as $chartDetailKey => $chartDetail) {
switch ($chartDetailKey) { switch ($chartDetailKey) {
case "layout": case "layout":
$plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'plotArea'); $plotAreaLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'plotArea');
break; break;
case "catAx": case "catAx":
if (isset($chartDetail->title)) { if (isset($chartDetail->title)) {
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat'); $XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
} }
break; break;
case "dateAx": case "dateAx":
if (isset($chartDetail->title)) { if (isset($chartDetail->title)) {
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat'); $XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
} }
break; break;
case "valAx": case "valAx":
if (isset($chartDetail->title)) { if (isset($chartDetail->title)) {
$YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat'); $YaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
} }
break; break;
case "barChart": case "barChart":
case "bar3DChart": case "bar3DChart":
$barDirection = self::_getAttribute($chartDetail->barDir, 'val', 'string'); $barDirection = self::getAttribute($chartDetail->barDir, 'val', 'string');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotDirection($barDirection); $plotSer->setPlotDirection($barDirection);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "lineChart": case "lineChart":
case "line3DChart": case "line3DChart":
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "areaChart": case "areaChart":
case "area3DChart": case "area3DChart":
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "doughnutChart": case "doughnutChart":
case "pieChart": case "pieChart":
case "pie3DChart": case "pie3DChart":
$explosion = isset($chartDetail->ser->explosion); $explosion = isset($chartDetail->ser->explosion);
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($explosion); $plotSer->setPlotStyle($explosion);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "scatterChart": case "scatterChart":
$scatterStyle = self::_getAttribute($chartDetail->scatterStyle, 'val', 'string'); $scatterStyle = self::getAttribute($chartDetail->scatterStyle, 'val', 'string');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($scatterStyle); $plotSer->setPlotStyle($scatterStyle);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "bubbleChart": case "bubbleChart":
$bubbleScale = self::_getAttribute($chartDetail->bubbleScale, 'val', 'integer'); $bubbleScale = self::getAttribute($chartDetail->bubbleScale, 'val', 'integer');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($bubbleScale); $plotSer->setPlotStyle($bubbleScale);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "radarChart": case "radarChart":
$radarStyle = self::_getAttribute($chartDetail->radarStyle, 'val', 'string'); $radarStyle = self::getAttribute($chartDetail->radarStyle, 'val', 'string');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($radarStyle); $plotSer->setPlotStyle($radarStyle);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "surfaceChart": case "surfaceChart":
case "surface3DChart": case "surface3DChart":
$wireFrame = self::_getAttribute($chartDetail->wireframe, 'val', 'boolean'); $wireFrame = self::getAttribute($chartDetail->wireframe, 'val', 'boolean');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($wireFrame); $plotSer->setPlotStyle($wireFrame);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "stockChart": case "stockChart":
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::_readChartAttributes($plotAreaLayout); $plotAttributes = self::readChartAttributes($plotAreaLayout);
break; break;
} }
} }
if ($plotAreaLayout == NULL) { if ($plotAreaLayout == null) {
$plotAreaLayout = new PHPExcel_Chart_Layout(); $plotAreaLayout = new PHPExcel_Chart_Layout();
} }
$plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries); $plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries);
self::_setChartAttributes($plotAreaLayout, $plotAttributes); self::setChartAttributes($plotAreaLayout, $plotAttributes);
break; break;
case "plotVisOnly": case "plotVisOnly":
$plotVisOnly = self::_getAttribute($chartDetails, 'val', 'string'); $plotVisOnly = self::getAttribute($chartDetails, 'val', 'string');
break; break;
case "dispBlanksAs": case "dispBlanksAs":
$dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string'); $dispBlanksAs = self::getAttribute($chartDetails, 'val', 'string');
break; break;
case "title": case "title":
$title = self::_chartTitle($chartDetails, $namespacesChartMeta,'title'); $title = self::chartTitle($chartDetails, $namespacesChartMeta, 'title');
break; break;
case "legend": case "legend":
$legendPos = 'r'; $legendPos = 'r';
@ -180,13 +182,13 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($chartDetails as $chartDetailKey => $chartDetail) { foreach ($chartDetails as $chartDetailKey => $chartDetail) {
switch ($chartDetailKey) { switch ($chartDetailKey) {
case "legendPos": case "legendPos":
$legendPos = self::_getAttribute($chartDetail, 'val', 'string'); $legendPos = self::getAttribute($chartDetail, 'val', 'string');
break; break;
case "overlay": case "overlay":
$legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean'); $legendOverlay = self::getAttribute($chartDetail, 'val', 'boolean');
break; break;
case "layout": case "layout":
$legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'legend'); $legendLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'legend');
break; break;
} }
} }
@ -199,10 +201,10 @@ class PHPExcel_Reader_Excel2007_Chart
$chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel); $chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel);
return $chart; return $chart;
} // function readChart() }
private static function chartTitle($titleDetails, $namespacesChartMeta, $type)
private static function _chartTitle($titleDetails, $namespacesChartMeta, $type) { {
$caption = array(); $caption = array();
$titleLayout = null; $titleLayout = null;
foreach ($titleDetails as $titleDetailKey => $chartDetail) { foreach ($titleDetails as $titleDetailKey => $chartDetail) {
@ -213,21 +215,21 @@ class PHPExcel_Reader_Excel2007_Chart
switch ($titleKey) { switch ($titleKey) {
case "p": case "p":
$titleDetailPart = $titleDetail->children($namespacesChartMeta['a']); $titleDetailPart = $titleDetail->children($namespacesChartMeta['a']);
$caption[] = self::_parseRichText($titleDetailPart); $caption[] = self::parseRichText($titleDetailPart);
} }
} }
break; break;
case "layout": case "layout":
$titleLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta); $titleLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta);
break; break;
} }
} }
return new PHPExcel_Chart_Title($caption, $titleLayout); return new PHPExcel_Chart_Title($caption, $titleLayout);
} // function _chartTitle() }
private static function chartLayoutDetails($chartDetail, $namespacesChartMeta)
private static function _chartLayoutDetails($chartDetail, $namespacesChartMeta) { {
if (!isset($chartDetail->manualLayout)) { if (!isset($chartDetail->manualLayout)) {
return null; return null;
} }
@ -237,15 +239,15 @@ class PHPExcel_Reader_Excel2007_Chart
} }
$layout = array(); $layout = array();
foreach ($details as $detailKey => $detail) { foreach ($details as $detailKey => $detail) {
// echo $detailKey,' => ',self::_getAttribute($detail, 'val', 'string'),PHP_EOL; // echo $detailKey, ' => ',self::getAttribute($detail, 'val', 'string'),PHP_EOL;
$layout[$detailKey] = self::_getAttribute($detail, 'val', 'string'); $layout[$detailKey] = self::getAttribute($detail, 'val', 'string');
} }
return new PHPExcel_Chart_Layout($layout); return new PHPExcel_Chart_Layout($layout);
} // function _chartLayoutDetails() }
private static function chartDataSeries($chartDetail, $namespacesChartMeta, $plotType)
private static function _chartDataSeries($chartDetail, $namespacesChartMeta, $plotType) { {
$multiSeriesType = NULL; $multiSeriesType = null;
$smoothLine = false; $smoothLine = false;
$seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array(); $seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array();
@ -253,77 +255,79 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) { foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) {
switch ($seriesDetailKey) { switch ($seriesDetailKey) {
case "grouping": case "grouping":
$multiSeriesType = self::_getAttribute($chartDetail->grouping, 'val', 'string'); $multiSeriesType = self::getAttribute($chartDetail->grouping, 'val', 'string');
break; break;
case "ser": case "ser":
$marker = NULL; $marker = null;
foreach ($seriesDetails as $seriesKey => $seriesDetail) { foreach ($seriesDetails as $seriesKey => $seriesDetail) {
switch ($seriesKey) { switch ($seriesKey) {
case "idx": case "idx":
$seriesIndex = self::_getAttribute($seriesDetail, 'val', 'integer'); $seriesIndex = self::getAttribute($seriesDetail, 'val', 'integer');
break; break;
case "order": case "order":
$seriesOrder = self::_getAttribute($seriesDetail, 'val', 'integer'); $seriesOrder = self::getAttribute($seriesDetail, 'val', 'integer');
$plotOrder[$seriesIndex] = $seriesOrder; $plotOrder[$seriesIndex] = $seriesOrder;
break; break;
case "tx": case "tx":
$seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); $seriesLabel[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
break; break;
case "marker": case "marker":
$marker = self::_getAttribute($seriesDetail->symbol, 'val', 'string'); $marker = self::getAttribute($seriesDetail->symbol, 'val', 'string');
break; break;
case "smooth": case "smooth":
$smoothLine = self::_getAttribute($seriesDetail, 'val', 'boolean'); $smoothLine = self::getAttribute($seriesDetail, 'val', 'boolean');
break; break;
case "cat": case "cat":
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
break; break;
case "val": case "val":
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
break; break;
case "xVal": case "xVal":
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
break; break;
case "yVal": case "yVal":
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
break; break;
} }
} }
} }
} }
return new PHPExcel_Chart_DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine); return new PHPExcel_Chart_DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine);
} // function _chartDataSeries() }
private static function _chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false) { private static function chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false)
{
if (isset($seriesDetail->strRef)) { if (isset($seriesDetail->strRef)) {
$seriesSource = (string) $seriesDetail->strRef->f; $seriesSource = (string) $seriesDetail->strRef->f;
$seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']),'s'); $seriesData = self::chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']), 's');
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->numRef)) { } elseif (isset($seriesDetail->numRef)) {
$seriesSource = (string) $seriesDetail->numRef->f; $seriesSource = (string) $seriesDetail->numRef->f;
$seriesData = self::_chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c'])); $seriesData = self::chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c']));
return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->multiLvlStrRef)) { } elseif (isset($seriesDetail->multiLvlStrRef)) {
$seriesSource = (string) $seriesDetail->multiLvlStrRef->f; $seriesSource = (string) $seriesDetail->multiLvlStrRef->f;
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']),'s'); $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']), 's');
$seriesData['pointCount'] = count($seriesData['dataValues']); $seriesData['pointCount'] = count($seriesData['dataValues']);
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->multiLvlNumRef)) { } elseif (isset($seriesDetail->multiLvlNumRef)) {
$seriesSource = (string) $seriesDetail->multiLvlNumRef->f; $seriesSource = (string) $seriesDetail->multiLvlNumRef->f;
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']),'s'); $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']), 's');
$seriesData['pointCount'] = count($seriesData['dataValues']); $seriesData['pointCount'] = count($seriesData['dataValues']);
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} }
return null; return null;
} // function _chartDataSeriesValueSet() }
private static function _chartDataSeriesValues($seriesValueSet, $dataType='n') { private static function chartDataSeriesValues($seriesValueSet, $dataType = 'n')
{
$seriesVal = array(); $seriesVal = array();
$formatCode = ''; $formatCode = '';
$pointCount = 0; $pointCount = 0;
@ -331,13 +335,13 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) { foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) {
switch ($seriesValueIdx) { switch ($seriesValueIdx) {
case 'ptCount': case 'ptCount':
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer'); $pointCount = self::getAttribute($seriesValue, 'val', 'integer');
break; break;
case 'formatCode': case 'formatCode':
$formatCode = (string) $seriesValue; $formatCode = (string) $seriesValue;
break; break;
case 'pt': case 'pt':
$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer'); $pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
if ($dataType == 's') { if ($dataType == 's') {
$seriesVal[$pointVal] = (string) $seriesValue->v; $seriesVal[$pointVal] = (string) $seriesValue->v;
} else { } else {
@ -348,17 +352,18 @@ class PHPExcel_Reader_Excel2007_Chart
} }
if (empty($seriesVal)) { if (empty($seriesVal)) {
$seriesVal = NULL; $seriesVal = null;
} }
return array( 'formatCode' => $formatCode, return array(
'formatCode' => $formatCode,
'pointCount' => $pointCount, 'pointCount' => $pointCount,
'dataValues' => $seriesVal 'dataValues' => $seriesVal
); );
} // function _chartDataSeriesValues() }
private static function chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType = 'n')
private static function _chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType='n') { {
$seriesVal = array(); $seriesVal = array();
$formatCode = ''; $formatCode = '';
$pointCount = 0; $pointCount = 0;
@ -367,13 +372,13 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($seriesLevel as $seriesValueIdx => $seriesValue) { foreach ($seriesLevel as $seriesValueIdx => $seriesValue) {
switch ($seriesValueIdx) { switch ($seriesValueIdx) {
case 'ptCount': case 'ptCount':
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer'); $pointCount = self::getAttribute($seriesValue, 'val', 'integer');
break; break;
case 'formatCode': case 'formatCode':
$formatCode = (string) $seriesValue; $formatCode = (string) $seriesValue;
break; break;
case 'pt': case 'pt':
$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer'); $pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
if ($dataType == 's') { if ($dataType == 's') {
$seriesVal[$pointVal][] = (string) $seriesValue->v; $seriesVal[$pointVal][] = (string) $seriesValue->v;
} else { } else {
@ -384,13 +389,15 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
return array( 'formatCode' => $formatCode, return array(
'formatCode' => $formatCode,
'pointCount' => $pointCount, 'pointCount' => $pointCount,
'dataValues' => $seriesVal 'dataValues' => $seriesVal
); );
} // function _chartDataSeriesValuesMultiLevel() }
private static function _parseRichText($titleDetailPart = null) { private static function parseRichText($titleDetailPart = null)
{
$value = new PHPExcel_RichText(); $value = new PHPExcel_RichText();
foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) { foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
@ -402,27 +409,27 @@ class PHPExcel_Reader_Excel2007_Chart
$objText->getFont()->setName((string) $titleDetailElement->rPr->rFont["val"]); $objText->getFont()->setName((string) $titleDetailElement->rPr->rFont["val"]);
} }
$fontSize = (self::_getAttribute($titleDetailElement->rPr, 'sz', 'integer')); $fontSize = (self::getAttribute($titleDetailElement->rPr, 'sz', 'integer'));
if (!is_null($fontSize)) { if (!is_null($fontSize)) {
$objText->getFont()->setSize(floor($fontSize / 100)); $objText->getFont()->setSize(floor($fontSize / 100));
} }
$fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string')); $fontColor = (self::getAttribute($titleDetailElement->rPr, 'color', 'string'));
if (!is_null($fontColor)) { if (!is_null($fontColor)) {
$objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($fontColor) ) ); $objText->getFont()->setColor(new PHPExcel_Style_Color(self::readColor($fontColor)));
} }
$bold = self::_getAttribute($titleDetailElement->rPr, 'b', 'boolean'); $bold = self::getAttribute($titleDetailElement->rPr, 'b', 'boolean');
if (!is_null($bold)) { if (!is_null($bold)) {
$objText->getFont()->setBold($bold); $objText->getFont()->setBold($bold);
} }
$italic = self::_getAttribute($titleDetailElement->rPr, 'i', 'boolean'); $italic = self::getAttribute($titleDetailElement->rPr, 'i', 'boolean');
if (!is_null($italic)) { if (!is_null($italic)) {
$objText->getFont()->setItalic($italic); $objText->getFont()->setItalic($italic);
} }
$baseline = self::_getAttribute($titleDetailElement->rPr, 'baseline', 'integer'); $baseline = self::getAttribute($titleDetailElement->rPr, 'baseline', 'integer');
if (!is_null($baseline)) { if (!is_null($baseline)) {
if ($baseline > 0) { if ($baseline > 0) {
$objText->getFont()->setSuperScript(true); $objText->getFont()->setSuperScript(true);
@ -431,7 +438,7 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
$underscore = (self::_getAttribute($titleDetailElement->rPr, 'u', 'string')); $underscore = (self::getAttribute($titleDetailElement->rPr, 'u', 'string'));
if (!is_null($underscore)) { if (!is_null($underscore)) {
if ($underscore == 'sng') { if ($underscore == 'sng') {
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
@ -442,7 +449,7 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
$strikethrough = (self::_getAttribute($titleDetailElement->rPr, 's', 'string')); $strikethrough = (self::getAttribute($titleDetailElement->rPr, 's', 'string'));
if (!is_null($strikethrough)) { if (!is_null($strikethrough)) {
if ($strikethrough == 'noStrike') { if ($strikethrough == 'noStrike') {
$objText->getFont()->setStrikethrough(false); $objText->getFont()->setStrikethrough(false);
@ -456,36 +463,37 @@ class PHPExcel_Reader_Excel2007_Chart
return $value; return $value;
} }
private static function _readChartAttributes($chartDetail) { private static function readChartAttributes($chartDetail)
{
$plotAttributes = array(); $plotAttributes = array();
if (isset($chartDetail->dLbls)) { if (isset($chartDetail->dLbls)) {
if (isset($chartDetail->dLbls->howLegendKey)) { if (isset($chartDetail->dLbls->howLegendKey)) {
$plotAttributes['showLegendKey'] = self::_getAttribute($chartDetail->dLbls->showLegendKey, 'val', 'string'); $plotAttributes['showLegendKey'] = self::getAttribute($chartDetail->dLbls->showLegendKey, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showVal)) { if (isset($chartDetail->dLbls->showVal)) {
$plotAttributes['showVal'] = self::_getAttribute($chartDetail->dLbls->showVal, 'val', 'string'); $plotAttributes['showVal'] = self::getAttribute($chartDetail->dLbls->showVal, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showCatName)) { if (isset($chartDetail->dLbls->showCatName)) {
$plotAttributes['showCatName'] = self::_getAttribute($chartDetail->dLbls->showCatName, 'val', 'string'); $plotAttributes['showCatName'] = self::getAttribute($chartDetail->dLbls->showCatName, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showSerName)) { if (isset($chartDetail->dLbls->showSerName)) {
$plotAttributes['showSerName'] = self::_getAttribute($chartDetail->dLbls->showSerName, 'val', 'string'); $plotAttributes['showSerName'] = self::getAttribute($chartDetail->dLbls->showSerName, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showPercent)) { if (isset($chartDetail->dLbls->showPercent)) {
$plotAttributes['showPercent'] = self::_getAttribute($chartDetail->dLbls->showPercent, 'val', 'string'); $plotAttributes['showPercent'] = self::getAttribute($chartDetail->dLbls->showPercent, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showBubbleSize)) { if (isset($chartDetail->dLbls->showBubbleSize)) {
$plotAttributes['showBubbleSize'] = self::_getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string'); $plotAttributes['showBubbleSize'] = self::getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showLeaderLines)) { if (isset($chartDetail->dLbls->showLeaderLines)) {
$plotAttributes['showLeaderLines'] = self::_getAttribute($chartDetail->dLbls->showLeaderLines, 'val', 'string'); $plotAttributes['showLeaderLines'] = self::getAttribute($chartDetail->dLbls->showLeaderLines, 'val', 'string');
} }
} }
return $plotAttributes; return $plotAttributes;
} }
private static function _setChartAttributes($plotArea, $plotAttributes) private static function setChartAttributes($plotArea, $plotAttributes)
{ {
foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) { foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
switch ($plotAttributeKey) { switch ($plotAttributeKey) {
@ -513,5 +521,4 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
} }
} }

View File

@ -40,21 +40,21 @@ class PHPExcel_Reader_Excel2007_Theme
* *
* @var string * @var string
*/ */
private $_themeName; private $themeName;
/** /**
* Colour Scheme Name * Colour Scheme Name
* *
* @var string * @var string
*/ */
private $_colourSchemeName; private $colourSchemeName;
/** /**
* Colour Map indexed by position * Colour Map indexed by position
* *
* @var array of string * @var array of string
*/ */
private $_colourMapValues; private $colourMapValues;
/** /**
@ -62,7 +62,7 @@ class PHPExcel_Reader_Excel2007_Theme
* *
* @var array of string * @var array of string
*/ */
private $_colourMap; private $colourMap;
/** /**
@ -72,9 +72,9 @@ class PHPExcel_Reader_Excel2007_Theme
public function __construct($themeName, $colourSchemeName, $colourMap) public function __construct($themeName, $colourSchemeName, $colourMap)
{ {
// Initialise values // Initialise values
$this->_themeName = $themeName; $this->themeName = $themeName;
$this->_colourSchemeName = $colourSchemeName; $this->colourSchemeName = $colourSchemeName;
$this->_colourMap = $colourMap; $this->colourMap = $colourMap;
} }
/** /**
@ -84,7 +84,7 @@ class PHPExcel_Reader_Excel2007_Theme
*/ */
public function getThemeName() public function getThemeName()
{ {
return $this->_themeName; return $this->themeName;
} }
/** /**
@ -92,8 +92,9 @@ class PHPExcel_Reader_Excel2007_Theme
* *
* @return string * @return string
*/ */
public function getColourSchemeName() { public function getColourSchemeName()
return $this->_colourSchemeName; {
return $this->colourSchemeName;
} }
/** /**
@ -101,9 +102,10 @@ class PHPExcel_Reader_Excel2007_Theme
* *
* @return string * @return string
*/ */
public function getColourByIndex($index=0) { public function getColourByIndex($index = 0)
if (isset($this->_colourMap[$index])) { {
return $this->_colourMap[$index]; if (isset($this->colourMap[$index])) {
return $this->colourMap[$index];
} }
return null; return null;
} }
@ -111,7 +113,8 @@ class PHPExcel_Reader_Excel2007_Theme
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) { if ((is_object($value)) && ($key != '_parent')) {

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Reader_Excel5_Escher
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Reader_Excel5_Escher
*
* @category PHPExcel
* @package PHPExcel_Reader_Excel5
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel5_Escher class PHPExcel_Reader_Excel5_Escher
{ {
const DGGCONTAINER = 0xF000; const DGGCONTAINER = 0xF000;
@ -58,28 +51,28 @@ class PHPExcel_Reader_Excel5_Escher
* *
* @var string * @var string
*/ */
private $_data; private $data;
/** /**
* Size in bytes of the Escher stream data * Size in bytes of the Escher stream data
* *
* @var int * @var int
*/ */
private $_dataSize; private $dataSize;
/** /**
* Current position of stream pointer in Escher stream data * Current position of stream pointer in Escher stream data
* *
* @var int * @var int
*/ */
private $_pos; private $pos;
/** /**
* The object to be returned by the reader. Modified during load. * The object to be returned by the reader. Modified during load.
* *
* @var mixed * @var mixed
*/ */
private $_object; private $object;
/** /**
* Create a new PHPExcel_Reader_Excel5_Escher instance * Create a new PHPExcel_Reader_Excel5_Escher instance
@ -88,7 +81,7 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
public function __construct($object) public function __construct($object)
{ {
$this->_object = $object; $this->object = $object;
} }
/** /**
@ -98,80 +91,117 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
public function load($data) public function load($data)
{ {
$this->_data = $data; $this->data = $data;
// total byte size of Excel data (workbook global substream + sheet substreams) // total byte size of Excel data (workbook global substream + sheet substreams)
$this->_dataSize = strlen($this->_data); $this->dataSize = strlen($this->data);
$this->_pos = 0; $this->pos = 0;
// Parse Escher stream // Parse Escher stream
while ($this->_pos < $this->_dataSize) { while ($this->pos < $this->dataSize) {
// offset: 2; size: 2: Record Type // offset: 2; size: 2: Record Type
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2); $fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos + 2);
switch ($fbt) { switch ($fbt) {
case self::DGGCONTAINER: $this->_readDggContainer(); break; case self::DGGCONTAINER:
case self::DGG: $this->_readDgg(); break; $this->readDggContainer();
case self::BSTORECONTAINER: $this->_readBstoreContainer(); break; break;
case self::BSE: $this->_readBSE(); break; case self::DGG:
case self::BLIPJPEG: $this->_readBlipJPEG(); break; $this->readDgg();
case self::BLIPPNG: $this->_readBlipPNG(); break; break;
case self::OPT: $this->_readOPT(); break; case self::BSTORECONTAINER:
case self::TERTIARYOPT: $this->_readTertiaryOPT(); break; $this->readBstoreContainer();
case self::SPLITMENUCOLORS: $this->_readSplitMenuColors(); break; break;
case self::DGCONTAINER: $this->_readDgContainer(); break; case self::BSE:
case self::DG: $this->_readDg(); break; $this->readBSE();
case self::SPGRCONTAINER: $this->_readSpgrContainer(); break; break;
case self::SPCONTAINER: $this->_readSpContainer(); break; case self::BLIPJPEG:
case self::SPGR: $this->_readSpgr(); break; $this->readBlipJPEG();
case self::SP: $this->_readSp(); break; break;
case self::CLIENTTEXTBOX: $this->_readClientTextbox(); break; case self::BLIPPNG:
case self::CLIENTANCHOR: $this->_readClientAnchor(); break; $this->readBlipPNG();
case self::CLIENTDATA: $this->_readClientData(); break; break;
default: $this->_readDefault(); break; case self::OPT:
$this->readOPT();
break;
case self::TERTIARYOPT:
$this->readTertiaryOPT();
break;
case self::SPLITMENUCOLORS:
$this->readSplitMenuColors();
break;
case self::DGCONTAINER:
$this->readDgContainer();
break;
case self::DG:
$this->readDg();
break;
case self::SPGRCONTAINER:
$this->readSpgrContainer();
break;
case self::SPCONTAINER:
$this->readSpContainer();
break;
case self::SPGR:
$this->readSpgr();
break;
case self::SP:
$this->readSp();
break;
case self::CLIENTTEXTBOX:
$this->readClientTextbox();
break;
case self::CLIENTANCHOR:
$this->readClientAnchor();
break;
case self::CLIENTDATA:
$this->readClientData();
break;
default:
$this->readDefault();
break;
} }
} }
return $this->_object; return $this->object;
} }
/** /**
* Read a generic record * Read a generic record
*/ */
private function _readDefault() private function readDefault()
{ {
// offset 0; size: 2; recVer and recInstance // offset 0; size: 2; recVer and recInstance
$verInstance = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos); $verInstance = PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos);
// offset: 2; size: 2: Record Type // offset: 2; size: 2: Record Type
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2); $fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos + 2);
// bit: 0-3; mask: 0x000F; recVer // bit: 0-3; mask: 0x000F; recVer
$recVer = (0x000F & $verInstance) >> 0; $recVer = (0x000F & $verInstance) >> 0;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read DggContainer record (Drawing Group Container) * Read DggContainer record (Drawing Group Container)
*/ */
private function _readDggContainer() private function readDggContainer()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$dggContainer = new PHPExcel_Shared_Escher_DggContainer(); $dggContainer = new PHPExcel_Shared_Escher_DggContainer();
$this->_object->setDggContainer($dggContainer); $this->object->setDggContainer($dggContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($dggContainer); $reader = new PHPExcel_Reader_Excel5_Escher($dggContainer);
$reader->load($recordData); $reader->load($recordData);
} }
@ -179,29 +209,29 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read Dgg record (Drawing Group) * Read Dgg record (Drawing Group)
*/ */
private function _readDgg() private function readDgg()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read BstoreContainer record (Blip Store Container) * Read BstoreContainer record (Blip Store Container)
*/ */
private function _readBstoreContainer() private function readBstoreContainer()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer(); $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer();
$this->_object->setBstoreContainer($bstoreContainer); $this->object->setBstoreContainer($bstoreContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer); $reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer);
$reader->load($recordData); $reader->load($recordData);
} }
@ -209,22 +239,22 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read BSE record * Read BSE record
*/ */
private function _readBSE() private function readBSE()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// add BSE to BstoreContainer // add BSE to BstoreContainer
$BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE(); $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE();
$this->_object->addBSE($BSE); $this->object->addBSE($BSE);
$BSE->setBLIPType($recInstance); $BSE->setBLIPType($recInstance);
@ -275,18 +305,18 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read BlipJPEG record. Holds raw JPEG image data * Read BlipJPEG record. Holds raw JPEG image data
*/ */
private function _readBlipJPEG() private function readBlipJPEG()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
$pos = 0; $pos = 0;
@ -310,24 +340,24 @@ class PHPExcel_Reader_Excel5_Escher
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
$blip->setData($data); $blip->setData($data);
$this->_object->setBlip($blip); $this->object->setBlip($blip);
} }
/** /**
* Read BlipPNG record. Holds raw PNG image data * Read BlipPNG record. Holds raw PNG image data
*/ */
private function _readBlipPNG() private function readBlipPNG()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
$pos = 0; $pos = 0;
@ -351,71 +381,71 @@ class PHPExcel_Reader_Excel5_Escher
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
$blip->setData($data); $blip->setData($data);
$this->_object->setBlip($blip); $this->object->setBlip($blip);
} }
/** /**
* Read OPT record. This record may occur within DggContainer record or SpContainer * Read OPT record. This record may occur within DggContainer record or SpContainer
*/ */
private function _readOPT() private function readOPT()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
$this->_readOfficeArtRGFOPTE($recordData, $recInstance); $this->readOfficeArtRGFOPTE($recordData, $recInstance);
} }
/** /**
* Read TertiaryOPT record * Read TertiaryOPT record
*/ */
private function _readTertiaryOPT() private function readTertiaryOPT()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read SplitMenuColors record * Read SplitMenuColors record
*/ */
private function _readSplitMenuColors() private function readSplitMenuColors()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read DgContainer record (Drawing Container) * Read DgContainer record (Drawing Container)
*/ */
private function _readDgContainer() private function readDgContainer()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$dgContainer = new PHPExcel_Shared_Escher_DgContainer(); $dgContainer = new PHPExcel_Shared_Escher_DgContainer();
$this->_object->setDgContainer($dgContainer); $this->object->setDgContainer($dgContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($dgContainer); $reader = new PHPExcel_Reader_Excel5_Escher($dgContainer);
$escher = $reader->load($recordData); $escher = $reader->load($recordData);
} }
@ -423,37 +453,37 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read Dg record (Drawing) * Read Dg record (Drawing)
*/ */
private function _readDg() private function readDg()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read SpgrContainer record (Shape Group Container) * Read SpgrContainer record (Shape Group Container)
*/ */
private function _readSpgrContainer() private function readSpgrContainer()
{ {
// context is either context DgContainer or SpgrContainer // context is either context DgContainer or SpgrContainer
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer(); $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer();
if ($this->_object instanceof PHPExcel_Shared_Escher_DgContainer) { if ($this->object instanceof PHPExcel_Shared_Escher_DgContainer) {
// DgContainer // DgContainer
$this->_object->setSpgrContainer($spgrContainer); $this->object->setSpgrContainer($spgrContainer);
} else { } else {
// SpgrContainer // SpgrContainer
$this->_object->addChild($spgrContainer); $this->object->addChild($spgrContainer);
} }
$reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer); $reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer);
@ -463,17 +493,17 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read SpContainer record (Shape Container) * Read SpContainer record (Shape Container)
*/ */
private function _readSpContainer() private function readSpContainer()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// add spContainer to spgrContainer // add spContainer to spgrContainer
$spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
$this->_object->addChild($spContainer); $this->object->addChild($spContainer);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$reader = new PHPExcel_Reader_Excel5_Escher($spContainer); $reader = new PHPExcel_Reader_Excel5_Escher($spContainer);
@ -483,59 +513,59 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read Spgr record (Shape Group) * Read Spgr record (Shape Group)
*/ */
private function _readSpgr() private function readSpgr()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read Sp record (Shape) * Read Sp record (Shape)
*/ */
private function _readSp() private function readSp()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read ClientTextbox record * Read ClientTextbox record
*/ */
private function _readClientTextbox() private function readClientTextbox()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet * Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet
*/ */
private function _readClientAnchor() private function readClientAnchor()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// offset: 2; size: 2; upper-left corner column index (0-based) // offset: 2; size: 2; upper-left corner column index (0-based)
$c1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 2); $c1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 2);
@ -562,34 +592,34 @@ class PHPExcel_Reader_Excel5_Escher
$endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16); $endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16);
// set the start coordinates // set the start coordinates
$this->_object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1)); $this->object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1));
// set the start offsetX // set the start offsetX
$this->_object->setStartOffsetX($startOffsetX); $this->object->setStartOffsetX($startOffsetX);
// set the start offsetY // set the start offsetY
$this->_object->setStartOffsetY($startOffsetY); $this->object->setStartOffsetY($startOffsetY);
// set the end coordinates // set the end coordinates
$this->_object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1)); $this->object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1));
// set the end offsetX // set the end offsetX
$this->_object->setEndOffsetX($endOffsetX); $this->object->setEndOffsetX($endOffsetX);
// set the end offsetY // set the end offsetY
$this->_object->setEndOffsetY($endOffsetY); $this->object->setEndOffsetY($endOffsetY);
} }
/** /**
* Read ClientData record * Read ClientData record
*/ */
private function _readClientData() private function readClientData()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
@ -598,8 +628,8 @@ class PHPExcel_Reader_Excel5_Escher
* @param string $data Binary data * @param string $data Binary data
* @param int $n Number of properties * @param int $n Number of properties
*/ */
private function _readOfficeArtRGFOPTE($data, $n) { private function readOfficeArtRGFOPTE($data, $n)
{
$splicedComplexData = substr($data, 6 * $n); $splicedComplexData = substr($data, 6 * $n);
// loop through property-value pairs // loop through property-value pairs
@ -633,8 +663,7 @@ class PHPExcel_Reader_Excel5_Escher
$value = $op; $value = $op;
} }
$this->_object->setOPT($opidOpid, $value); $this->object->setOPT($opidOpid, $value);
} }
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Reader_Excel5_MD5
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Reader_Excel5_MD5
*
* @category PHPExcel
* @package PHPExcel_Reader_Excel5
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel5_MD5 class PHPExcel_Reader_Excel5_MD5
{ {
// Context // Context
@ -41,7 +33,6 @@ class PHPExcel_Reader_Excel5_MD5
private $c; private $c;
private $d; private $d;
/** /**
* MD5 stream constructor * MD5 stream constructor
*/ */
@ -50,7 +41,6 @@ class PHPExcel_Reader_Excel5_MD5
$this->reset(); $this->reset();
} }
/** /**
* Reset the MD5 stream context * Reset the MD5 stream context
*/ */
@ -62,7 +52,6 @@ class PHPExcel_Reader_Excel5_MD5
$this->d = 0x10325476; $this->d = 0x10325476;
} }
/** /**
* Get MD5 stream context * Get MD5 stream context
* *
@ -82,7 +71,6 @@ class PHPExcel_Reader_Excel5_MD5
return $s; return $s;
} }
/** /**
* Add data to context * Add data to context
* *
@ -180,31 +168,26 @@ class PHPExcel_Reader_Excel5_MD5
$this->d = ($this->d + $D) & 0xffffffff; $this->d = ($this->d + $D) & 0xffffffff;
} }
private static function F($X, $Y, $Z) private static function F($X, $Y, $Z)
{ {
return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
} }
private static function G($X, $Y, $Z) private static function G($X, $Y, $Z)
{ {
return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z
} }
private static function H($X, $Y, $Z) private static function H($X, $Y, $Z)
{ {
return ($X ^ $Y ^ $Z); // X XOR Y XOR Z return ($X ^ $Y ^ $Z); // X XOR Y XOR Z
} }
private static function I($X, $Y, $Z) private static function I($X, $Y, $Z)
{ {
return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z) return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z)
} }
private static function step($func, &$A, $B, $C, $D, $M, $s, $t) private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
{ {
$A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff; $A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff;
@ -212,7 +195,6 @@ class PHPExcel_Reader_Excel5_MD5
$A = ($B + $A) & 0xffffffff; $A = ($B + $A) & 0xffffffff;
} }
private static function rotate($decimal, $bits) private static function rotate($decimal, $bits)
{ {
$binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT); $binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT);

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Reader_Excel5_RC4
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,20 +25,12 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Reader_Excel5_RC4
*
* @category PHPExcel
* @package PHPExcel_Reader_Excel5
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel5_RC4 class PHPExcel_Reader_Excel5_RC4
{ {
// Context // Context
var $s = array(); protected $s = array();
var $i = 0; protected $i = 0;
var $j = 0; protected $j = 0;
/** /**
* RC4 stream decryption/encryption constrcutor * RC4 stream decryption/encryption constrcutor

View File

@ -1,6 +1,16 @@
<?php <?php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/** /**
* PHPExcel * @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_Gnumeric
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,24 +34,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_Gnumeric
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{ {
/** /**
@ -49,27 +41,26 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
* *
* @var array * @var array
*/ */
private $_styles = array(); private $styles = array();
/** /**
* Shared Expressions * Shared Expressions
* *
* @var array * @var array
*/ */
private $_expressions = array(); private $expressions = array();
private $_referenceHelper = null;
private $referenceHelper = null;
/** /**
* Create a new PHPExcel_Reader_Gnumeric * Create a new PHPExcel_Reader_Gnumeric
*/ */
public function __construct() { public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance(); $this->referenceHelper = PHPExcel_ReferenceHelper::getInstance();
} }
/** /**
* Can the current PHPExcel_Reader_IReader read the file? * Can the current PHPExcel_Reader_IReader read the file?
* *
@ -101,7 +92,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return true; return true;
} }
/** /**
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
* *
@ -116,9 +106,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
$xml = new XMLReader(); $xml = new XMLReader();
$xml->xml( $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
$this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions()
);
$xml->setParserProperty(2, true); $xml->setParserProperty(2, true);
$worksheetNames = array(); $worksheetNames = array();
@ -135,7 +123,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $worksheetNames; return $worksheetNames;
} }
/** /**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
* *
@ -150,9 +137,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
$xml = new XMLReader(); $xml = new XMLReader();
$xml->xml( $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
$this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions()
);
$xml->setParserProperty(2, true); $xml->setParserProperty(2, true);
$worksheetInfo = array(); $worksheetInfo = array();
@ -188,8 +173,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $worksheetInfo; return $worksheetInfo;
} }
private function _gzfileGetContents($filename)
private function _gzfileGetContents($filename) { {
$file = @gzopen($filename, 'rb'); $file = @gzopen($filename, 'rb');
if ($file !== false) { if ($file !== false) {
$data = ''; $data = '';
@ -201,7 +186,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $data; return $data;
} }
/** /**
* Loads PHPExcel from file * Loads PHPExcel from file
* *
@ -218,7 +202,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $this->loadIntoExisting($pFilename, $objPHPExcel); return $this->loadIntoExisting($pFilename, $objPHPExcel);
} }
/** /**
* Loads PHPExcel from file into PHPExcel instance * Loads PHPExcel from file into PHPExcel instance
* *
@ -258,7 +241,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$officeDocMetaXML = $officeDocXML->meta; $officeDocMetaXML = $officeDocXML->meta;
foreach ($officeDocMetaXML as $officePropertyData) { foreach ($officeDocMetaXML as $officePropertyData) {
$officePropertyDC = array(); $officePropertyDC = array();
if (isset($namespacesMeta['dc'])) { if (isset($namespacesMeta['dc'])) {
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']); $officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
@ -374,7 +356,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) { if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) {
if (isset($sheet->PrintInformation->Margins)) { if (isset($sheet->PrintInformation->Margins)) {
foreach ($sheet->PrintInformation->Margins->children('gnm',TRUE) as $key => $margin) { foreach ($sheet->PrintInformation->Margins->children('gnm', true) as $key => $margin) {
$marginAttributes = $margin->attributes(); $marginAttributes = $margin->attributes();
$marginSize = 72 / 100; // Default $marginSize = 72 / 100; // Default
switch ($marginAttributes['PrefUnit']) { switch ($marginAttributes['PrefUnit']) {
@ -411,13 +393,17 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$row = (int) $cellAttributes->Row + 1; $row = (int) $cellAttributes->Row + 1;
$column = (int) $cellAttributes->Col; $column = (int) $cellAttributes->Col;
if ($row > $maxRow) $maxRow = $row; if ($row > $maxRow) {
if ($column > $maxCol) $maxCol = $column; $maxRow = $row;
}
if ($column > $maxCol) {
$maxCol = $column;
}
$column = PHPExcel_Cell::stringFromColumnIndex($column); $column = PHPExcel_Cell::stringFromColumnIndex($column);
// Read cell? // Read cell?
if ($this->getReadFilter() !== NULL) { if ($this->getReadFilter() !== null) {
if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) { if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) {
continue; continue;
} }
@ -431,21 +417,16 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$type = PHPExcel_Cell_DataType::TYPE_FORMULA; $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
if ($ExprID > '') { if ($ExprID > '') {
if (((string) $cell) > '') { if (((string) $cell) > '') {
$this->expressions[$ExprID] = array(
$this->_expressions[$ExprID] = array( 'column' => $cellAttributes->Col, 'column' => $cellAttributes->Col,
'row' => $cellAttributes->Row, 'row' => $cellAttributes->Row,
'formula' => (string) $cell 'formula' => (string) $cell
); );
// echo 'NEW EXPRESSION ', $ExprID,'<br />'; // echo 'NEW EXPRESSION ', $ExprID,'<br />';
} else { } else {
$expression = $this->_expressions[$ExprID]; $expression = $this->expressions[$ExprID];
$cell = $this->_referenceHelper->updateFormulaReferences( $expression['formula'], $cell = $this->referenceHelper->updateFormulaReferences($expression['formula'], 'A1', $cellAttributes->Col - $expression['column'], $cellAttributes->Row - $expression['row'], $worksheetName);
'A1',
$cellAttributes->Col - $expression['column'],
$cellAttributes->Row - $expression['row'],
$worksheetName
);
// echo 'SHARED EXPRESSION ', $ExprID,'<br />'; // echo 'SHARED EXPRESSION ', $ExprID,'<br />';
// echo 'New Value is ', $cell,'<br />'; // echo 'New Value is ', $cell,'<br />';
} }
@ -457,7 +438,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
break; break;
case '20': // Boolean case '20': // Boolean
$type = PHPExcel_Cell_DataType::TYPE_BOOL; $type = PHPExcel_Cell_DataType::TYPE_BOOL;
$cell = ($cell == 'TRUE') ? True : False; $cell = ($cell == 'TRUE') ? true: false;
break; break;
case '30': // Integer case '30': // Integer
$cell = intval($cell); $cell = intval($cell);
@ -478,13 +459,11 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
if ((!$this->_readDataOnly) && (isset($sheet->Objects))) { if ((!$this->_readDataOnly) && (isset($sheet->Objects))) {
foreach ($sheet->Objects->children('gnm',TRUE) as $key => $comment) { foreach ($sheet->Objects->children('gnm', true) as $key => $comment) {
$commentAttributes = $comment->attributes(); $commentAttributes = $comment->attributes();
// Only comment objects are handled at the moment // Only comment objects are handled at the moment
if ($commentAttributes->Text) { if ($commentAttributes->Text) {
$objPHPExcel->getActiveSheet()->getComment( (string)$commentAttributes->ObjectBound ) $objPHPExcel->getActiveSheet()->getComment((string)$commentAttributes->ObjectBound)->setAuthor((string)$commentAttributes->Author)->setText($this->_parseRichText((string)$commentAttributes->Text));
->setAuthor( (string)$commentAttributes->Author )
->setText($this->_parseRichText((string)$commentAttributes->Text) );
} }
} }
} }
@ -494,7 +473,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$styleAttributes = $styleRegion->attributes(); $styleAttributes = $styleRegion->attributes();
if (($styleAttributes['startRow'] <= $maxRow) && if (($styleAttributes['startRow'] <= $maxRow) &&
($styleAttributes['startCol'] <= $maxCol)) { ($styleAttributes['startCol'] <= $maxCol)) {
$startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']); $startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']);
$startRow = $styleAttributes['startRow'] + 1; $startRow = $styleAttributes['startRow'] + 1;
@ -553,8 +531,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
break; break;
} }
$styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? True : False; $styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? true : false;
$styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? True : False; $styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false;
$styleArray['alignment']['indent'] = (intval($styleAttributes["Indent"]) > 0) ? $styleAttributes["indent"] : 0; $styleArray['alignment']['indent'] = (intval($styleAttributes["Indent"]) > 0) ? $styleAttributes["indent"] : 0;
$RGB = self::_parseGnumericColour($styleAttributes["Fore"]); $RGB = self::_parseGnumericColour($styleAttributes["Fore"]);
@ -634,9 +612,9 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// echo '<br />'; // echo '<br />';
$styleArray['font']['name'] = (string) $styleRegion->Style->Font; $styleArray['font']['name'] = (string) $styleRegion->Style->Font;
$styleArray['font']['size'] = intval($fontAttributes['Unit']); $styleArray['font']['size'] = intval($fontAttributes['Unit']);
$styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? True : False; $styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false;
$styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? True : False; $styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? true : false;
$styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? True : False; $styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? true : false;
switch ($fontAttributes['Underline']) { switch ($fontAttributes['Underline']) {
case '1': case '1':
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE; $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE;
@ -656,10 +634,10 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
switch ($fontAttributes['Script']) { switch ($fontAttributes['Script']) {
case '1': case '1':
$styleArray['font']['superScript'] = True; $styleArray['font']['superScript'] = true;
break; break;
case '-1': case '-1':
$styleArray['font']['subScript'] = True; $styleArray['font']['subScript'] = true;
break; break;
} }
@ -761,7 +739,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// Handle Merged Cells in this worksheet // Handle Merged Cells in this worksheet
if (isset($sheet->MergedRegions)) { if (isset($sheet->MergedRegions)) {
foreach ($sheet->MergedRegions->Merge as $mergeCells) { foreach ($sheet->MergedRegions->Merge as $mergeCells) {
if (strpos($mergeCells,':') !== FALSE) { if (strpos($mergeCells, ':') !== false) {
$objPHPExcel->getActiveSheet()->mergeCells($mergeCells); $objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
} }
} }
@ -780,7 +758,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
$range = explode('!', $range); $range = explode('!', $range);
$range[0] = trim($range[0],"'");; $range[0] = trim($range[0], "'");
if ($worksheet = $objPHPExcel->getSheetByName($range[0])) { if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
$extractedRange = str_replace('$', '', $range[1]); $extractedRange = str_replace('$', '', $range[1]);
$objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $worksheet, $extractedRange)); $objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $worksheet, $extractedRange));
@ -788,12 +766,10 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
} }
// Return // Return
return $objPHPExcel; return $objPHPExcel;
} }
private static function _parseBorderAttributes($borderAttributes) private static function _parseBorderAttributes($borderAttributes)
{ {
$styleArray = array(); $styleArray = array();
@ -850,8 +826,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $styleArray; return $styleArray;
} }
private function _parseRichText($is = '')
private function _parseRichText($is = '') { {
$value = new PHPExcel_RichText(); $value = new PHPExcel_RichText();
$value->createText($is); $value->createText($is);
@ -859,8 +835,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $value; return $value;
} }
private static function _parseGnumericColour($gnmColour)
private static function _parseGnumericColour($gnmColour) { {
list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour); list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour);
$gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2); $gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2);
$gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2); $gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2);
@ -869,5 +845,4 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// echo 'Excel Colour: ', $RGB,'<br />'; // echo 'Excel Colour: ', $RGB,'<br />';
return $RGB; return $RGB;
} }
} }

View File

@ -1,6 +1,16 @@
<?php <?php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/** /**
* PHPExcel * @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_OOCalc
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,24 +34,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_OOCalc
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{ {
/** /**
@ -49,17 +41,16 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
* *
* @var array * @var array
*/ */
private $_styles = array(); private $styles = array();
/** /**
* Create a new PHPExcel_Reader_OOCalc * Create a new PHPExcel_Reader_OOCalc
*/ */
public function __construct() { public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
} }
/** /**
* Can the current PHPExcel_Reader_IReader read the file? * Can the current PHPExcel_Reader_IReader read the file?
* *
@ -77,7 +68,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$zipClass = PHPExcel_Settings::getZipClass(); $zipClass = PHPExcel_Settings::getZipClass();
// Check if zip class exists // Check if zip class exists
// if (!class_exists($zipClass, FALSE)) { // if (!class_exists($zipClass, false)) {
// throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled"); // throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled");
// } // }
@ -109,7 +100,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return ($mimeType === 'application/vnd.oasis.opendocument.spreadsheet'); return ($mimeType === 'application/vnd.oasis.opendocument.spreadsheet');
} }
return FALSE; return false;
} }
@ -144,11 +135,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
while ($xml->read()) { while ($xml->read()) {
// Quickly jump through to the office:body node // Quickly jump through to the office:body node
while ($xml->name !== 'office:body') { while ($xml->name !== 'office:body') {
if ($xml->isEmptyElement) if ($xml->isEmptyElement) {
$xml->read(); $xml->read();
else } else {
$xml->next(); $xml->next();
} }
}
// Now read each node until we find our first table:table node // Now read each node until we find our first table:table node
while ($xml->read()) { while ($xml->read()) {
if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) { if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) {
@ -164,7 +156,6 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $worksheetNames; return $worksheetNames;
} }
/** /**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
* *
@ -196,11 +187,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
while ($xml->read()) { while ($xml->read()) {
// Quickly jump through to the office:body node // Quickly jump through to the office:body node
while ($xml->name !== 'office:body') { while ($xml->name !== 'office:body') {
if ($xml->isEmptyElement) if ($xml->isEmptyElement) {
$xml->read(); $xml->read();
else } else {
$xml->next(); $xml->next();
} }
}
// Now read each node until we find our first table:table node // Now read each node until we find our first table:table node
while ($xml->read()) { while ($xml->read()) {
if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) { if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) {
@ -289,7 +281,6 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $worksheetInfo; return $worksheetInfo;
} }
/** /**
* Loads PHPExcel from file * Loads PHPExcel from file
* *
@ -306,8 +297,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $this->loadIntoExisting($pFilename, $objPHPExcel); return $this->loadIntoExisting($pFilename, $objPHPExcel);
} }
private static function identifyFixedStyleValue($styleList, &$styleAttributeValue)
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) { {
$styleAttributeValue = strtolower($styleAttributeValue); $styleAttributeValue = strtolower($styleAttributeValue);
foreach ($styleList as $style) { foreach ($styleList as $style) {
if ($styleAttributeValue == strtolower($style)) { if ($styleAttributeValue == strtolower($style)) {
@ -318,7 +309,6 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return false; return false;
} }
/** /**
* Loads PHPExcel from file into PHPExcel instance * Loads PHPExcel from file into PHPExcel instance
* *
@ -476,20 +466,17 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
} }
case 'table-row': case 'table-row':
$rowDataTableAttributes = $rowData->attributes($namespacesContent['table']); $rowDataTableAttributes = $rowData->attributes($namespacesContent['table']);
$rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? $rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? $rowDataTableAttributes['number-rows-repeated'] : 1;
$rowDataTableAttributes['number-rows-repeated'] : 1;
$columnID = 'A'; $columnID = 'A';
foreach ($rowData as $key => $cellData) { foreach ($rowData as $key => $cellData) {
if ($this->getReadFilter() !== NULL) { if ($this->getReadFilter() !== null) {
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
continue; continue;
} }
} }
// echo '<b>'.$columnID.$rowID.'</b><br />'; // echo '<b>'.$columnID.$rowID.'</b><br />';
$cellDataText = (isset($namespacesContent['text'])) ? $cellDataText = (isset($namespacesContent['text'])) ? $cellData->children($namespacesContent['text']) : '';
$cellData->children($namespacesContent['text']) :
'';
$cellDataOffice = $cellData->children($namespacesContent['office']); $cellDataOffice = $cellData->children($namespacesContent['office']);
$cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']); $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
$cellDataTableAttributes = $cellData->attributes($namespacesContent['table']); $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
@ -525,9 +512,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
} }
$text = implode("\n", $textArray); $text = implode("\n", $textArray);
// echo $text, '<br />'; // echo $text, '<br />';
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID ) $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setText($this->parseRichText($text));
// ->setAuthor( $author ) // ->setAuthor( $author )
->setText($this->_parseRichText($text) );
} }
if (isset($cellDataText->p)) { if (isset($cellDataText->p)) {
@ -564,7 +550,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
break; break;
case 'boolean': case 'boolean':
$type = PHPExcel_Cell_DataType::TYPE_BOOL; $type = PHPExcel_Cell_DataType::TYPE_BOOL;
$dataValue = ($allCellDataText == 'TRUE') ? True : False; $dataValue = ($allCellDataText == 'TRUE') ? true : false;
break; break;
case 'percentage': case 'percentage':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
@ -586,11 +572,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value']; $dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) { if (floor($dataValue) == $dataValue) {
if ($dataValue == (integer) $dataValue) if ($dataValue == (integer) $dataValue) {
$dataValue = (integer) $dataValue; $dataValue = (integer) $dataValue;
else } else {
$dataValue = (float) $dataValue; $dataValue = (float) $dataValue;
} }
}
break; break;
case 'date': case 'date':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
@ -611,12 +598,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
break; break;
} }
// echo 'Data value is '.$dataValue.'<br />'; // echo 'Data value is '.$dataValue.'<br />';
// if ($hyperlink !== NULL) { // if ($hyperlink !== null) {
// echo 'Hyperlink is '.$hyperlink.'<br />'; // echo 'Hyperlink is '.$hyperlink.'<br />';
// } // }
} else { } else {
$type = PHPExcel_Cell_DataType::TYPE_NULL; $type = PHPExcel_Cell_DataType::TYPE_NULL;
$dataValue = NULL; $dataValue = null;
} }
if ($hasCalculatedValue) { if ($hasCalculatedValue) {
@ -641,9 +628,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// echo 'Adjusted Formula: ', $cellDataFormula, PHP_EOL; // echo 'Adjusted Formula: ', $cellDataFormula, PHP_EOL;
} }
$colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ? $colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ? $cellDataTableAttributes['number-columns-repeated'] : 1;
$cellDataTableAttributes['number-columns-repeated'] : 1; if ($type !== null) {
if ($type !== NULL) {
for ($i = 0; $i < $colRepeats; ++$i) { for ($i = 0; $i < $colRepeats; ++$i) {
if ($i > 0) { if ($i > 0) {
++$columnID; ++$columnID;
@ -656,12 +642,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// echo 'Forumla result is '.$dataValue.'<br />'; // echo 'Forumla result is '.$dataValue.'<br />';
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue); $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue);
} }
if ($formatting !== NULL) { if ($formatting !== null) {
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting); $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting);
} else { } else {
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_GENERAL); $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_GENERAL);
} }
if ($hyperlink !== NULL) { if ($hyperlink !== null) {
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink); $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink);
} }
} }
@ -699,13 +685,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $objPHPExcel; return $objPHPExcel;
} }
private function parseRichText($is = '')
private function _parseRichText($is = '') { {
$value = new PHPExcel_RichText(); $value = new PHPExcel_RichText();
$value->createText($is); $value->createText($is);
return $value; return $value;
} }
} }

View File

@ -49,33 +49,34 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
* *
* @var string * @var string
*/ */
private $_inputEncoding = 'ANSI'; private $inputEncoding = 'ANSI';
/** /**
* Sheet index to read * Sheet index to read
* *
* @var int * @var int
*/ */
private $_sheetIndex = 0; private $sheetIndex = 0;
/** /**
* Formats * Formats
* *
* @var array * @var array
*/ */
private $_formats = array(); private $formats = array();
/** /**
* Format Count * Format Count
* *
* @var int * @var int
*/ */
private $_format = 0; private $format = 0;
/** /**
* Create a new PHPExcel_Reader_SYLK * Create a new PHPExcel_Reader_SYLK
*/ */
public function __construct() { public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
} }
@ -92,16 +93,16 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
// Count delimiters in file // Count delimiters in file
$delimiterCount = substr_count($data, ';'); $delimiterCount = substr_count($data, ';');
if ($delimiterCount < 1) { if ($delimiterCount < 1) {
return FALSE; return false;
} }
// Analyze first line looking for ID; signature // Analyze first line looking for ID; signature
$lines = explode("\n", $data); $lines = explode("\n", $data);
if (substr($lines[0], 0, 4) != 'ID;P') { if (substr($lines[0], 0, 4) != 'ID;P') {
return FALSE; return false;
} }
return TRUE; return true;
} }
/** /**
@ -111,7 +112,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
*/ */
public function setInputEncoding($pValue = 'ANSI') public function setInputEncoding($pValue = 'ANSI')
{ {
$this->_inputEncoding = $pValue; $this->inputEncoding = $pValue;
return $this; return $this;
} }
@ -122,7 +123,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
*/ */
public function getInputEncoding() public function getInputEncoding()
{ {
return $this->_inputEncoding; return $this->inputEncoding;
} }
/** /**
@ -154,7 +155,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
// loop through one row (line) at a time in the file // loop through one row (line) at a time in the file
$rowIndex = 0; $rowIndex = 0;
while (($rowData = fgets($fileHandle)) !== FALSE) { while (($rowData = fgets($fileHandle)) !== false) {
$columnIndex = 0; $columnIndex = 0;
// convert SYLK encoded $rowData to UTF-8 // convert SYLK encoded $rowData to UTF-8
@ -230,10 +231,10 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
rewind($fileHandle); rewind($fileHandle);
// Create new PHPExcel // Create new PHPExcel
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
$objPHPExcel->createSheet(); $objPHPExcel->createSheet();
} }
$objPHPExcel->setActiveSheetIndex( $this->_sheetIndex ); $objPHPExcel->setActiveSheetIndex($this->sheetIndex);
$fromFormats = array('\-', '\ '); $fromFormats = array('\-', '\ ');
$toFormats = array('-', ' '); $toFormats = array('-', ' ');
@ -243,8 +244,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
$column = $row = ''; $column = $row = '';
// loop through one row (line) at a time in the file // loop through one row (line) at a time in the file
while (($rowData = fgets($fileHandle)) !== FALSE) { while (($rowData = fgets($fileHandle)) !== false) {
// convert SYLK encoded $rowData to UTF-8 // convert SYLK encoded $rowData to UTF-8
$rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData); $rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
@ -258,34 +258,44 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
$formatArray = array(); $formatArray = array();
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) { switch ($rowDatum{0}) {
case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats,substr($rowDatum,1)); case 'P':
$formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
break; break;
case 'E': case 'E':
case 'F' : $formatArray['font']['name'] = substr($rowDatum,1); case 'F':
$formatArray['font']['name'] = substr($rowDatum, 1);
break; break;
case 'L' : $formatArray['font']['size'] = substr($rowDatum,1); case 'L':
$formatArray['font']['size'] = substr($rowDatum, 1);
break; break;
case 'S' : $styleSettings = substr($rowDatum,1); case 'S':
$styleSettings = substr($rowDatum, 1);
for ($i=0; $i<strlen($styleSettings); ++$i) { for ($i=0; $i<strlen($styleSettings); ++$i) {
switch ($styleSettings{$i}) { switch ($styleSettings{$i}) {
case 'I' : $formatArray['font']['italic'] = true; case 'I':
$formatArray['font']['italic'] = true;
break; break;
case 'D' : $formatArray['font']['bold'] = true; case 'D':
$formatArray['font']['bold'] = true;
break; break;
case 'T' : $formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN; case 'T':
$formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break; break;
case 'B' : $formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN; case 'B':
$formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break; break;
case 'L' : $formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN; case 'L':
$formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break; break;
case 'R' : $formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN; case 'R':
$formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break; break;
} }
} }
break; break;
} }
} }
$this->_formats['P'.$this->_format++] = $formatArray; $this->formats['P'.$this->format++] = $formatArray;
// Read cell value data // Read cell value data
} elseif ($dataType == 'C') { } elseif ($dataType == 'C') {
$hasCalculatedValue = false; $hasCalculatedValue = false;
@ -293,14 +303,18 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) { switch ($rowDatum{0}) {
case 'C': case 'C':
case 'X' : $column = substr($rowDatum,1); case 'X':
$column = substr($rowDatum, 1);
break; break;
case 'R': case 'R':
case 'Y' : $row = substr($rowDatum,1); case 'Y':
$row = substr($rowDatum, 1);
break; break;
case 'K' : $cellData = substr($rowDatum,1); case 'K':
$cellData = substr($rowDatum, 1);
break; break;
case 'E' : $cellDataFormula = '='.substr($rowDatum,1); case 'E':
$cellDataFormula = '='.substr($rowDatum, 1);
// Convert R1C1 style references to A1 style references (but only when not quoted) // Convert R1C1 style references to A1 style references (but only when not quoted)
$temp = explode('"', $cellDataFormula); $temp = explode('"', $cellDataFormula);
$key = false; $key = false;
@ -317,14 +331,22 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
foreach ($cellReferences as $cellReference) { foreach ($cellReferences as $cellReference) {
$rowReference = $cellReference[2][0]; $rowReference = $cellReference[2][0];
// Empty R reference is the current row // Empty R reference is the current row
if ($rowReference == '') $rowReference = $row; if ($rowReference == '') {
$rowReference = $row;
}
// Bracketed R references are relative to the current row // Bracketed R references are relative to the current row
if ($rowReference{0} == '[') $rowReference = $row + trim($rowReference,'[]'); if ($rowReference{0} == '[') {
$rowReference = $row + trim($rowReference, '[]');
}
$columnReference = $cellReference[4][0]; $columnReference = $cellReference[4][0];
// Empty C reference is the current column // Empty C reference is the current column
if ($columnReference == '') $columnReference = $column; if ($columnReference == '') {
$columnReference = $column;
}
// Bracketed C references are relative to the current column // Bracketed C references are relative to the current column
if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]'); if ($columnReference{0} == '[') {
$columnReference = $column + trim($columnReference, '[]');
}
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference; $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
$value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0])); $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
@ -339,12 +361,12 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
} }
} }
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
$cellData = PHPExcel_Calculation::_unwrapResult($cellData); $cellData = PHPExcel_Calculation::unwrapResult($cellData);
// Set cell value // Set cell value
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData); $objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData);
if ($hasCalculatedValue) { if ($hasCalculatedValue) {
$cellData = PHPExcel_Calculation::_unwrapResult($cellData); $cellData = PHPExcel_Calculation::unwrapResult($cellData);
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData); $objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData);
} }
// Read cell formatting // Read cell formatting
@ -354,29 +376,40 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) { switch ($rowDatum{0}) {
case 'C': case 'C':
case 'X' : $column = substr($rowDatum,1); case 'X':
$column = substr($rowDatum, 1);
break; break;
case 'R': case 'R':
case 'Y' : $row = substr($rowDatum,1); case 'Y':
$row = substr($rowDatum, 1);
break; break;
case 'P' : $formatStyle = $rowDatum; case 'P':
$formatStyle = $rowDatum;
break; break;
case 'W' : list($startCol, $endCol, $columnWidth) = explode(' ',substr($rowDatum,1)); case 'W':
list($startCol, $endCol, $columnWidth) = explode(' ', substr($rowDatum, 1));
break; break;
case 'S' : $styleSettings = substr($rowDatum,1); case 'S':
$styleSettings = substr($rowDatum, 1);
for ($i=0; $i<strlen($styleSettings); ++$i) { for ($i=0; $i<strlen($styleSettings); ++$i) {
switch ($styleSettings{$i}) { switch ($styleSettings{$i}) {
case 'I' : $styleData['font']['italic'] = true; case 'I':
$styleData['font']['italic'] = true;
break; break;
case 'D' : $styleData['font']['bold'] = true; case 'D':
$styleData['font']['bold'] = true;
break; break;
case 'T' : $styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN; case 'T':
$styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break; break;
case 'B' : $styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN; case 'B':
$styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break; break;
case 'L' : $styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN; case 'L':
$styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break; break;
case 'R' : $styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN; case 'R':
$styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break; break;
} }
} }
@ -385,8 +418,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
} }
if (($formatStyle > '') && ($column > '') && ($row > '')) { if (($formatStyle > '') && ($column > '') && ($row > '')) {
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
if (isset($this->_formats[$formatStyle])) { if (isset($this->formats[$formatStyle])) {
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]); $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->formats[$formatStyle]);
} }
} }
if ((!empty($styleData)) && ($column > '') && ($row > '')) { if ((!empty($styleData)) && ($column > '') && ($row > '')) {
@ -410,10 +443,12 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) { switch ($rowDatum{0}) {
case 'C': case 'C':
case 'X' : $column = substr($rowDatum,1); case 'X':
$column = substr($rowDatum, 1);
break; break;
case 'R': case 'R':
case 'Y' : $row = substr($rowDatum,1); case 'Y':
$row = substr($rowDatum, 1);
break; break;
} }
} }
@ -432,8 +467,9 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
* *
* @return int * @return int
*/ */
public function getSheetIndex() { public function getSheetIndex()
return $this->_sheetIndex; {
return $this->sheetIndex;
} }
/** /**
@ -442,9 +478,9 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
* @param int $pValue Sheet index * @param int $pValue Sheet index
* @return PHPExcel_Reader_SYLK * @return PHPExcel_Reader_SYLK
*/ */
public function setSheetIndex($pValue = 0) { public function setSheetIndex($pValue = 0)
$this->_sheetIndex = $pValue; {
$this->sheetIndex = $pValue;
return $this; return $this;
} }
} }

View File

@ -39,7 +39,7 @@ class PHPExcel_ReferenceHelper
* *
* @var PHPExcel_ReferenceHelper * @var PHPExcel_ReferenceHelper
*/ */
private static $_instance; private static $instance;
/** /**
* Get an instance of this class * Get an instance of this class
@ -48,11 +48,11 @@ class PHPExcel_ReferenceHelper
*/ */
public static function getInstance() public static function getInstance()
{ {
if (!isset(self::$_instance) || (self::$_instance === null)) { if (!isset(self::$instance) || (self::$instance === null)) {
self::$_instance = new PHPExcel_ReferenceHelper(); self::$instance = new PHPExcel_ReferenceHelper();
} }
return self::$_instance; return self::$instance;
} }
/** /**
@ -163,7 +163,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aBreaks = $pSheet->getBreaks(); $aBreaks = $pSheet->getBreaks();
($pNumCols > 0 || $pNumRows > 0) ? ($pNumCols > 0 || $pNumRows > 0) ?
@ -197,7 +197,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aComments = $pSheet->getComments(); $aComments = $pSheet->getComments();
$aNewComments = array(); // the new array of all comments $aNewComments = array(); // the new array of all comments
@ -224,7 +224,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aHyperlinkCollection = $pSheet->getHyperlinkCollection(); $aHyperlinkCollection = $pSheet->getHyperlinkCollection();
($pNumCols > 0 || $pNumRows > 0) ? uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort')); ($pNumCols > 0 || $pNumRows > 0) ? uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
@ -248,7 +248,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aDataValidationCollection = $pSheet->getDataValidationCollection(); $aDataValidationCollection = $pSheet->getDataValidationCollection();
($pNumCols > 0 || $pNumRows > 0) ? uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort')); ($pNumCols > 0 || $pNumRows > 0) ? uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
@ -272,7 +272,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aMergeCells = $pSheet->getMergeCells(); $aMergeCells = $pSheet->getMergeCells();
$aNewMergeCells = array(); // the new array of all merge cells $aNewMergeCells = array(); // the new array of all merge cells
@ -293,7 +293,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aProtectedCells = $pSheet->getProtectedCells(); $aProtectedCells = $pSheet->getProtectedCells();
($pNumCols > 0 || $pNumRows > 0) ? ($pNumCols > 0 || $pNumRows > 0) ?
@ -318,7 +318,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true); $aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true);
if (!empty($aColumnDimensions)) { if (!empty($aColumnDimensions)) {
@ -343,7 +343,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aRowDimensions = array_reverse($pSheet->getRowDimensions(), true); $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true);
if (!empty($aRowDimensions)) { if (!empty($aRowDimensions)) {
@ -513,28 +513,28 @@ class PHPExcel_ReferenceHelper
} }
// Update worksheet: column dimensions // Update worksheet: column dimensions
$this->_adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: row dimensions // Update worksheet: row dimensions
$this->_adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: page breaks // Update worksheet: page breaks
$this->_adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: comments // Update worksheet: comments
$this->_adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: hyperlinks // Update worksheet: hyperlinks
$this->_adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: data validations // Update worksheet: data validations
$this->_adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: merge cells // Update worksheet: merge cells
$this->_adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: protected cells // Update worksheet: protected cells
$this->_adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: autofilter // Update worksheet: autofilter
$autoFilter = $pSheet->getAutoFilter(); $autoFilter = $pSheet->getAutoFilter();
@ -785,10 +785,10 @@ class PHPExcel_ReferenceHelper
// Is it a range or a single cell? // Is it a range or a single cell?
} elseif (strpos($pCellRange, ':') === false && strpos($pCellRange, ',') === false) { } elseif (strpos($pCellRange, ':') === false && strpos($pCellRange, ',') === false) {
// Single cell // Single cell
return $this->_updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows); return $this->updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows);
} elseif (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) { } elseif (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
// Range // Range
return $this->_updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows); return $this->updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows);
} else { } else {
// Return original // Return original
return $pCellRange; return $pCellRange;
@ -833,7 +833,7 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell range * @return string Updated cell range
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) private function updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{ {
if (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) { if (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
// Update range // Update range
@ -843,13 +843,13 @@ class PHPExcel_ReferenceHelper
$jc = count($range[$i]); $jc = count($range[$i]);
for ($j = 0; $j < $jc; ++$j) { for ($j = 0; $j < $jc; ++$j) {
if (ctype_alpha($range[$i][$j])) { if (ctype_alpha($range[$i][$j])) {
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows)); $r = PHPExcel_Cell::coordinateFromString($this->updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows));
$range[$i][$j] = $r[0]; $range[$i][$j] = $r[0];
} elseif (ctype_digit($range[$i][$j])) { } elseif (ctype_digit($range[$i][$j])) {
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows)); $r = PHPExcel_Cell::coordinateFromString($this->updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows));
$range[$i][$j] = $r[1]; $range[$i][$j] = $r[1];
} else { } else {
$range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows); $range[$i][$j] = $this->updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
} }
} }
} }
@ -871,7 +871,7 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell reference * @return string Updated cell reference
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) private function updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{ {
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) { if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
// Get coordinates of $pBefore // Get coordinates of $pBefore

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher class PHPExcel_Shared_Escher
{ {
/** /**
@ -39,14 +32,14 @@ class PHPExcel_Shared_Escher
* *
* @var PHPExcel_Shared_Escher_DggContainer * @var PHPExcel_Shared_Escher_DggContainer
*/ */
private $_dggContainer; private $dggContainer;
/** /**
* Drawing Container * Drawing Container
* *
* @var PHPExcel_Shared_Escher_DgContainer * @var PHPExcel_Shared_Escher_DgContainer
*/ */
private $_dgContainer; private $dgContainer;
/** /**
* Get Drawing Group Container * Get Drawing Group Container
@ -55,7 +48,7 @@ class PHPExcel_Shared_Escher
*/ */
public function getDggContainer() public function getDggContainer()
{ {
return $this->_dggContainer; return $this->dggContainer;
} }
/** /**
@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher
*/ */
public function setDggContainer($dggContainer) public function setDggContainer($dggContainer)
{ {
return $this->_dggContainer = $dggContainer; return $this->dggContainer = $dggContainer;
} }
/** /**
@ -75,7 +68,7 @@ class PHPExcel_Shared_Escher
*/ */
public function getDgContainer() public function getDgContainer()
{ {
return $this->_dgContainer; return $this->dgContainer;
} }
/** /**
@ -85,6 +78,6 @@ class PHPExcel_Shared_Escher
*/ */
public function setDgContainer($dgContainer) public function setDgContainer($dgContainer)
{ {
return $this->_dgContainer = $dgContainer; return $this->dgContainer = $dgContainer;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DgContainer
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DgContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DgContainer class PHPExcel_Shared_Escher_DgContainer
{ {
/** /**
@ -39,44 +32,44 @@ class PHPExcel_Shared_Escher_DgContainer
* *
* @var int * @var int
*/ */
private $_dgId; private $dgId;
/** /**
* Last shape index in this drawing * Last shape index in this drawing
* *
* @var int * @var int
*/ */
private $_lastSpId; private $lastSpId;
private $_spgrContainer = null; private $spgrContainer = null;
public function getDgId() public function getDgId()
{ {
return $this->_dgId; return $this->dgId;
} }
public function setDgId($value) public function setDgId($value)
{ {
$this->_dgId = $value; $this->dgId = $value;
} }
public function getLastSpId() public function getLastSpId()
{ {
return $this->_lastSpId; return $this->lastSpId;
} }
public function setLastSpId($value) public function setLastSpId($value)
{ {
$this->_lastSpId = $value; $this->lastSpId = $value;
} }
public function getSpgrContainer() public function getSpgrContainer()
{ {
return $this->_spgrContainer; return $this->spgrContainer;
} }
public function setSpgrContainer($spgrContainer) public function setSpgrContainer($spgrContainer)
{ {
return $this->_spgrContainer = $spgrContainer; return $this->spgrContainer = $spgrContainer;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DgContainer_SpgrContainer
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
{ {
/** /**
@ -39,14 +32,14 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
* *
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
private $_parent; private $parent;
/** /**
* Shape Container collection * Shape Container collection
* *
* @var array * @var array
*/ */
private $_children = array(); private $children = array();
/** /**
* Set parent Shape Group Container * Set parent Shape Group Container
@ -55,7 +48,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
public function setParent($parent) public function setParent($parent)
{ {
$this->_parent = $parent; $this->parent = $parent;
} }
/** /**
@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
public function getParent() public function getParent()
{ {
return $this->_parent; return $this->parent;
} }
/** /**
@ -75,7 +68,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
public function addChild($child) public function addChild($child)
{ {
$this->_children[] = $child; $this->children[] = $child;
$child->setParent($this); $child->setParent($this);
} }
@ -84,7 +77,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
public function getChildren() public function getChildren()
{ {
return $this->_children; return $this->children;
} }
/** /**
@ -96,7 +89,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
{ {
$allSpContainers = array(); $allSpContainers = array();
foreach ($this->_children as $child) { foreach ($this->children as $child) {
if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) { if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) {
$allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers()); $allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers());
} else { } else {

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
{ {
/** /**
@ -39,84 +32,84 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
* *
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
private $_parent; private $parent;
/** /**
* Is this a group shape? * Is this a group shape?
* *
* @var boolean * @var boolean
*/ */
private $_spgr = false; private $spgr = false;
/** /**
* Shape type * Shape type
* *
* @var int * @var int
*/ */
private $_spType; private $spType;
/** /**
* Shape flag * Shape flag
* *
* @var int * @var int
*/ */
private $_spFlag; private $spFlag;
/** /**
* Shape index (usually group shape has index 0, and the rest: 1,2,3...) * Shape index (usually group shape has index 0, and the rest: 1,2,3...)
* *
* @var boolean * @var boolean
*/ */
private $_spId; private $spId;
/** /**
* Array of options * Array of options
* *
* @var array * @var array
*/ */
private $_OPT; private $OPT;
/** /**
* Cell coordinates of upper-left corner of shape, e.g. 'A1' * Cell coordinates of upper-left corner of shape, e.g. 'A1'
* *
* @var string * @var string
*/ */
private $_startCoordinates; private $startCoordinates;
/** /**
* Horizontal offset of upper-left corner of shape measured in 1/1024 of column width * Horizontal offset of upper-left corner of shape measured in 1/1024 of column width
* *
* @var int * @var int
*/ */
private $_startOffsetX; private $startOffsetX;
/** /**
* Vertical offset of upper-left corner of shape measured in 1/256 of row height * Vertical offset of upper-left corner of shape measured in 1/256 of row height
* *
* @var int * @var int
*/ */
private $_startOffsetY; private $startOffsetY;
/** /**
* Cell coordinates of bottom-right corner of shape, e.g. 'B2' * Cell coordinates of bottom-right corner of shape, e.g. 'B2'
* *
* @var string * @var string
*/ */
private $_endCoordinates; private $endCoordinates;
/** /**
* Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width * Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width
* *
* @var int * @var int
*/ */
private $_endOffsetX; private $endOffsetX;
/** /**
* Vertical offset of bottom-right corner of shape measured in 1/256 of row height * Vertical offset of bottom-right corner of shape measured in 1/256 of row height
* *
* @var int * @var int
*/ */
private $_endOffsetY; private $endOffsetY;
/** /**
* Set parent Shape Group Container * Set parent Shape Group Container
@ -125,7 +118,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setParent($parent) public function setParent($parent)
{ {
$this->_parent = $parent; $this->parent = $parent;
} }
/** /**
@ -135,7 +128,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getParent() public function getParent()
{ {
return $this->_parent; return $this->parent;
} }
/** /**
@ -145,7 +138,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setSpgr($value = false) public function setSpgr($value = false)
{ {
$this->_spgr = $value; $this->spgr = $value;
} }
/** /**
@ -155,7 +148,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getSpgr() public function getSpgr()
{ {
return $this->_spgr; return $this->spgr;
} }
/** /**
@ -165,7 +158,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setSpType($value) public function setSpType($value)
{ {
$this->_spType = $value; $this->spType = $value;
} }
/** /**
@ -175,7 +168,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getSpType() public function getSpType()
{ {
return $this->_spType; return $this->spType;
} }
/** /**
@ -185,7 +178,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setSpFlag($value) public function setSpFlag($value)
{ {
$this->_spFlag = $value; $this->spFlag = $value;
} }
/** /**
@ -195,7 +188,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getSpFlag() public function getSpFlag()
{ {
return $this->_spFlag; return $this->spFlag;
} }
/** /**
@ -205,7 +198,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setSpId($value) public function setSpId($value)
{ {
$this->_spId = $value; $this->spId = $value;
} }
/** /**
@ -215,7 +208,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getSpId() public function getSpId()
{ {
return $this->_spId; return $this->spId;
} }
/** /**
@ -226,7 +219,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setOPT($property, $value) public function setOPT($property, $value)
{ {
$this->_OPT[$property] = $value; $this->OPT[$property] = $value;
} }
/** /**
@ -237,8 +230,8 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getOPT($property) public function getOPT($property)
{ {
if (isset($this->_OPT[$property])) { if (isset($this->OPT[$property])) {
return $this->_OPT[$property]; return $this->OPT[$property];
} }
return null; return null;
} }
@ -250,7 +243,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getOPTCollection() public function getOPTCollection()
{ {
return $this->_OPT; return $this->OPT;
} }
/** /**
@ -260,7 +253,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setStartCoordinates($value = 'A1') public function setStartCoordinates($value = 'A1')
{ {
$this->_startCoordinates = $value; $this->startCoordinates = $value;
} }
/** /**
@ -270,7 +263,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getStartCoordinates() public function getStartCoordinates()
{ {
return $this->_startCoordinates; return $this->startCoordinates;
} }
/** /**
@ -280,7 +273,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setStartOffsetX($startOffsetX = 0) public function setStartOffsetX($startOffsetX = 0)
{ {
$this->_startOffsetX = $startOffsetX; $this->startOffsetX = $startOffsetX;
} }
/** /**
@ -290,7 +283,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getStartOffsetX() public function getStartOffsetX()
{ {
return $this->_startOffsetX; return $this->startOffsetX;
} }
/** /**
@ -300,7 +293,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setStartOffsetY($startOffsetY = 0) public function setStartOffsetY($startOffsetY = 0)
{ {
$this->_startOffsetY = $startOffsetY; $this->startOffsetY = $startOffsetY;
} }
/** /**
@ -310,7 +303,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getStartOffsetY() public function getStartOffsetY()
{ {
return $this->_startOffsetY; return $this->startOffsetY;
} }
/** /**
@ -320,7 +313,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setEndCoordinates($value = 'A1') public function setEndCoordinates($value = 'A1')
{ {
$this->_endCoordinates = $value; $this->endCoordinates = $value;
} }
/** /**
@ -330,7 +323,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getEndCoordinates() public function getEndCoordinates()
{ {
return $this->_endCoordinates; return $this->endCoordinates;
} }
/** /**
@ -340,7 +333,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setEndOffsetX($endOffsetX = 0) public function setEndOffsetX($endOffsetX = 0)
{ {
$this->_endOffsetX = $endOffsetX; $this->endOffsetX = $endOffsetX;
} }
/** /**
@ -350,7 +343,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getEndOffsetX() public function getEndOffsetX()
{ {
return $this->_endOffsetX; return $this->endOffsetX;
} }
/** /**
@ -360,7 +353,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setEndOffsetY($endOffsetY = 0) public function setEndOffsetY($endOffsetY = 0)
{ {
$this->_endOffsetY = $endOffsetY; $this->endOffsetY = $endOffsetY;
} }
/** /**
@ -370,7 +363,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getEndOffsetY() public function getEndOffsetY()
{ {
return $this->_endOffsetY; return $this->endOffsetY;
} }
/** /**

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DggContainer
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DggContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer class PHPExcel_Shared_Escher_DggContainer
{ {
/** /**
@ -39,42 +32,42 @@ class PHPExcel_Shared_Escher_DggContainer
* *
* @var int * @var int
*/ */
private $_spIdMax; private $spIdMax;
/** /**
* Total number of drawings saved * Total number of drawings saved
* *
* @var int * @var int
*/ */
private $_cDgSaved; private $cDgSaved;
/** /**
* Total number of shapes saved (including group shapes) * Total number of shapes saved (including group shapes)
* *
* @var int * @var int
*/ */
private $_cSpSaved; private $cSpSaved;
/** /**
* BLIP Store Container * BLIP Store Container
* *
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/ */
private $_bstoreContainer; private $bstoreContainer;
/** /**
* Array of options for the drawing group * Array of options for the drawing group
* *
* @var array * @var array
*/ */
private $_OPT = array(); private $OPT = array();
/** /**
* Array of identifier clusters containg information about the maximum shape identifiers * Array of identifier clusters containg information about the maximum shape identifiers
* *
* @var array * @var array
*/ */
private $_IDCLs = array(); private $IDCLs = array();
/** /**
* Get maximum shape index of all shapes in all drawings (plus one) * Get maximum shape index of all shapes in all drawings (plus one)
@ -83,7 +76,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getSpIdMax() public function getSpIdMax()
{ {
return $this->_spIdMax; return $this->spIdMax;
} }
/** /**
@ -93,7 +86,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setSpIdMax($value) public function setSpIdMax($value)
{ {
$this->_spIdMax = $value; $this->spIdMax = $value;
} }
/** /**
@ -103,7 +96,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getCDgSaved() public function getCDgSaved()
{ {
return $this->_cDgSaved; return $this->cDgSaved;
} }
/** /**
@ -113,7 +106,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setCDgSaved($value) public function setCDgSaved($value)
{ {
$this->_cDgSaved = $value; $this->cDgSaved = $value;
} }
/** /**
@ -123,7 +116,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getCSpSaved() public function getCSpSaved()
{ {
return $this->_cSpSaved; return $this->cSpSaved;
} }
/** /**
@ -133,7 +126,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setCSpSaved($value) public function setCSpSaved($value)
{ {
$this->_cSpSaved = $value; $this->cSpSaved = $value;
} }
/** /**
@ -143,7 +136,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getBstoreContainer() public function getBstoreContainer()
{ {
return $this->_bstoreContainer; return $this->bstoreContainer;
} }
/** /**
@ -153,7 +146,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setBstoreContainer($bstoreContainer) public function setBstoreContainer($bstoreContainer)
{ {
$this->_bstoreContainer = $bstoreContainer; $this->bstoreContainer = $bstoreContainer;
} }
/** /**
@ -164,7 +157,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setOPT($property, $value) public function setOPT($property, $value)
{ {
$this->_OPT[$property] = $value; $this->OPT[$property] = $value;
} }
/** /**
@ -175,8 +168,8 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getOPT($property) public function getOPT($property)
{ {
if (isset($this->_OPT[$property])) { if (isset($this->OPT[$property])) {
return $this->_OPT[$property]; return $this->OPT[$property];
} }
return null; return null;
} }
@ -188,7 +181,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getIDCLs() public function getIDCLs()
{ {
return $this->_IDCLs; return $this->IDCLs;
} }
/** /**
@ -198,6 +191,6 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setIDCLs($pValue) public function setIDCLs($pValue)
{ {
$this->_IDCLs = $pValue; $this->IDCLs = $pValue;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DggContainer_BstoreContainer
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
{ {
/** /**
@ -39,7 +32,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
* *
* @var array * @var array
*/ */
private $_BSECollection = array(); private $BSECollection = array();
/** /**
* Add a BLIP Store Entry * Add a BLIP Store Entry
@ -48,7 +41,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/ */
public function addBSE($BSE) public function addBSE($BSE)
{ {
$this->_BSECollection[] = $BSE; $this->BSECollection[] = $BSE;
$BSE->setParent($this); $BSE->setParent($this);
} }
@ -59,6 +52,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/ */
public function getBSECollection() public function getBSECollection()
{ {
return $this->_BSECollection; return $this->BSECollection;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
{ {
const BLIPTYPE_ERROR = 0x00; const BLIPTYPE_ERROR = 0x00;
@ -57,14 +50,14 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
* *
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/ */
private $_blip; private $blip;
/** /**
* The BLIP type * The BLIP type
* *
* @var int * @var int
*/ */
private $_blipType; private $blipType;
/** /**
* Set parent BLIP Store Entry Container * Set parent BLIP Store Entry Container
@ -83,7 +76,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/ */
public function getBlip() public function getBlip()
{ {
return $this->_blip; return $this->blip;
} }
/** /**
@ -93,7 +86,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/ */
public function setBlip($blip) public function setBlip($blip)
{ {
$this->_blip = $blip; $this->blip = $blip;
$blip->setParent($this); $blip->setParent($this);
} }
@ -104,7 +97,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/ */
public function getBlipType() public function getBlipType()
{ {
return $this->_blipType; return $this->blipType;
} }
/** /**
@ -114,6 +107,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/ */
public function setBlipType($blipType) public function setBlipType($blipType)
{ {
$this->_blipType = $blipType; $this->blipType = $blipType;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
{ {
/** /**
@ -39,14 +32,14 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
* *
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/ */
private $_parent; private $parent;
/** /**
* Raw image data * Raw image data
* *
* @var string * @var string
*/ */
private $_data; private $data;
/** /**
* Get the raw image data * Get the raw image data
@ -55,7 +48,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/ */
public function getData() public function getData()
{ {
return $this->_data; return $this->data;
} }
/** /**
@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/ */
public function setData($data) public function setData($data)
{ {
$this->_data = $data; $this->data = $data;
} }
/** /**
@ -75,7 +68,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/ */
public function setParent($parent) public function setParent($parent)
{ {
$this->_parent = $parent; $this->parent = $parent;
} }
/** /**
@ -85,6 +78,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/ */
public function getParent() public function getParent()
{ {
return $this->_parent; return $this->parent;
} }
} }

View File

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

View File

@ -39,7 +39,7 @@ class PHPExcel_Shared_Font
const AUTOSIZE_METHOD_APPROX = 'approx'; const AUTOSIZE_METHOD_APPROX = 'approx';
const AUTOSIZE_METHOD_EXACT = 'exact'; const AUTOSIZE_METHOD_EXACT = 'exact';
private static $_autoSizeMethods = array( private static $autoSizeMethods = array(
self::AUTOSIZE_METHOD_APPROX, self::AUTOSIZE_METHOD_APPROX,
self::AUTOSIZE_METHOD_EXACT, self::AUTOSIZE_METHOD_EXACT,
); );
@ -196,7 +196,7 @@ class PHPExcel_Shared_Font
*/ */
public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX) public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX)
{ {
if (!in_array($pValue, self::$_autoSizeMethods)) { if (!in_array($pValue, self::$autoSizeMethods)) {
return false; return false;
} }
self::$autoSizeMethod = $pValue; self::$autoSizeMethod = $pValue;

View File

@ -15,8 +15,8 @@
* @author Michael Bommarito * @author Michael Bommarito
* @version 1.2 * @version 1.2
*/ */
class CholeskyDecomposition { class CholeskyDecomposition
{
/** /**
* Decomposition storage * Decomposition storage
* @var array * @var array
@ -38,14 +38,14 @@ class CholeskyDecomposition {
*/ */
private $isspd = true; private $isspd = true;
/** /**
* CholeskyDecomposition * CholeskyDecomposition
* *
* Class constructor - decomposes symmetric positive definite matrix * Class constructor - decomposes symmetric positive definite matrix
* @param mixed Matrix square symmetric positive definite matrix * @param mixed Matrix square symmetric positive definite matrix
*/ */
public function __construct($A = null) { public function __construct($A = null)
{
if ($A instanceof Matrix) { if ($A instanceof Matrix) {
$this->L = $A->getArray(); $this->L = $A->getArray();
$this->m = $A->getRowDimension(); $this->m = $A->getRowDimension();
@ -77,35 +77,35 @@ class CholeskyDecomposition {
} }
} // function __construct() } // function __construct()
/** /**
* Is the matrix symmetric and positive definite? * Is the matrix symmetric and positive definite?
* *
* @return boolean * @return boolean
*/ */
public function isSPD() { public function isSPD()
{
return $this->isspd; return $this->isspd;
} // function isSPD() } // function isSPD()
/** /**
* getL * getL
* *
* Return triangular factor. * Return triangular factor.
* @return Matrix Lower triangular matrix * @return Matrix Lower triangular matrix
*/ */
public function getL() { public function getL()
{
return new Matrix($this->L); return new Matrix($this->L);
} // function getL() } // function getL()
/** /**
* Solve A*X = B * Solve A*X = B
* *
* @param $B Row-equal matrix * @param $B Row-equal matrix
* @return Matrix L * L' * X = B * @return Matrix L * L' * X = B
*/ */
public function solve($B = null) { public function solve($B = null)
{
if ($B instanceof Matrix) { if ($B instanceof Matrix) {
if ($B->getRowDimension() == $this->m) { if ($B->getRowDimension() == $this->m) {
if ($this->isspd) { if ($this->isspd) {
@ -145,5 +145,4 @@ class CholeskyDecomposition {
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException)); throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
} }
} // function solve() } // function solve()
}
} // class CholeskyDecomposition

View File

@ -21,8 +21,8 @@
* @license PHP v3.0 * @license PHP v3.0
* @version 1.1 * @version 1.1
*/ */
class EigenvalueDecomposition { class EigenvalueDecomposition
{
/** /**
* Row and column dimension (square matrix). * Row and column dimension (square matrix).
* @var int * @var int
@ -67,13 +67,13 @@ class EigenvalueDecomposition {
private $cdivr; private $cdivr;
private $cdivi; private $cdivi;
/** /**
* Symmetric Householder reduction to tridiagonal form. * Symmetric Householder reduction to tridiagonal form.
* *
* @access private * @access private
*/ */
private function tred2 () { private function tred2()
{
// This is derived from the Algol procedures tred2 by // This is derived from the Algol procedures tred2 by
// Bowdler, Martin, Reinsch, and Wilkinson, Handbook for // Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
// Auto. Comp., Vol.ii-Linear Algebra, and the corresponding // Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
@ -171,7 +171,6 @@ class EigenvalueDecomposition {
$this->e[0] = 0.0; $this->e[0] = 0.0;
} }
/** /**
* Symmetric tridiagonal QL algorithm. * Symmetric tridiagonal QL algorithm.
* *
@ -182,7 +181,8 @@ class EigenvalueDecomposition {
* *
* @access private * @access private
*/ */
private function tql2() { private function tql2()
{
for ($i = 1; $i < $this->n; ++$i) { for ($i = 1; $i < $this->n; ++$i) {
$this->e[$i-1] = $this->e[$i]; $this->e[$i-1] = $this->e[$i];
} }
@ -196,8 +196,9 @@ class EigenvalueDecomposition {
$tst1 = max($tst1, abs($this->d[$l]) + abs($this->e[$l])); $tst1 = max($tst1, abs($this->d[$l]) + abs($this->e[$l]));
$m = $l; $m = $l;
while ($m < $this->n) { while ($m < $this->n) {
if (abs($this->e[$m]) <= $eps * $tst1) if (abs($this->e[$m]) <= $eps * $tst1) {
break; break;
}
++$m; ++$m;
} }
// If m == l, $this->d[l] is an eigenvalue, // If m == l, $this->d[l] is an eigenvalue,
@ -211,14 +212,16 @@ class EigenvalueDecomposition {
$g = $this->d[$l]; $g = $this->d[$l];
$p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]); $p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]);
$r = hypo($p, 1.0); $r = hypo($p, 1.0);
if ($p < 0) if ($p < 0) {
$r *= -1; $r *= -1;
}
$this->d[$l] = $this->e[$l] / ($p + $r); $this->d[$l] = $this->e[$l] / ($p + $r);
$this->d[$l+1] = $this->e[$l] * ($p + $r); $this->d[$l+1] = $this->e[$l] * ($p + $r);
$dl1 = $this->d[$l+1]; $dl1 = $this->d[$l+1];
$h = $g - $this->d[$l]; $h = $g - $this->d[$l];
for ($i = $l + 2; $i < $this->n; ++$i) for ($i = $l + 2; $i < $this->n; ++$i) {
$this->d[$i] -= $h; $this->d[$i] -= $h;
}
$f += $h; $f += $h;
// Implicit QL transformation. // Implicit QL transformation.
$p = $this->d[$m]; $p = $this->d[$m];
@ -277,7 +280,6 @@ class EigenvalueDecomposition {
} }
} }
/** /**
* Nonsymmetric reduction to Hessenberg form. * Nonsymmetric reduction to Hessenberg form.
* *
@ -288,7 +290,8 @@ class EigenvalueDecomposition {
* *
* @access private * @access private
*/ */
private function orthes () { private function orthes()
{
$low = 0; $low = 0;
$high = $this->n-1; $high = $this->n-1;
@ -364,13 +367,13 @@ class EigenvalueDecomposition {
} }
} }
/** /**
* Performs complex division. * Performs complex division.
* *
* @access private * @access private
*/ */
private function cdiv($xr, $xi, $yr, $yi) { private function cdiv($xr, $xi, $yr, $yi)
{
if (abs($yr) > abs($yi)) { if (abs($yr) > abs($yi)) {
$r = $yi / $yr; $r = $yi / $yr;
$d = $yr + $r * $yi; $d = $yr + $r * $yi;
@ -384,7 +387,6 @@ class EigenvalueDecomposition {
} }
} }
/** /**
* Nonsymmetric reduction from Hessenberg to real Schur form. * Nonsymmetric reduction from Hessenberg to real Schur form.
* *
@ -395,7 +397,8 @@ class EigenvalueDecomposition {
* *
* @access private * @access private
*/ */
private function hqr2 () { private function hqr2()
{
// Initialize // Initialize
$nn = $this->n; $nn = $this->n;
$n = $nn - 1; $n = $nn - 1;
@ -408,7 +411,7 @@ class EigenvalueDecomposition {
$norm = 0.0; $norm = 0.0;
for ($i = 0; $i < $nn; ++$i) { for ($i = 0; $i < $nn; ++$i) {
if (($i < $low) OR ($i > $high)) { if (($i < $low) or ($i > $high)) {
$this->d[$i] = $this->H[$i][$i]; $this->d[$i] = $this->H[$i][$i];
$this->e[$i] = 0.0; $this->e[$i] = 0.0;
} }
@ -477,7 +480,7 @@ class EigenvalueDecomposition {
$this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z; $this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z;
} }
// Column modification // Column modification
for ($i = 0; $i <= n; ++$i) { for ($i = 0; $i <= $n; ++$i) {
$z = $this->H[$i][$n-1]; $z = $this->H[$i][$n-1];
$this->H[$i][$n-1] = $q * $z + $p * $this->H[$i][$n]; $this->H[$i][$n-1] = $q * $z + $p * $this->H[$i][$n];
$this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z; $this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z;
@ -771,7 +774,6 @@ class EigenvalueDecomposition {
} }
} // end hqr2 } // end hqr2
/** /**
* Constructor: Check for symmetry, then construct the eigenvalue decomposition * Constructor: Check for symmetry, then construct the eigenvalue decomposition
* *
@ -779,7 +781,8 @@ class EigenvalueDecomposition {
* @param A Square matrix * @param A Square matrix
* @return Structure to access D and V. * @return Structure to access D and V.
*/ */
public function __construct($Arg) { public function __construct($Arg)
{
$this->A = $Arg->getArray(); $this->A = $Arg->getArray();
$this->n = $Arg->getColumnDimension(); $this->n = $Arg->getColumnDimension();
@ -806,47 +809,47 @@ class EigenvalueDecomposition {
} }
} }
/** /**
* Return the eigenvector matrix * Return the eigenvector matrix
* *
* @access public * @access public
* @return V * @return V
*/ */
public function getV() { public function getV()
{
return new Matrix($this->V, $this->n, $this->n); return new Matrix($this->V, $this->n, $this->n);
} }
/** /**
* Return the real parts of the eigenvalues * Return the real parts of the eigenvalues
* *
* @access public * @access public
* @return real(diag(D)) * @return real(diag(D))
*/ */
public function getRealEigenvalues() { public function getRealEigenvalues()
{
return $this->d; return $this->d;
} }
/** /**
* Return the imaginary parts of the eigenvalues * Return the imaginary parts of the eigenvalues
* *
* @access public * @access public
* @return imag(diag(D)) * @return imag(diag(D))
*/ */
public function getImagEigenvalues() { public function getImagEigenvalues()
{
return $this->e; return $this->e;
} }
/** /**
* Return the block diagonal eigenvalue matrix * Return the block diagonal eigenvalue matrix
* *
* @access public * @access public
* @return D * @return D
*/ */
public function getD() { public function getD()
{
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
$D[$i] = array_fill(0, $this->n, 0.0); $D[$i] = array_fill(0, $this->n, 0.0);
$D[$i][$i] = $this->d[$i]; $D[$i][$i] = $this->d[$i];
@ -858,5 +861,4 @@ class EigenvalueDecomposition {
} }
return new Matrix($D); return new Matrix($D);
} }
}
} // class EigenvalueDecomposition

View File

@ -18,8 +18,8 @@
* @version 1.1 * @version 1.1
* @license PHP v3.0 * @license PHP v3.0
*/ */
class PHPExcel_Shared_JAMA_LUDecomposition { class PHPExcel_Shared_JAMA_LUDecomposition
{
const MatrixSingularException = "Can only perform operation on singular matrix."; const MatrixSingularException = "Can only perform operation on singular matrix.";
const MatrixSquareException = "Mismatched Row dimension"; const MatrixSquareException = "Mismatched Row dimension";
@ -53,14 +53,14 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
*/ */
private $piv = array(); private $piv = array();
/** /**
* LU Decomposition constructor. * LU Decomposition constructor.
* *
* @param $A Rectangular matrix * @param $A Rectangular matrix
* @return Structure to access L, U and piv. * @return Structure to access L, U and piv.
*/ */
public function __construct($A) { public function __construct($A)
{
if ($A instanceof PHPExcel_Shared_JAMA_Matrix) { if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
// Use a "left-looking", dot-product, Crout/Doolittle algorithm. // Use a "left-looking", dot-product, Crout/Doolittle algorithm.
$this->LU = $A->getArray(); $this->LU = $A->getArray();
@ -119,13 +119,13 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
} }
} // function __construct() } // function __construct()
/** /**
* Get lower triangular factor. * Get lower triangular factor.
* *
* @return array Lower triangular factor * @return array Lower triangular factor
*/ */
public function getL() { public function getL()
{
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i > $j) { if ($i > $j) {
@ -140,13 +140,13 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($L); return new PHPExcel_Shared_JAMA_Matrix($L);
} // function getL() } // function getL()
/** /**
* Get upper triangular factor. * Get upper triangular factor.
* *
* @return array Upper triangular factor * @return array Upper triangular factor
*/ */
public function getU() { public function getU()
{
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i <= $j) { if ($i <= $j) {
@ -159,33 +159,33 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($U); return new PHPExcel_Shared_JAMA_Matrix($U);
} // function getU() } // function getU()
/** /**
* Return pivot permutation vector. * Return pivot permutation vector.
* *
* @return array Pivot vector * @return array Pivot vector
*/ */
public function getPivot() { public function getPivot()
{
return $this->piv; return $this->piv;
} // function getPivot() } // function getPivot()
/** /**
* Alias for getPivot * Alias for getPivot
* *
* @see getPivot * @see getPivot
*/ */
public function getDoublePivot() { public function getDoublePivot()
{
return $this->getPivot(); return $this->getPivot();
} // function getDoublePivot() } // function getDoublePivot()
/** /**
* Is the matrix nonsingular? * Is the matrix nonsingular?
* *
* @return true if U, and hence A, is nonsingular. * @return true if U, and hence A, is nonsingular.
*/ */
public function isNonsingular() { public function isNonsingular()
{
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($this->LU[$j][$j] == 0) { if ($this->LU[$j][$j] == 0) {
return false; return false;
@ -194,13 +194,13 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
return true; return true;
} // function isNonsingular() } // function isNonsingular()
/** /**
* Count determinants * Count determinants
* *
* @return array d matrix deterninat * @return array d matrix deterninat
*/ */
public function det() { public function det()
{
if ($this->m == $this->n) { if ($this->m == $this->n) {
$d = $this->pivsign; $d = $this->pivsign;
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
@ -212,7 +212,6 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
} }
} // function det() } // function det()
/** /**
* Solve A*X = B * Solve A*X = B
* *
@ -221,7 +220,8 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
* @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree. * @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree.
* @PHPExcel_Calculation_Exception RuntimeException Matrix is singular. * @PHPExcel_Calculation_Exception RuntimeException Matrix is singular.
*/ */
public function solve($B) { public function solve($B)
{
if ($B->getRowDimension() == $this->m) { if ($B->getRowDimension() == $this->m) {
if ($this->isNonsingular()) { if ($this->isNonsingular()) {
// Copy right hand side with pivoting // Copy right hand side with pivoting
@ -254,5 +254,4 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
throw new PHPExcel_Calculation_Exception(self::MatrixSquareException); throw new PHPExcel_Calculation_Exception(self::MatrixSquareException);
} }
} // function solve() } // function solve()
}
} // class PHPExcel_Shared_JAMA_LUDecomposition

View File

@ -24,9 +24,8 @@ if (!defined('PHPEXCEL_ROOT')) {
* @license PHP v3.0 * @license PHP v3.0
* @see http://math.nist.gov/javanumerics/jama/ * @see http://math.nist.gov/javanumerics/jama/
*/ */
class PHPExcel_Shared_JAMA_Matrix { class PHPExcel_Shared_JAMA_Matrix
{
const PolymorphicArgumentException = "Invalid argument pattern for polymorphic function."; const PolymorphicArgumentException = "Invalid argument pattern for polymorphic function.";
const ArgumentTypeException = "Invalid argument type."; const ArgumentTypeException = "Invalid argument type.";
const ArgumentBoundsException = "Invalid argument range."; const ArgumentBoundsException = "Invalid argument range.";
@ -57,13 +56,13 @@ class PHPExcel_Shared_JAMA_Matrix {
*/ */
private $n; private $n;
/** /**
* Polymorphic constructor * Polymorphic constructor
* *
* As PHP has no support for polymorphic constructors, we hack our own sort of polymorphism using func_num_args, func_get_arg, and gettype. In essence, we're just implementing a simple RTTI filter and calling the appropriate constructor. * As PHP has no support for polymorphic constructors, we hack our own sort of polymorphism using func_num_args, func_get_arg, and gettype. In essence, we're just implementing a simple RTTI filter and calling the appropriate constructor.
*/ */
public function __construct() { public function __construct()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
@ -114,37 +113,36 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function __construct() } // function __construct()
/** /**
* getArray * getArray
* *
* @return array Matrix array * @return array Matrix array
*/ */
public function getArray() { public function getArray()
{
return $this->A; return $this->A;
} // function getArray() } // function getArray()
/** /**
* getRowDimension * getRowDimension
* *
* @return int Row dimension * @return int Row dimension
*/ */
public function getRowDimension() { public function getRowDimension()
{
return $this->m; return $this->m;
} // function getRowDimension() } // function getRowDimension()
/** /**
* getColumnDimension * getColumnDimension
* *
* @return int Column dimension * @return int Column dimension
*/ */
public function getColumnDimension() { public function getColumnDimension()
{
return $this->n; return $this->n;
} // function getColumnDimension() } // function getColumnDimension()
/** /**
* get * get
* *
@ -153,11 +151,11 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param int $j Column position * @param int $j Column position
* @return mixed Element (int/float/double) * @return mixed Element (int/float/double)
*/ */
public function get($i = null, $j = null) { public function get($i = null, $j = null)
{
return $this->A[$i][$j]; return $this->A[$i][$j];
} // function get() } // function get()
/** /**
* getMatrix * getMatrix
* *
@ -168,7 +166,8 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param int $jF Final column index * @param int $jF Final column index
* @return Matrix Submatrix * @return Matrix Submatrix
*/ */
public function getMatrix() { public function getMatrix()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
@ -177,8 +176,16 @@ class PHPExcel_Shared_JAMA_Matrix {
//A($i0...; $j0...) //A($i0...; $j0...)
case 'integer,integer': case 'integer,integer':
list($i0, $j0) = $args; list($i0, $j0) = $args;
if ($i0 >= 0) { $m = $this->m - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } if ($i0 >= 0) {
if ($j0 >= 0) { $n = $this->n - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $m = $this->m - $i0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if ($j0 >= 0) {
$n = $this->n - $j0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for ($i = $i0; $i < $this->m; ++$i) { for ($i = $i0; $i < $this->m; ++$i) {
for ($j = $j0; $j < $this->n; ++$j) { for ($j = $j0; $j < $this->n; ++$j) {
@ -190,8 +197,16 @@ class PHPExcel_Shared_JAMA_Matrix {
//A($i0...$iF; $j0...$jF) //A($i0...$iF; $j0...$jF)
case 'integer,integer,integer,integer': case 'integer,integer,integer,integer':
list($i0, $iF, $j0, $jF) = $args; list($i0, $iF, $j0, $jF) = $args;
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $m = $iF - $i0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) {
$n = $jF - $j0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m+1, $n+1); $R = new PHPExcel_Shared_JAMA_Matrix($m+1, $n+1);
for ($i = $i0; $i <= $iF; ++$i) { for ($i = $i0; $i <= $iF; ++$i) {
for ($j = $j0; $j <= $jF; ++$j) { for ($j = $j0; $j <= $jF; ++$j) {
@ -203,8 +218,16 @@ class PHPExcel_Shared_JAMA_Matrix {
//$R = array of row indices; $C = array of column indices //$R = array of row indices; $C = array of column indices
case 'array,array': case 'array,array':
list($RL, $CL) = $args; list($RL, $CL) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } if (count($RL) > 0) {
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $m = count($RL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (count($CL) > 0) {
$n = count($CL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for ($i = 0; $i < $m; ++$i) { for ($i = 0; $i < $m; ++$i) {
for ($j = 0; $j < $n; ++$j) { for ($j = 0; $j < $n; ++$j) {
@ -216,8 +239,16 @@ class PHPExcel_Shared_JAMA_Matrix {
//$RL = array of row indices; $CL = array of column indices //$RL = array of row indices; $CL = array of column indices
case 'array,array': case 'array,array':
list($RL, $CL) = $args; list($RL, $CL) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } if (count($RL) > 0) {
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $m = count($RL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (count($CL) > 0) {
$n = count($CL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for ($i = 0; $i < $m; ++$i) { for ($i = 0; $i < $m; ++$i) {
for ($j = 0; $j < $n; ++$j) { for ($j = 0; $j < $n; ++$j) {
@ -229,8 +260,16 @@ class PHPExcel_Shared_JAMA_Matrix {
//A($i0...$iF); $CL = array of column indices //A($i0...$iF); $CL = array of column indices
case 'integer,integer,array': case 'integer,integer,array':
list($i0, $iF, $CL) = $args; list($i0, $iF, $CL) = $args;
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $m = $iF - $i0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (count($CL) > 0) {
$n = count($CL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for ($i = $i0; $i < $iF; ++$i) { for ($i = $i0; $i < $iF; ++$i) {
for ($j = 0; $j < $n; ++$j) { for ($j = 0; $j < $n; ++$j) {
@ -242,8 +281,16 @@ class PHPExcel_Shared_JAMA_Matrix {
//$RL = array of row indices //$RL = array of row indices
case 'array,integer,integer': case 'array,integer,integer':
list($RL, $j0, $jF) = $args; list($RL, $j0, $jF) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } if (count($RL) > 0) {
if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $m = count($RL);
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) {
$n = $jF - $j0;
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n+1); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n+1);
for ($i = 0; $i < $m; ++$i) { for ($i = 0; $i < $m; ++$i) {
for ($j = $j0; $j <= $jF; ++$j) { for ($j = $j0; $j <= $jF; ++$j) {
@ -261,7 +308,6 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function getMatrix() } // function getMatrix()
/** /**
* checkMatrixDimensions * checkMatrixDimensions
* *
@ -269,7 +315,8 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param Matrix $B Matrix B * @param Matrix $B Matrix B
* @return boolean * @return boolean
*/ */
public function checkMatrixDimensions($B = null) { public function checkMatrixDimensions($B = null)
{
if ($B instanceof PHPExcel_Shared_JAMA_Matrix) { if ($B instanceof PHPExcel_Shared_JAMA_Matrix) {
if (($this->m == $B->getRowDimension()) && ($this->n == $B->getColumnDimension())) { if (($this->m == $B->getRowDimension()) && ($this->n == $B->getColumnDimension())) {
return true; return true;
@ -281,8 +328,6 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function checkMatrixDimensions() } // function checkMatrixDimensions()
/** /**
* set * set
* *
@ -292,12 +337,12 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $c Int/float/double value * @param mixed $c Int/float/double value
* @return mixed Element (int/float/double) * @return mixed Element (int/float/double)
*/ */
public function set($i = null, $j = null, $c = null) { public function set($i = null, $j = null, $c = null)
{
// Optimized set version just has this // Optimized set version just has this
$this->A[$i][$j] = $c; $this->A[$i][$j] = $c;
} // function set() } // function set()
/** /**
* identity * identity
* *
@ -306,11 +351,11 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param int $n Column dimension * @param int $n Column dimension
* @return Matrix Identity matrix * @return Matrix Identity matrix
*/ */
public function identity($m = null, $n = null) { public function identity($m = null, $n = null)
{
return $this->diagonal($m, $n, 1); return $this->diagonal($m, $n, 1);
} // function identity() } // function identity()
/** /**
* diagonal * diagonal
* *
@ -320,7 +365,8 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $c Diagonal value * @param mixed $c Diagonal value
* @return Matrix Diagonal matrix * @return Matrix Diagonal matrix
*/ */
public function diagonal($m = null, $n = null, $c = 1) { public function diagonal($m = null, $n = null, $c = 1)
{
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for ($i = 0; $i < $m; ++$i) { for ($i = 0; $i < $m; ++$i) {
$R->set($i, $i, $c); $R->set($i, $i, $c);
@ -328,7 +374,6 @@ class PHPExcel_Shared_JAMA_Matrix {
return $R; return $R;
} // function diagonal() } // function diagonal()
/** /**
* getMatrixByRow * getMatrixByRow
* *
@ -337,7 +382,8 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param int $iF Final row index * @param int $iF Final row index
* @return Matrix Submatrix * @return Matrix Submatrix
*/ */
public function getMatrixByRow($i0 = null, $iF = null) { public function getMatrixByRow($i0 = null, $iF = null)
{
if (is_int($i0)) { if (is_int($i0)) {
if (is_int($iF)) { if (is_int($iF)) {
return $this->getMatrix($i0, 0, $iF + 1, $this->n); return $this->getMatrix($i0, 0, $iF + 1, $this->n);
@ -349,7 +395,6 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function getMatrixByRow() } // function getMatrixByRow()
/** /**
* getMatrixByCol * getMatrixByCol
* *
@ -358,7 +403,8 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param int $iF Final column index * @param int $iF Final column index
* @return Matrix Submatrix * @return Matrix Submatrix
*/ */
public function getMatrixByCol($j0 = null, $jF = null) { public function getMatrixByCol($j0 = null, $jF = null)
{
if (is_int($j0)) { if (is_int($j0)) {
if (is_int($jF)) { if (is_int($jF)) {
return $this->getMatrix(0, $j0, $this->m, $jF + 1); return $this->getMatrix(0, $j0, $this->m, $jF + 1);
@ -370,14 +416,14 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function getMatrixByCol() } // function getMatrixByCol()
/** /**
* transpose * transpose
* *
* Tranpose matrix * Tranpose matrix
* @return Matrix Transposed matrix * @return Matrix Transposed matrix
*/ */
public function transpose() { public function transpose()
{
$R = new PHPExcel_Shared_JAMA_Matrix($this->n, $this->m); $R = new PHPExcel_Shared_JAMA_Matrix($this->n, $this->m);
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
@ -387,14 +433,14 @@ class PHPExcel_Shared_JAMA_Matrix {
return $R; return $R;
} // function transpose() } // function transpose()
/** /**
* trace * trace
* *
* Sum of diagonal elements * Sum of diagonal elements
* @return float Sum of diagonal elements * @return float Sum of diagonal elements
*/ */
public function trace() { public function trace()
{
$s = 0; $s = 0;
$n = min($this->m, $this->n); $n = min($this->m, $this->n);
for ($i = 0; $i < $n; ++$i) { for ($i = 0; $i < $n; ++$i) {
@ -403,17 +449,16 @@ class PHPExcel_Shared_JAMA_Matrix {
return $s; return $s;
} // function trace() } // function trace()
/** /**
* uminus * uminus
* *
* Unary minus matrix -A * Unary minus matrix -A
* @return Matrix Unary minus matrix * @return Matrix Unary minus matrix
*/ */
public function uminus() { public function uminus()
{
} // function uminus() } // function uminus()
/** /**
* plus * plus
* *
@ -421,14 +466,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array * @param mixed $B Matrix/Array
* @return Matrix Sum * @return Matrix Sum
*/ */
public function plus() { public function plus()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break; break;
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -449,7 +499,6 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function plus() } // function plus()
/** /**
* plusEquals * plusEquals
* *
@ -457,14 +506,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array * @param mixed $B Matrix/Array
* @return Matrix Sum * @return Matrix Sum
*/ */
public function plusEquals() { public function plusEquals()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break; break;
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -476,7 +530,7 @@ class PHPExcel_Shared_JAMA_Matrix {
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$validValues = True; $validValues = true;
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
$this->A[$i][$j] = trim($this->A[$i][$j], '"'); $this->A[$i][$j] = trim($this->A[$i][$j], '"');
@ -499,7 +553,6 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function plusEquals() } // function plusEquals()
/** /**
* minus * minus
* *
@ -507,14 +560,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array * @param mixed $B Matrix/Array
* @return Matrix Sum * @return Matrix Sum
*/ */
public function minus() { public function minus()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break; break;
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -535,7 +593,6 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function minus() } // function minus()
/** /**
* minusEquals * minusEquals
* *
@ -543,14 +600,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array * @param mixed $B Matrix/Array
* @return Matrix Sum * @return Matrix Sum
*/ */
public function minusEquals() { public function minusEquals()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break; break;
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -562,7 +624,7 @@ class PHPExcel_Shared_JAMA_Matrix {
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$validValues = True; $validValues = true;
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
$this->A[$i][$j] = trim($this->A[$i][$j], '"'); $this->A[$i][$j] = trim($this->A[$i][$j], '"');
@ -585,7 +647,6 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function minusEquals() } // function minusEquals()
/** /**
* arrayTimes * arrayTimes
* *
@ -594,14 +655,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array * @param mixed $B Matrix/Array
* @return Matrix Matrix Cij * @return Matrix Matrix Cij
*/ */
public function arrayTimes() { public function arrayTimes()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break; break;
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -622,7 +688,6 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function arrayTimes() } // function arrayTimes()
/** /**
* arrayTimesEquals * arrayTimesEquals
* *
@ -631,14 +696,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array * @param mixed $B Matrix/Array
* @return Matrix Matrix Aij * @return Matrix Matrix Aij
*/ */
public function arrayTimesEquals() { public function arrayTimesEquals()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break; break;
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -650,7 +720,7 @@ class PHPExcel_Shared_JAMA_Matrix {
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$validValues = True; $validValues = true;
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
$this->A[$i][$j] = trim($this->A[$i][$j], '"'); $this->A[$i][$j] = trim($this->A[$i][$j], '"');
@ -673,7 +743,6 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function arrayTimesEquals() } // function arrayTimesEquals()
/** /**
* arrayRightDivide * arrayRightDivide
* *
@ -682,14 +751,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param Matrix $B Matrix B * @param Matrix $B Matrix B
* @return Matrix Division result * @return Matrix Division result
*/ */
public function arrayRightDivide() { public function arrayRightDivide()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break; break;
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -701,7 +775,7 @@ class PHPExcel_Shared_JAMA_Matrix {
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$validValues = True; $validValues = true;
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
$this->A[$i][$j] = trim($this->A[$i][$j], '"'); $this->A[$i][$j] = trim($this->A[$i][$j], '"');
@ -738,14 +812,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array * @param mixed $B Matrix/Array
* @return Matrix Matrix Aij * @return Matrix Matrix Aij
*/ */
public function arrayRightDivideEquals() { public function arrayRightDivideEquals()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break; break;
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -775,14 +854,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param Matrix $B Matrix B * @param Matrix $B Matrix B
* @return Matrix Division result * @return Matrix Division result
*/ */
public function arrayLeftDivide() { public function arrayLeftDivide()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break; break;
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -812,14 +896,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array * @param mixed $B Matrix/Array
* @return Matrix Matrix Aij * @return Matrix Matrix Aij
*/ */
public function arrayLeftDivideEquals() { public function arrayLeftDivideEquals()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break; break;
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -848,14 +937,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $n Matrix/Array/Scalar * @param mixed $n Matrix/Array/Scalar
* @return Matrix Product * @return Matrix Product
*/ */
public function times() { public function times()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $B = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$B = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
if ($this->n == $B->m) { if ($this->n == $B->m) {
$C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n); $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n);
for ($j = 0; $j < $B->n; ++$j) { for ($j = 0; $j < $B->n; ++$j) {
@ -931,7 +1025,6 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function times() } // function times()
/** /**
* power * power
* *
@ -939,14 +1032,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array * @param mixed $B Matrix/Array
* @return Matrix Sum * @return Matrix Sum
*/ */
public function power() { public function power()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
break; break;
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
@ -958,7 +1056,7 @@ class PHPExcel_Shared_JAMA_Matrix {
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$validValues = True; $validValues = true;
$value = $M->get($i, $j); $value = $M->get($i, $j);
if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
$this->A[$i][$j] = trim($this->A[$i][$j], '"'); $this->A[$i][$j] = trim($this->A[$i][$j], '"');
@ -981,7 +1079,6 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function power() } // function power()
/** /**
* concat * concat
* *
@ -989,14 +1086,19 @@ class PHPExcel_Shared_JAMA_Matrix {
* @param mixed $B Matrix/Array * @param mixed $B Matrix/Array
* @return Matrix Sum * @return Matrix Sum
*/ */
public function concat() { public function concat()
{
if (func_num_args() > 0) { if (func_num_args() > 0) {
$args = func_get_args(); $args = func_get_args();
$match = implode(",", array_map('gettype', $args)); $match = implode(",", array_map('gettype', $args));
switch ($match) { switch ($match) {
case 'object': case 'object':
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
$M = $args[0];
} else {
throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
}
case 'array': case 'array':
$M = new PHPExcel_Shared_JAMA_Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
@ -1016,14 +1118,14 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function concat() } // function concat()
/** /**
* Solve A*X = B. * Solve A*X = B.
* *
* @param Matrix $B Right hand side * @param Matrix $B Right hand side
* @return Matrix ... Solution if A is square, least squares solution otherwise * @return Matrix ... Solution if A is square, least squares solution otherwise
*/ */
public function solve($B) { public function solve($B)
{
if ($this->m == $this->n) { if ($this->m == $this->n) {
$LU = new PHPExcel_Shared_JAMA_LUDecomposition($this); $LU = new PHPExcel_Shared_JAMA_LUDecomposition($this);
return $LU->solve($B); return $LU->solve($B);
@ -1033,24 +1135,24 @@ class PHPExcel_Shared_JAMA_Matrix {
} }
} // function solve() } // function solve()
/** /**
* Matrix inverse or pseudoinverse. * Matrix inverse or pseudoinverse.
* *
* @return Matrix ... Inverse(A) if A is square, pseudoinverse otherwise. * @return Matrix ... Inverse(A) if A is square, pseudoinverse otherwise.
*/ */
public function inverse() { public function inverse()
{
return $this->solve($this->identity($this->m, $this->m)); return $this->solve($this->identity($this->m, $this->m));
} // function inverse() } // function inverse()
/** /**
* det * det
* *
* Calculate determinant * Calculate determinant
* @return float Determinant * @return float Determinant
*/ */
public function det() { public function det()
{
$L = new PHPExcel_Shared_JAMA_LUDecomposition($this); $L = new PHPExcel_Shared_JAMA_LUDecomposition($this);
return $L->det(); return $L->det();
} // function det() } // function det()

View File

@ -16,8 +16,8 @@
* @license PHP v3.0 * @license PHP v3.0
* @version 1.1 * @version 1.1
*/ */
class PHPExcel_Shared_JAMA_QRDecomposition { class PHPExcel_Shared_JAMA_QRDecomposition
{
const MatrixRankException = "Can only perform operation on full-rank matrix."; const MatrixRankException = "Can only perform operation on full-rank matrix.";
/** /**
@ -51,7 +51,8 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
* @param matrix $A Rectangular matrix * @param matrix $A Rectangular matrix
* @return Structure to access R and the Householder vectors and compute Q. * @return Structure to access R and the Householder vectors and compute Q.
*/ */
public function __construct($A) { public function __construct($A)
{
if ($A instanceof PHPExcel_Shared_JAMA_Matrix) { if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
// Initialize. // Initialize.
$this->QR = $A->getArrayCopy(); $this->QR = $A->getArrayCopy();
@ -98,7 +99,8 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
* *
* @return boolean true if R, and hence A, has full rank, else false. * @return boolean true if R, and hence A, has full rank, else false.
*/ */
public function isFullRank() { public function isFullRank()
{
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($this->Rdiag[$j] == 0) { if ($this->Rdiag[$j] == 0) {
return false; return false;
@ -107,13 +109,13 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return true; return true;
} // function isFullRank() } // function isFullRank()
/** /**
* Return the Householder vectors * Return the Householder vectors
* *
* @return Matrix Lower trapezoidal matrix whose columns define the reflections * @return Matrix Lower trapezoidal matrix whose columns define the reflections
*/ */
public function getH() { public function getH()
{
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i >= $j) { if ($i >= $j) {
@ -126,13 +128,13 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($H); return new PHPExcel_Shared_JAMA_Matrix($H);
} // function getH() } // function getH()
/** /**
* Return the upper triangular factor * Return the upper triangular factor
* *
* @return Matrix upper triangular factor * @return Matrix upper triangular factor
*/ */
public function getR() { public function getR()
{
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i < $j) { if ($i < $j) {
@ -147,13 +149,13 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($R); return new PHPExcel_Shared_JAMA_Matrix($R);
} // function getR() } // function getR()
/** /**
* Generate and return the (economy-sized) orthogonal factor * Generate and return the (economy-sized) orthogonal factor
* *
* @return Matrix orthogonal factor * @return Matrix orthogonal factor
*/ */
public function getQ() { public function getQ()
{
for ($k = $this->n-1; $k >= 0; --$k) { for ($k = $this->n-1; $k >= 0; --$k) {
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
$Q[$i][$k] = 0.0; $Q[$i][$k] = 0.0;
@ -184,14 +186,14 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($Q); return new PHPExcel_Shared_JAMA_Matrix($Q);
} // function getQ() } // function getQ()
/** /**
* Least squares solution of A*X = B * Least squares solution of A*X = B
* *
* @param Matrix $B A Matrix with as many rows as A and any number of columns. * @param Matrix $B A Matrix with as many rows as A and any number of columns.
* @return Matrix Matrix that minimizes the two norm of Q*R*X-B. * @return Matrix Matrix that minimizes the two norm of Q*R*X-B.
*/ */
public function solve($B) { public function solve($B)
{
if ($B->getRowDimension() == $this->m) { if ($B->getRowDimension() == $this->m) {
if ($this->isFullRank()) { if ($this->isFullRank()) {
// Copy right hand side // Copy right hand side
@ -230,5 +232,4 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException); throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
} }
} // function solve() } // function solve()
}
} // PHPExcel_Shared_JAMA_class QRDecomposition

View File

@ -17,8 +17,8 @@
* @license PHP v3.0 * @license PHP v3.0
* @version 1.1 * @version 1.1
*/ */
class SingularValueDecomposition { class SingularValueDecomposition
{
/** /**
* Internal storage of U. * Internal storage of U.
* @var array * @var array
@ -49,7 +49,6 @@ class SingularValueDecomposition {
*/ */
private $n; private $n;
/** /**
* Construct the singular value decomposition * Construct the singular value decomposition
* *
@ -58,8 +57,8 @@ class SingularValueDecomposition {
* @param $A Rectangular matrix * @param $A Rectangular matrix
* @return Structure to access U, S and V. * @return Structure to access U, S and V.
*/ */
public function __construct($Arg) { public function __construct($Arg)
{
// Initialize. // Initialize.
$A = $Arg->getArrayCopy(); $A = $Arg->getArrayCopy();
$this->m = $Arg->getRowDimension(); $this->m = $Arg->getRowDimension();
@ -75,7 +74,6 @@ class SingularValueDecomposition {
// Reduce A to bidiagonal form, storing the diagonal elements // Reduce A to bidiagonal form, storing the diagonal elements
// in s and the super-diagonal elements in e. // in s and the super-diagonal elements in e.
for ($k = 0; $k < max($nct, $nrt); ++$k) { for ($k = 0; $k < max($nct, $nrt); ++$k) {
if ($k < $nct) { if ($k < $nct) {
// Compute the transformation for the k-th column and // Compute the transformation for the k-th column and
// place the k-th diagonal in s[$k]. // place the k-th diagonal in s[$k].
@ -113,7 +111,7 @@ class SingularValueDecomposition {
} }
} }
if ($wantu AND ($k < $nct)) { if ($wantu and ($k < $nct)) {
// Place the transformation in U for subsequent back // Place the transformation in U for subsequent back
// multiplication. // multiplication.
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
@ -139,7 +137,7 @@ class SingularValueDecomposition {
$e[$k+1] += 1.0; $e[$k+1] += 1.0;
} }
$e[$k] = -$e[$k]; $e[$k] = -$e[$k];
if (($k+1 < $this->m) AND ($e[$k] != 0.0)) { if (($k+1 < $this->m) and ($e[$k] != 0.0)) {
// Apply the transformation. // Apply the transformation.
for ($i = $k+1; $i < $this->m; ++$i) { for ($i = $k+1; $i < $this->m; ++$i) {
$work[$i] = 0.0; $work[$i] = 0.0;
@ -217,7 +215,7 @@ class SingularValueDecomposition {
// If required, generate V. // If required, generate V.
if ($wantv) { if ($wantv) {
for ($k = $this->n - 1; $k >= 0; --$k) { for ($k = $this->n - 1; $k >= 0; --$k) {
if (($k < $nrt) AND ($e[$k] != 0.0)) { if (($k < $nrt) and ($e[$k] != 0.0)) {
for ($j = $k + 1; $j < $nu; ++$j) { for ($j = $k + 1; $j < $nu; ++$j) {
$t = 0; $t = 0;
for ($i = $k + 1; $i < $this->n; ++$i) { for ($i = $k + 1; $i < $this->n; ++$i) {
@ -331,9 +329,7 @@ class SingularValueDecomposition {
// Perform one qr step. // Perform one qr step.
case 3: case 3:
// Calculate the shift. // Calculate the shift.
$scale = max(max(max(max( $scale = max(max(max(max(abs($this->s[$p-1]), abs($this->s[$p-2])), abs($e[$p-2])), abs($this->s[$k])), abs($e[$k]));
abs($this->s[$p-1]),abs($this->s[$p-2])),abs($e[$p-2])),
abs($this->s[$k])), abs($e[$k]));
$sp = $this->s[$p-1] / $scale; $sp = $this->s[$p-1] / $scale;
$spm1 = $this->s[$p-2] / $scale; $spm1 = $this->s[$p-2] / $scale;
$epm1 = $e[$p-2] / $scale; $epm1 = $e[$p-2] / $scale;
@ -408,14 +404,14 @@ class SingularValueDecomposition {
$t = $this->s[$k]; $t = $this->s[$k];
$this->s[$k] = $this->s[$k+1]; $this->s[$k] = $this->s[$k+1];
$this->s[$k+1] = $t; $this->s[$k+1] = $t;
if ($wantv AND ($k < $this->n - 1)) { if ($wantv and ($k < $this->n - 1)) {
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
$t = $this->V[$i][$k+1]; $t = $this->V[$i][$k+1];
$this->V[$i][$k+1] = $this->V[$i][$k]; $this->V[$i][$k+1] = $this->V[$i][$k];
$this->V[$i][$k] = $t; $this->V[$i][$k] = $t;
} }
} }
if ($wantu AND ($k < $this->m-1)) { if ($wantu and ($k < $this->m-1)) {
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
$t = $this->U[$i][$k+1]; $t = $this->U[$i][$k+1];
$this->U[$i][$k+1] = $this->U[$i][$k]; $this->U[$i][$k+1] = $this->U[$i][$k];
@ -439,7 +435,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return U * @return U
*/ */
public function getU() { public function getU()
{
return new Matrix($this->U, $this->m, min($this->m + 1, $this->n)); return new Matrix($this->U, $this->m, min($this->m + 1, $this->n));
} }
@ -450,7 +447,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return V * @return V
*/ */
public function getV() { public function getV()
{
return new Matrix($this->V); return new Matrix($this->V);
} }
@ -461,7 +459,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return diagonal of S. * @return diagonal of S.
*/ */
public function getSingularValues() { public function getSingularValues()
{
return $this->s; return $this->s;
} }
@ -472,7 +471,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return S * @return S
*/ */
public function getS() { public function getS()
{
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$S[$i][$j] = 0.0; $S[$i][$j] = 0.0;
@ -489,7 +489,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return max(S) * @return max(S)
*/ */
public function norm2() { public function norm2()
{
return $this->s[0]; return $this->s[0];
} }
@ -500,7 +501,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return max(S)/min(S) * @return max(S)/min(S)
*/ */
public function cond() { public function cond()
{
return $this->s[0] / $this->s[min($this->m, $this->n) - 1]; return $this->s[0] / $this->s[min($this->m, $this->n) - 1];
} }
@ -511,7 +513,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return Number of nonnegligible singular values. * @return Number of nonnegligible singular values.
*/ */
public function rank() { public function rank()
{
$eps = pow(2.0, -52.0); $eps = pow(2.0, -52.0);
$tol = max($this->m, $this->n) * $this->s[0] * $eps; $tol = max($this->m, $this->n) * $this->s[0] * $eps;
$r = 0; $r = 0;
@ -522,5 +525,4 @@ class SingularValueDecomposition {
} }
return $r; return $r;
} }
}
} // class SingularValueDecomposition

View File

@ -67,7 +67,8 @@ $error['EN'][RowLengthException] = "All rows must have the same length.";
* Custom error handler * Custom error handler
* @param int $num Error number * @param int $num Error number
*/ */
function JAMAError($errorNumber = null) { function JAMAError($errorNumber = null)
{
global $error; global $error;
if (isset($errorNumber)) { if (isset($errorNumber)) {

View File

@ -11,7 +11,8 @@
* *
* r = sqrt(a^2 + b^2) without under/overflow. * r = sqrt(a^2 + b^2) without under/overflow.
*/ */
function hypo($a, $b) { function hypo($a, $b)
{
if (abs($a) > abs($b)) { if (abs($a) > abs($b)) {
$r = $b / $a; $r = $b / $a;
$r = abs($a) * sqrt(1 + $r * $r); $r = abs($a) * sqrt(1 + $r * $r);

View File

@ -73,8 +73,9 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
if (is_resource($filename)) { if (is_resource($filename)) {
$this->_FILEH_ = $filename; $this->_FILEH_ = $filename;
} elseif ($filename == '-' || $filename == '') { } elseif ($filename == '-' || $filename == '') {
if ($this->_tmp_dir === null) if ($this->_tmp_dir === null) {
$this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir(); $this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir();
}
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root"); $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
$this->_FILEH_ = fopen($this->_tmp_filename, "w+b"); $this->_FILEH_ = fopen($this->_tmp_filename, "w+b");
if ($this->_FILEH_ == false) { if ($this->_FILEH_ == false) {
@ -199,7 +200,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
} }
// Save Header // Save Header
fwrite($FILE, fwrite(
$FILE,
"\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
. "\x00\x00\x00\x00" . "\x00\x00\x00\x00"
. "\x00\x00\x00\x00" . "\x00\x00\x00\x00"
@ -222,7 +224,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
); );
// Extra BDList Start, Count // Extra BDList Start, Count
if ($iBdCnt < $i1stBdL) { if ($iBdCnt < $i1stBdL) {
fwrite($FILE, fwrite(
$FILE,
pack("V", -2) // Extra BDList Start pack("V", -2) // Extra BDList Start
. pack("V", 0)// Extra BDList Count . pack("V", 0)// Extra BDList Count
); );
@ -258,9 +261,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
for ($i = 0; $i < $iCount; ++$i) { for ($i = 0; $i < $iCount; ++$i) {
if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) { if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) {
$raList[$i]->Size = $raList[$i]->_DataLen(); $raList[$i]->Size = $raList[$i]->_DataLen();
if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) || if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) || (($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) {
(($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data)))
{
// Write Data // Write Data
//if (isset($raList[$i]->_PPS_FILE)) { //if (isset($raList[$i]->_PPS_FILE)) {
// $iLen = 0; // $iLen = 0;

View File

@ -28,7 +28,8 @@
defined('IDENTIFIER_OLE') || defined('IDENTIFIER_OLE') ||
define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1)); define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1));
class PHPExcel_Shared_OLERead { class PHPExcel_Shared_OLERead
{
private $data = ''; private $data = '';
// OLE identifier // OLE identifier

View File

@ -3167,7 +3167,6 @@ class PclZip
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
$this->privSwapBackMagicQuotes(); $this->privSwapBackMagicQuotes();
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '".$v_header['stored_filename']."' is compressed by an unsupported compression method (".$v_header['compression'].") "); PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '".$v_header['stored_filename']."' is compressed by an unsupported compression method (".$v_header['compression'].") ");
@ -3249,9 +3248,8 @@ class PclZip
if ($v_result1 == 2) { if ($v_result1 == 2) {
break; break;
} }
} } elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
// ----- Look for extraction in standard output // ----- Look for extraction in standard output
elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
// ----- Extracting the file in standard output // ----- Extracting the file in standard output
$v_result1 = $this->privExtractFileInOutput($v_header, $p_options); $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
if ($v_result1 < 1) { if ($v_result1 < 1) {
@ -3410,7 +3408,6 @@ class PclZip
if (file_exists($p_entry['filename'])) { if (file_exists($p_entry['filename'])) {
// ----- Look if file is a directory // ----- Look if file is a directory
if (is_dir($p_entry['filename'])) { if (is_dir($p_entry['filename'])) {
// ----- Change the file status // ----- Change the file status
$p_entry['status'] = "already_a_directory"; $p_entry['status'] = "already_a_directory";
@ -3454,16 +3451,13 @@ class PclZip
// ----- Check the directory availability and create it if necessary // ----- Check the directory availability and create it if necessary
if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) { if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) {
$v_dir_to_check = $p_entry['filename']; $v_dir_to_check = $p_entry['filename'];
} } elseif (!strstr($p_entry['filename'], "/")) {
else if (!strstr($p_entry['filename'], "/")) {
$v_dir_to_check = ""; $v_dir_to_check = "";
} } else {
else {
$v_dir_to_check = dirname($p_entry['filename']); $v_dir_to_check = dirname($p_entry['filename']);
} }
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
// ----- Change the file status // ----- Change the file status
$p_entry['status'] = "path_creation_fail"; $p_entry['status'] = "path_creation_fail";
@ -3530,7 +3524,6 @@ class PclZip
$v_file_content = @gzinflate($v_buffer); $v_file_content = @gzinflate($v_buffer);
unset($v_buffer); unset($v_buffer);
if ($v_file_content === false) { if ($v_file_content === false) {
// ----- Change the file status // ----- Change the file status
// TBC // TBC
$p_entry['status'] = "error"; $p_entry['status'] = "error";
@ -3540,7 +3533,6 @@ class PclZip
// ----- Opening destination file // ----- Opening destination file
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
// ----- Change the file status // ----- Change the file status
$p_entry['status'] = "write_error"; $p_entry['status'] = "write_error";
@ -3723,7 +3715,6 @@ class PclZip
if (!(($p_entry['external']&0x00000010)==0x00000010)) { if (!(($p_entry['external']&0x00000010)==0x00000010)) {
// ----- Look for not compressed file // ----- Look for not compressed file
if ($p_entry['compressed_size'] == $p_entry['size']) { if ($p_entry['compressed_size'] == $p_entry['size']) {
// ----- Read the file in a buffer (one shot) // ----- Read the file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
@ -3731,7 +3722,6 @@ class PclZip
echo $v_buffer; echo $v_buffer;
unset($v_buffer); unset($v_buffer);
} else { } else {
// ----- Read the compressed file in a buffer (one shot) // ----- Read the compressed file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
@ -3830,11 +3820,9 @@ class PclZip
// ----- Look for not compressed file // ----- Look for not compressed file
// if ($p_entry['compressed_size'] == $p_entry['size']) // if ($p_entry['compressed_size'] == $p_entry['size'])
if ($p_entry['compression'] == 0) { if ($p_entry['compression'] == 0) {
// ----- Reading the file // ----- Reading the file
$p_string = @fread($this->zip_fd, $p_entry['compressed_size']); $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
} else { } else {
// ----- Reading the file // ----- Reading the file
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']); $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
@ -4037,8 +4025,7 @@ class PclZip
// ----- Get comment // ----- Get comment
if ($p_header['comment_len'] != 0) { if ($p_header['comment_len'] != 0) {
$p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']); $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
} } else {
else {
$p_header['comment'] = ''; $p_header['comment'] = '';
} }
@ -4171,8 +4158,9 @@ class PclZip
// ----- Go back to the maximum possible size of the Central Dir End Record // ----- Go back to the maximum possible size of the Central Dir End Record
if (!$v_found) { if (!$v_found) {
$v_maximum_size = 65557; // 0xFFFF + 22; $v_maximum_size = 65557; // 0xFFFF + 22;
if ($v_maximum_size > $v_size) if ($v_maximum_size > $v_size) {
$v_maximum_size = $v_size; $v_maximum_size = $v_size;
}
@fseek($this->zip_fd, $v_size-$v_maximum_size); @fseek($this->zip_fd, $v_size-$v_maximum_size);
if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) { if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) {
// ----- Error log // ----- Error log
@ -4196,8 +4184,7 @@ class PclZip
$v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
// ----- Compare the bytes // ----- Compare the bytes
if ($v_bytes == 0x504b0506) if ($v_bytes == 0x504b0506) {
{
$v_pos++; $v_pos++;
break; break;
} }
@ -4342,27 +4329,13 @@ class PclZip
} elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { } elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
$v_found = true; $v_found = true;
} }
} } elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
// ----- Look for a filename // ----- Look for a filename
elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
$v_found = true; $v_found = true;
} }
} }
} } elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
// ----- Look for extract by ereg rule
// ereg() is deprecated with PHP 5.3
/*
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
$v_found = true;
}
}
*/
else if ((isset($p_options[PCLZIP_OPT_BY_PREG]))
// ----- Look for extract by preg rule // ----- Look for extract by preg rule
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
$v_found = true; $v_found = true;
} }
@ -4376,7 +4349,6 @@ class PclZip
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
$j_start = $j+1; $j_start = $j+1;
} }
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
break; break;
} }
@ -4608,7 +4580,6 @@ class PclZip
// ----- Look if the archive_to_add exists // ----- Look if the archive_to_add exists
if (!is_file($p_archive_to_add->zipname)) { if (!is_file($p_archive_to_add->zipname)) {
// ----- Nothing to merge, so merge is a success // ----- Nothing to merge, so merge is a success
$v_result = 1; $v_result = 1;
@ -4618,7 +4589,6 @@ class PclZip
// ----- Look if the archive exists // ----- Look if the archive exists
if (!is_file($this->zipname)) { if (!is_file($this->zipname)) {
// ----- Do a duplicate // ----- Do a duplicate
$v_result = $this->privDuplicate($p_archive_to_add->zipname); $v_result = $this->privDuplicate($p_archive_to_add->zipname);
@ -4781,7 +4751,6 @@ class PclZip
// ----- Look if the $p_archive_filename exists // ----- Look if the $p_archive_filename exists
if (!is_file($p_archive_filename)) { if (!is_file($p_archive_filename)) {
// ----- Nothing to duplicate, so duplicate is a success. // ----- Nothing to duplicate, so duplicate is a success.
$v_result = 1; $v_result = 1;
@ -4970,8 +4939,7 @@ function PclZipUtilPathReduction($p_dir)
// ----- Look for item to skip // ----- Look for item to skip
if ($v_skip > 0) { if ($v_skip > 0) {
$v_skip--; $v_skip--;
} } else {
else {
$v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
} }
} }
@ -5051,8 +5019,12 @@ function PclZipUtilPathInclusion($p_dir, $p_path)
// ----- Look if everything seems to be the same // ----- Look if everything seems to be the same
if ($v_result) { if ($v_result) {
// ----- Skip all the empty items // ----- Skip all the empty items
while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++; while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) {
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++; $j++;
}
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) {
$i++;
}
if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) { if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
// ----- There are exactly the same // ----- There are exactly the same
@ -5160,7 +5132,6 @@ function PclZipUtilRename($p_src, $p_dest)
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
function PclZipUtilOptionText($p_option) function PclZipUtilOptionText($p_option)
{ {
$v_list = get_defined_constants(); $v_list = get_defined_constants();
for (reset($v_list); $v_key = key($v_list); next($v_list)) { for (reset($v_list); $v_key = key($v_list); next($v_list)) {
$v_prefix = substr($v_key, 0, 10); $v_prefix = substr($v_key, 0, 10);
@ -5200,4 +5171,3 @@ function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true)
} }
return $p_path; return $p_path;
} }
// --------------------------------------------------------------------------------

View File

@ -131,7 +131,7 @@ class PHPExcel_Shared_ZipStreamWrapper
* @param int $count maximum number of bytes to read * @param int $count maximum number of bytes to read
* @return string * @return string
*/ */
function stream_read($count) public function stream_read($count)
{ {
$ret = substr($this->_data, $this->_position, $count); $ret = substr($this->_data, $this->_position, $count);
$this->_position += strlen($ret); $this->_position += strlen($ret);

View File

@ -138,7 +138,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression * @param float[] $xValues The set of X-values for this regression
* @param boolean $const * @param boolean $const
*/ */
function __construct($yValues, $xValues = array(), $const = true) public function __construct($yValues, $xValues = array(), $const = true)
{ {
if (parent::__construct($yValues, $xValues) !== false) { if (parent::__construct($yValues, $xValues) !== false) {
$this->_exponential_regression($yValues, $xValues, $const); $this->_exponential_regression($yValues, $xValues, $const);

View File

@ -100,7 +100,7 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression * @param float[] $xValues The set of X-values for this regression
* @param boolean $const * @param boolean $const
*/ */
function __construct($yValues, $xValues = array(), $const = true) public function __construct($yValues, $xValues = array(), $const = true)
{ {
if (parent::__construct($yValues, $xValues) !== false) { if (parent::__construct($yValues, $xValues) !== false) {
$this->_linear_regression($yValues, $xValues, $const); $this->_linear_regression($yValues, $xValues, $const);

View File

@ -108,7 +108,7 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression * @param float[] $xValues The set of X-values for this regression
* @param boolean $const * @param boolean $const
*/ */
function __construct($yValues, $xValues = array(), $const = true) public function __construct($yValues, $xValues = array(), $const = true)
{ {
if (parent::__construct($yValues, $xValues) !== false) { if (parent::__construct($yValues, $xValues) !== false) {
$this->_logarithmic_regression($yValues, $xValues, $const); $this->_logarithmic_regression($yValues, $xValues, $const);

View File

@ -213,7 +213,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression * @param float[] $xValues The set of X-values for this regression
* @param boolean $const * @param boolean $const
*/ */
function __construct($order, $yValues, $xValues = array(), $const = true) public function __construct($order, $yValues, $xValues = array(), $const = true)
{ {
if (parent::__construct($yValues, $xValues) !== false) { if (parent::__construct($yValues, $xValues) !== false) {
if ($order < $this->_valueCount) { if ($order < $this->_valueCount) {

View File

@ -138,7 +138,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression * @param float[] $xValues The set of X-values for this regression
* @param boolean $const * @param boolean $const
*/ */
function __construct($yValues, $xValues = array(), $const = true) public function __construct($yValues, $xValues = array(), $const = true)
{ {
if (parent::__construct($yValues, $xValues) !== false) { if (parent::__construct($yValues, $xValues) !== false) {
$this->_power_regression($yValues, $xValues, $const); $this->_power_regression($yValues, $xValues, $const);

View File

@ -153,4 +153,4 @@ class trendClass
return false; return false;
} }
} // function calculate() } // function calculate()
} // class trendClass }

View File

@ -391,7 +391,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* Code to execute when this worksheet is unset() * Code to execute when this worksheet is unset()
* *
*/ */
function __destruct() public function __destruct()
{ {
PHPExcel_Calculation::getInstance($this->_parent)->clearCalculationCacheForWorksheet($this->_title); PHPExcel_Calculation::getInstance($this->_parent)->clearCalculationCacheForWorksheet($this->_title);

View File

@ -25,14 +25,14 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
class PHPExcel_Worksheet_ColumnDimension class PHPExcel_Worksheet_ColumnDimension extends PHPExcel_Worksheet_Dimension
{ {
/** /**
* Column index * Column index
* *
* @var int * @var int
*/ */
private $_columnIndex; private $columnIndex;
/** /**
* Column width * Column width
@ -41,42 +41,14 @@ class PHPExcel_Worksheet_ColumnDimension
* *
* @var double * @var double
*/ */
private $_width = -1; private $width = -1;
/** /**
* Auto size? * Auto size?
* *
* @var bool * @var bool
*/ */
private $_autoSize = false; private $autoSize = false;
/**
* Visible?
*
* @var bool
*/
private $_visible = true;
/**
* Outline level
*
* @var int
*/
private $_outlineLevel = 0;
/**
* Collapsed
*
* @var bool
*/
private $_collapsed = false;
/**
* Index to cellXf
*
* @var int
*/
private $_xfIndex;
/** /**
* Create a new PHPExcel_Worksheet_ColumnDimension * Create a new PHPExcel_Worksheet_ColumnDimension
@ -86,10 +58,10 @@ class PHPExcel_Worksheet_ColumnDimension
public function __construct($pIndex = 'A') public function __construct($pIndex = 'A')
{ {
// Initialise values // Initialise values
$this->_columnIndex = $pIndex; $this->columnIndex = $pIndex;
// set default index to cellXf // set dimension as unformatted by default
$this->_xfIndex = 0; parent::__construct(0);
} }
/** /**
@ -99,7 +71,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function getColumnIndex() public function getColumnIndex()
{ {
return $this->_columnIndex; return $this->columnIndex;
} }
/** /**
@ -110,7 +82,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function setColumnIndex($pValue) public function setColumnIndex($pValue)
{ {
$this->_columnIndex = $pValue; $this->columnIndex = $pValue;
return $this; return $this;
} }
@ -121,7 +93,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function getWidth() public function getWidth()
{ {
return $this->_width; return $this->width;
} }
/** /**
@ -132,7 +104,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function setWidth($pValue = -1) public function setWidth($pValue = -1)
{ {
$this->_width = $pValue; $this->width = $pValue;
return $this; return $this;
} }
@ -143,7 +115,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function getAutoSize() public function getAutoSize()
{ {
return $this->_autoSize; return $this->autoSize;
} }
/** /**
@ -154,117 +126,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function setAutoSize($pValue = false) public function setAutoSize($pValue = false)
{ {
$this->_autoSize = $pValue; $this->autoSize = $pValue;
return $this; return $this;
} }
/**
* Get Visible
*
* @return bool
*/
public function getVisible()
{
return $this->_visible;
}
/**
* Set Visible
*
* @param bool $pValue
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setVisible($pValue = true)
{
$this->_visible = $pValue;
return $this;
}
/**
* Get Outline Level
*
* @return int
*/
public function getOutlineLevel()
{
return $this->_outlineLevel;
}
/**
* Set Outline Level
*
* Value must be between 0 and 7
*
* @param int $pValue
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setOutlineLevel($pValue)
{
if ($pValue < 0 || $pValue > 7) {
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
}
$this->_outlineLevel = $pValue;
return $this;
}
/**
* Get Collapsed
*
* @return bool
*/
public function getCollapsed()
{
return $this->_collapsed;
}
/**
* Set Collapsed
*
* @param bool $pValue
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setCollapsed($pValue = true)
{
$this->_collapsed = $pValue;
return $this;
}
/**
* Get index to cellXf
*
* @return int
*/
public function getXfIndex()
{
return $this->_xfIndex;
}
/**
* Set index to cellXf
*
* @param int $pValue
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setXfIndex($pValue = 0)
{
$this->_xfIndex = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
} }

View File

@ -0,0 +1,178 @@
<?php
/**
* PHPExcel_Worksheet_Dimension
*
* Copyright (c) 2006 - 2015 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @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##
*/
abstract class PHPExcel_Worksheet_Dimension
{
/**
* Visible?
*
* @var bool
*/
private $visible = true;
/**
* Outline level
*
* @var int
*/
private $outlineLevel = 0;
/**
* Collapsed
*
* @var bool
*/
private $collapsed = false;
/**
* Index to cellXf. Null value means row has no explicit cellXf format.
*
* @var int|null
*/
private $xfIndex;
/**
* Create a new PHPExcel_Worksheet_Dimension
*
* @param int $pIndex Numeric row index
*/
public function __construct($initialValue = null)
{
// set dimension as unformatted by default
$this->xfIndex = $initialValue;
}
/**
* Get Visible
*
* @return bool
*/
public function getVisible()
{
return $this->visible;
}
/**
* Set Visible
*
* @param bool $pValue
* @return PHPExcel_Worksheet_Dimension
*/
public function setVisible($pValue = true)
{
$this->visible = $pValue;
return $this;
}
/**
* Get Outline Level
*
* @return int
*/
public function getOutlineLevel()
{
return $this->outlineLevel;
}
/**
* Set Outline Level
*
* Value must be between 0 and 7
*
* @param int $pValue
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Dimension
*/
public function setOutlineLevel($pValue)
{
if ($pValue < 0 || $pValue > 7) {
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
}
$this->outlineLevel = $pValue;
return $this;
}
/**
* Get Collapsed
*
* @return bool
*/
public function getCollapsed()
{
return $this->collapsed;
}
/**
* Set Collapsed
*
* @param bool $pValue
* @return PHPExcel_Worksheet_Dimension
*/
public function setCollapsed($pValue = true)
{
$this->collapsed = $pValue;
return $this;
}
/**
* Get index to cellXf
*
* @return int
*/
public function getXfIndex()
{
return $this->xfIndex;
}
/**
* Set index to cellXf
*
* @param int $pValue
* @return PHPExcel_Worksheet_Dimension
*/
public function setXfIndex($pValue = 0)
{
$this->xfIndex = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
}

View File

@ -166,7 +166,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function isProtectionEnabled() public function isProtectionEnabled()
{ {
return $this->_sheet || return $this->_sheet ||
$this->_objects || $this->_objects ||
@ -191,7 +191,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSheet() public function getSheet()
{ {
return $this->_sheet; return $this->_sheet;
} }
@ -202,7 +202,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSheet($pValue = false) public function setSheet($pValue = false)
{ {
$this->_sheet = $pValue; $this->_sheet = $pValue;
return $this; return $this;
@ -213,7 +213,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getObjects() public function getObjects()
{ {
return $this->_objects; return $this->_objects;
} }
@ -224,7 +224,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setObjects($pValue = false) public function setObjects($pValue = false)
{ {
$this->_objects = $pValue; $this->_objects = $pValue;
return $this; return $this;
@ -235,7 +235,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getScenarios() public function getScenarios()
{ {
return $this->_scenarios; return $this->_scenarios;
} }
@ -246,7 +246,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setScenarios($pValue = false) public function setScenarios($pValue = false)
{ {
$this->_scenarios = $pValue; $this->_scenarios = $pValue;
return $this; return $this;
@ -257,7 +257,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatCells() public function getFormatCells()
{ {
return $this->_formatCells; return $this->_formatCells;
} }
@ -268,7 +268,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatCells($pValue = false) public function setFormatCells($pValue = false)
{ {
$this->_formatCells = $pValue; $this->_formatCells = $pValue;
return $this; return $this;
@ -279,7 +279,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatColumns() public function getFormatColumns()
{ {
return $this->_formatColumns; return $this->_formatColumns;
} }
@ -290,7 +290,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatColumns($pValue = false) public function setFormatColumns($pValue = false)
{ {
$this->_formatColumns = $pValue; $this->_formatColumns = $pValue;
return $this; return $this;
@ -301,7 +301,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatRows() public function getFormatRows()
{ {
return $this->_formatRows; return $this->_formatRows;
} }
@ -312,7 +312,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatRows($pValue = false) public function setFormatRows($pValue = false)
{ {
$this->_formatRows = $pValue; $this->_formatRows = $pValue;
return $this; return $this;
@ -323,7 +323,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertColumns() public function getInsertColumns()
{ {
return $this->_insertColumns; return $this->_insertColumns;
} }
@ -334,7 +334,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertColumns($pValue = false) public function setInsertColumns($pValue = false)
{ {
$this->_insertColumns = $pValue; $this->_insertColumns = $pValue;
return $this; return $this;
@ -345,7 +345,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertRows() public function getInsertRows()
{ {
return $this->_insertRows; return $this->_insertRows;
} }
@ -356,7 +356,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertRows($pValue = false) public function setInsertRows($pValue = false)
{ {
$this->_insertRows = $pValue; $this->_insertRows = $pValue;
return $this; return $this;
@ -367,7 +367,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertHyperlinks() public function getInsertHyperlinks()
{ {
return $this->_insertHyperlinks; return $this->_insertHyperlinks;
} }
@ -378,7 +378,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertHyperlinks($pValue = false) public function setInsertHyperlinks($pValue = false)
{ {
$this->_insertHyperlinks = $pValue; $this->_insertHyperlinks = $pValue;
return $this; return $this;
@ -389,7 +389,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getDeleteColumns() public function getDeleteColumns()
{ {
return $this->_deleteColumns; return $this->_deleteColumns;
} }
@ -400,7 +400,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setDeleteColumns($pValue = false) public function setDeleteColumns($pValue = false)
{ {
$this->_deleteColumns = $pValue; $this->_deleteColumns = $pValue;
return $this; return $this;
@ -411,7 +411,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getDeleteRows() public function getDeleteRows()
{ {
return $this->_deleteRows; return $this->_deleteRows;
} }
@ -422,7 +422,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setDeleteRows($pValue = false) public function setDeleteRows($pValue = false)
{ {
$this->_deleteRows = $pValue; $this->_deleteRows = $pValue;
return $this; return $this;
@ -433,7 +433,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSelectLockedCells() public function getSelectLockedCells()
{ {
return $this->_selectLockedCells; return $this->_selectLockedCells;
} }
@ -444,7 +444,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSelectLockedCells($pValue = false) public function setSelectLockedCells($pValue = false)
{ {
$this->_selectLockedCells = $pValue; $this->_selectLockedCells = $pValue;
return $this; return $this;
@ -455,7 +455,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSort() public function getSort()
{ {
return $this->_sort; return $this->_sort;
} }
@ -466,7 +466,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSort($pValue = false) public function setSort($pValue = false)
{ {
$this->_sort = $pValue; $this->_sort = $pValue;
return $this; return $this;
@ -477,7 +477,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getAutoFilter() public function getAutoFilter()
{ {
return $this->_autoFilter; return $this->_autoFilter;
} }
@ -488,7 +488,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setAutoFilter($pValue = false) public function setAutoFilter($pValue = false)
{ {
$this->_autoFilter = $pValue; $this->_autoFilter = $pValue;
return $this; return $this;
@ -499,7 +499,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getPivotTables() public function getPivotTables()
{ {
return $this->_pivotTables; return $this->_pivotTables;
} }
@ -510,7 +510,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setPivotTables($pValue = false) public function setPivotTables($pValue = false)
{ {
$this->_pivotTables = $pValue; $this->_pivotTables = $pValue;
return $this; return $this;
@ -521,7 +521,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSelectUnlockedCells() public function getSelectUnlockedCells()
{ {
return $this->_selectUnlockedCells; return $this->_selectUnlockedCells;
} }
@ -532,7 +532,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSelectUnlockedCells($pValue = false) public function setSelectUnlockedCells($pValue = false)
{ {
$this->_selectUnlockedCells = $pValue; $this->_selectUnlockedCells = $pValue;
return $this; return $this;
@ -543,7 +543,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return string * @return string
*/ */
function getPassword() public function getPassword()
{ {
return $this->_password; return $this->_password;
} }
@ -555,7 +555,7 @@ class PHPExcel_Worksheet_Protection
* @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_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setPassword($pValue = '', $pAlreadyHashed = false) public function setPassword($pValue = '', $pAlreadyHashed = false)
{ {
if (!$pAlreadyHashed) { if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);

View File

@ -25,14 +25,14 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
class PHPExcel_Worksheet_RowDimension class PHPExcel_Worksheet_RowDimension extends PHPExcel_Worksheet_Dimension
{ {
/** /**
* Row index * Row index
* *
* @var int * @var int
*/ */
private $_rowIndex; private $rowIndex;
/** /**
* Row height (in pt) * Row height (in pt)
@ -41,42 +41,14 @@ class PHPExcel_Worksheet_RowDimension
* *
* @var double * @var double
*/ */
private $_rowHeight = -1; private $height = -1;
/** /**
* ZeroHeight for Row? * ZeroHeight for Row?
* *
* @var bool * @var bool
*/ */
private $_zeroHeight = false; private $zeroHeight = false;
/**
* Visible?
*
* @var bool
*/
private $_visible = true;
/**
* Outline level
*
* @var int
*/
private $_outlineLevel = 0;
/**
* Collapsed
*
* @var bool
*/
private $_collapsed = false;
/**
* Index to cellXf. Null value means row has no explicit cellXf format.
*
* @var int|null
*/
private $_xfIndex;
/** /**
* Create a new PHPExcel_Worksheet_RowDimension * Create a new PHPExcel_Worksheet_RowDimension
@ -86,10 +58,10 @@ class PHPExcel_Worksheet_RowDimension
public function __construct($pIndex = 0) public function __construct($pIndex = 0)
{ {
// Initialise values // Initialise values
$this->_rowIndex = $pIndex; $this->rowIndex = $pIndex;
// set row dimension as unformatted by default // set dimension as unformatted by default
$this->_xfIndex = null; parent::__construct(null);
} }
/** /**
@ -99,7 +71,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function getRowIndex() public function getRowIndex()
{ {
return $this->_rowIndex; return $this->rowIndex;
} }
/** /**
@ -110,7 +82,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function setRowIndex($pValue) public function setRowIndex($pValue)
{ {
$this->_rowIndex = $pValue; $this->rowIndex = $pValue;
return $this; return $this;
} }
@ -121,7 +93,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function getRowHeight() public function getRowHeight()
{ {
return $this->_rowHeight; return $this->height;
} }
/** /**
@ -132,7 +104,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function setRowHeight($pValue = -1) public function setRowHeight($pValue = -1)
{ {
$this->_rowHeight = $pValue; $this->height = $pValue;
return $this; return $this;
} }
@ -143,7 +115,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function getZeroHeight() public function getZeroHeight()
{ {
return $this->_zeroHeight; return $this->zeroHeight;
} }
/** /**
@ -154,117 +126,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function setZeroHeight($pValue = false) public function setZeroHeight($pValue = false)
{ {
$this->_zeroHeight = $pValue; $this->zeroHeight = $pValue;
return $this; return $this;
} }
/**
* Get Visible
*
* @return bool
*/
public function getVisible()
{
return $this->_visible;
}
/**
* Set Visible
*
* @param bool $pValue
* @return PHPExcel_Worksheet_RowDimension
*/
public function setVisible($pValue = true)
{
$this->_visible = $pValue;
return $this;
}
/**
* Get Outline Level
*
* @return int
*/
public function getOutlineLevel()
{
return $this->_outlineLevel;
}
/**
* Set Outline Level
*
* Value must be between 0 and 7
*
* @param int $pValue
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_RowDimension
*/
public function setOutlineLevel($pValue)
{
if ($pValue < 0 || $pValue > 7) {
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
}
$this->_outlineLevel = $pValue;
return $this;
}
/**
* Get Collapsed
*
* @return bool
*/
public function getCollapsed()
{
return $this->_collapsed;
}
/**
* Set Collapsed
*
* @param bool $pValue
* @return PHPExcel_Worksheet_RowDimension
*/
public function setCollapsed($pValue = true)
{
$this->_collapsed = $pValue;
return $this;
}
/**
* Get index to cellXf
*
* @return int
*/
public function getXfIndex()
{
return $this->_xfIndex;
}
/**
* Set index to cellXf
*
* @param int $pValue
* @return PHPExcel_Worksheet_RowDimension
*/
public function setXfIndex($pValue = 0)
{
$this->_xfIndex = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Worksheet_SheetView
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Worksheet_SheetView
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Worksheet_SheetView class PHPExcel_Worksheet_SheetView
{ {
@ -54,7 +46,7 @@ class PHPExcel_Worksheet_SheetView
* *
* @var int * @var int
*/ */
private $_zoomScale = 100; private $zoomScale = 100;
/** /**
* ZoomScaleNormal * ZoomScaleNormal
@ -63,7 +55,7 @@ class PHPExcel_Worksheet_SheetView
* *
* @var int * @var int
*/ */
private $_zoomScaleNormal = 100; private $zoomScaleNormal = 100;
/** /**
* View * View
@ -72,7 +64,7 @@ class PHPExcel_Worksheet_SheetView
* *
* @var string * @var string
*/ */
private $_sheetviewType = self::SHEETVIEW_NORMAL; private $sheetviewType = self::SHEETVIEW_NORMAL;
/** /**
* Create a new PHPExcel_Worksheet_SheetView * Create a new PHPExcel_Worksheet_SheetView
@ -88,7 +80,7 @@ class PHPExcel_Worksheet_SheetView
*/ */
public function getZoomScale() public function getZoomScale()
{ {
return $this->_zoomScale; return $this->zoomScale;
} }
/** /**
@ -105,7 +97,7 @@ class PHPExcel_Worksheet_SheetView
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
// but it is apparently still able to handle any scale >= 1 // but it is apparently still able to handle any scale >= 1
if (($pValue >= 1) || is_null($pValue)) { if (($pValue >= 1) || is_null($pValue)) {
$this->_zoomScale = $pValue; $this->zoomScale = $pValue;
} else { } else {
throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
} }
@ -119,7 +111,7 @@ class PHPExcel_Worksheet_SheetView
*/ */
public function getZoomScaleNormal() public function getZoomScaleNormal()
{ {
return $this->_zoomScaleNormal; return $this->zoomScaleNormal;
} }
/** /**
@ -134,7 +126,7 @@ class PHPExcel_Worksheet_SheetView
public function setZoomScaleNormal($pValue = 100) public function setZoomScaleNormal($pValue = 100)
{ {
if (($pValue >= 1) || is_null($pValue)) { if (($pValue >= 1) || is_null($pValue)) {
$this->_zoomScaleNormal = $pValue; $this->zoomScaleNormal = $pValue;
} else { } else {
throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
} }
@ -148,7 +140,7 @@ class PHPExcel_Worksheet_SheetView
*/ */
public function getView() public function getView()
{ {
return $this->_sheetviewType; return $this->sheetviewType;
} }
/** /**
@ -170,7 +162,7 @@ class PHPExcel_Worksheet_SheetView
$pValue = self::SHEETVIEW_NORMAL; $pValue = self::SHEETVIEW_NORMAL;
} }
if (in_array($pValue, self::$_sheetViewTypes)) { if (in_array($pValue, self::$_sheetViewTypes)) {
$this->_sheetviewType = $pValue; $this->sheetviewType = $pValue;
} else { } else {
throw new PHPExcel_Exception("Invalid sheetview layout type."); throw new PHPExcel_Exception("Invalid sheetview layout type.");
} }

View File

@ -32,49 +32,49 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* *
* @var PHPExcel * @var PHPExcel
*/ */
private $_phpExcel; private $phpExcel;
/** /**
* Delimiter * Delimiter
* *
* @var string * @var string
*/ */
private $_delimiter = ','; private $delimiter = ',';
/** /**
* Enclosure * Enclosure
* *
* @var string * @var string
*/ */
private $_enclosure = '"'; private $enclosure = '"';
/** /**
* Line ending * Line ending
* *
* @var string * @var string
*/ */
private $_lineEnding = PHP_EOL; private $lineEnding = PHP_EOL;
/** /**
* Sheet index to write * Sheet index to write
* *
* @var int * @var int
*/ */
private $_sheetIndex = 0; private $sheetIndex = 0;
/** /**
* Whether to write a BOM (for UTF8). * Whether to write a BOM (for UTF8).
* *
* @var boolean * @var boolean
*/ */
private $_useBOM = false; private $useBOM = false;
/** /**
* Whether to write a fully Excel compatible CSV file. * Whether to write a fully Excel compatible CSV file.
* *
* @var boolean * @var boolean
*/ */
private $_excelCompatibility = false; private $excelCompatibility = false;
/** /**
* Create a new PHPExcel_Writer_CSV * Create a new PHPExcel_Writer_CSV
@ -83,7 +83,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function __construct(PHPExcel $phpExcel) public function __construct(PHPExcel $phpExcel)
{ {
$this->_phpExcel = $phpExcel; $this->phpExcel = $phpExcel;
} }
/** /**
@ -95,10 +95,10 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
public function save($pFilename = null) public function save($pFilename = null)
{ {
// Fetch sheet // Fetch sheet
$sheet = $this->_phpExcel->getSheet($this->_sheetIndex); $sheet = $this->phpExcel->getSheet($this->sheetIndex);
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); $saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false); PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
@ -108,13 +108,13 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing.");
} }
if ($this->_excelCompatibility) { if ($this->excelCompatibility) {
fwrite($fileHandle, "\xEF\xBB\xBF"); // Enforce UTF-8 BOM Header fwrite($fileHandle, "\xEF\xBB\xBF"); // Enforce UTF-8 BOM Header
$this->setEnclosure('"'); // Set enclosure to " $this->setEnclosure('"'); // Set enclosure to "
$this->setDelimiter(";"); // Set delimiter to a semi-colon $this->setDelimiter(";"); // Set delimiter to a semi-colon
$this->setLineEnding("\r\n"); $this->setLineEnding("\r\n");
fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->_lineEnding); fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->lineEnding);
} elseif ($this->_useBOM) { } elseif ($this->useBOM) {
// Write the UTF-8 BOM code if required // Write the UTF-8 BOM code if required
fwrite($fileHandle, "\xEF\xBB\xBF"); fwrite($fileHandle, "\xEF\xBB\xBF");
} }
@ -135,7 +135,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
fclose($fileHandle); fclose($fileHandle);
PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
} }
/** /**
@ -145,7 +145,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getDelimiter() public function getDelimiter()
{ {
return $this->_delimiter; return $this->delimiter;
} }
/** /**
@ -156,7 +156,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function setDelimiter($pValue = ',') public function setDelimiter($pValue = ',')
{ {
$this->_delimiter = $pValue; $this->delimiter = $pValue;
return $this; return $this;
} }
@ -167,7 +167,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getEnclosure() public function getEnclosure()
{ {
return $this->_enclosure; return $this->enclosure;
} }
/** /**
@ -181,7 +181,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
if ($pValue == '') { if ($pValue == '') {
$pValue = null; $pValue = null;
} }
$this->_enclosure = $pValue; $this->enclosure = $pValue;
return $this; return $this;
} }
@ -192,7 +192,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getLineEnding() public function getLineEnding()
{ {
return $this->_lineEnding; return $this->lineEnding;
} }
/** /**
@ -203,7 +203,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function setLineEnding($pValue = PHP_EOL) public function setLineEnding($pValue = PHP_EOL)
{ {
$this->_lineEnding = $pValue; $this->lineEnding = $pValue;
return $this; return $this;
} }
@ -214,7 +214,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getUseBOM() public function getUseBOM()
{ {
return $this->_useBOM; return $this->useBOM;
} }
/** /**
@ -225,7 +225,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function setUseBOM($pValue = false) public function setUseBOM($pValue = false)
{ {
$this->_useBOM = $pValue; $this->useBOM = $pValue;
return $this; return $this;
} }
@ -236,7 +236,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getExcelCompatibility() public function getExcelCompatibility()
{ {
return $this->_excelCompatibility; return $this->excelCompatibility;
} }
/** /**
@ -248,7 +248,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function setExcelCompatibility($pValue = false) public function setExcelCompatibility($pValue = false)
{ {
$this->_excelCompatibility = $pValue; $this->excelCompatibility = $pValue;
return $this; return $this;
} }
@ -259,7 +259,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getSheetIndex() public function getSheetIndex()
{ {
return $this->_sheetIndex; return $this->sheetIndex;
} }
/** /**
@ -270,7 +270,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function setSheetIndex($pValue = 0) public function setSheetIndex($pValue = 0)
{ {
$this->_sheetIndex = $pValue; $this->sheetIndex = $pValue;
return $this; return $this;
} }
@ -292,21 +292,21 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
foreach ($pValues as $element) { foreach ($pValues as $element) {
// Escape enclosures // Escape enclosures
$element = str_replace($this->_enclosure, $this->_enclosure . $this->_enclosure, $element); $element = str_replace($this->enclosure, $this->enclosure . $this->enclosure, $element);
// Add delimiter // Add delimiter
if ($writeDelimiter) { if ($writeDelimiter) {
$line .= $this->_delimiter; $line .= $this->delimiter;
} else { } else {
$writeDelimiter = true; $writeDelimiter = true;
} }
// Add enclosed string // Add enclosed string
$line .= $this->_enclosure . $element . $this->_enclosure; $line .= $this->enclosure . $element . $this->enclosure;
} }
// Add line ending // Add line ending
$line .= $this->_lineEnding; $line .= $this->lineEnding;
// Write to file // Write to file
fwrite($pFileHandle, $line); fwrite($pFileHandle, $line);

View File

@ -32,63 +32,63 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* *
* @var PHPExcel * @var PHPExcel
*/ */
private $_phpExcel; private $phpExcel;
/** /**
* Total number of shared strings in workbook * Total number of shared strings in workbook
* *
* @var int * @var int
*/ */
private $_str_total = 0; private $strTotal = 0;
/** /**
* Number of unique shared strings in workbook * Number of unique shared strings in workbook
* *
* @var int * @var int
*/ */
private $_str_unique = 0; private $strUnique = 0;
/** /**
* Array of unique shared strings in workbook * Array of unique shared strings in workbook
* *
* @var array * @var array
*/ */
private $_str_table = array(); private $strTable = array();
/** /**
* Color cache. Mapping between RGB value and color index. * Color cache. Mapping between RGB value and color index.
* *
* @var array * @var array
*/ */
private $_colors; private $colors;
/** /**
* Formula parser * Formula parser
* *
* @var PHPExcel_Writer_Excel5_Parser * @var PHPExcel_Writer_Excel5_Parser
*/ */
private $_parser; private $parser;
/** /**
* Identifier clusters for drawings. Used in MSODRAWINGGROUP record. * Identifier clusters for drawings. Used in MSODRAWINGGROUP record.
* *
* @var array * @var array
*/ */
private $_IDCLs; private $IDCLs;
/** /**
* Basic OLE object summary information * Basic OLE object summary information
* *
* @var array * @var array
*/ */
private $_summaryInformation; private $summaryInformation;
/** /**
* Extended OLE object document summary information * Extended OLE object document summary information
* *
* @var array * @var array
*/ */
private $_documentSummaryInformation; private $documentSummaryInformation;
/** /**
* Create a new PHPExcel_Writer_Excel5 * Create a new PHPExcel_Writer_Excel5
@ -97,9 +97,9 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
*/ */
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();
} }
/** /**
@ -112,38 +112,38 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
{ {
// 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);
// initialize colors array // initialize colors array
$this->_colors = array(); $this->colors = array();
// Initialise workbook writer // Initialise workbook writer
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser); $this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->phpExcel, $this->strTotal, $this->strUnique, $this->strTable, $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->_str_table, $this->_colors, $this->_parser, $this->_preCalculateFormulas, $this->_phpExcel->getSheet($i)); $this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->strTotal, $this->strUnique, $this->strTable, $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.
$this->_buildWorksheetEschers(); $this->buildWorksheetEschers();
$this->_buildWorkbookEscher(); $this->buildWorkbookEscher();
// add 15 identical cell style Xfs // add 15 identical cell style Xfs
// for now, we use the first cellXf instead of cellStyleXf // for now, we use the first cellXf instead of cellStyleXf
$cellXfCollection = $this->_phpExcel->getCellXfCollection(); $cellXfCollection = $this->phpExcel->getCellXfCollection();
for ($i = 0; $i < 15; ++$i) { for ($i = 0; $i < 15; ++$i) {
$this->_writerWorkbook->addXfWriter($cellXfCollection[0], true); $this->_writerWorkbook->addXfWriter($cellXfCollection[0], true);
} }
// add all the cell Xfs // add all the cell Xfs
foreach ($this->_phpExcel->getCellXfCollection() as $style) { foreach ($this->phpExcel->getCellXfCollection() as $style) {
$this->_writerWorkbook->addXfWriter($style, false); $this->_writerWorkbook->addXfWriter($style, false);
} }
@ -184,18 +184,18 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$OLE->append($this->_writerWorksheets[$i]->getData()); $OLE->append($this->_writerWorksheets[$i]->getData());
} }
$this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation(); $this->documentSummaryInformation = $this->writeDocumentSummaryInformation();
// initialize OLE Document Summary Information // initialize OLE Document Summary Information
if (isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)) { if (isset($this->documentSummaryInformation) && !empty($this->documentSummaryInformation)) {
$OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation')); $OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
$OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation); $OLE_DocumentSummaryInformation->append($this->documentSummaryInformation);
} }
$this->_summaryInformation = $this->_writeSummaryInformation(); $this->summaryInformation = $this->writeSummaryInformation();
// initialize OLE Summary Information // initialize OLE Summary Information
if (isset($this->_summaryInformation) && !empty($this->_summaryInformation)) { if (isset($this->summaryInformation) && !empty($this->summaryInformation)) {
$OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation')); $OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
$OLE_SummaryInformation->append($this->_summaryInformation); $OLE_SummaryInformation->append($this->summaryInformation);
} }
// define OLE Parts // define OLE Parts
@ -214,7 +214,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$res = $root->save($pFilename); $res = $root->save($pFilename);
PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType); PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
} }
/** /**
@ -234,14 +234,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the Worksheet Escher objects * Build the Worksheet Escher objects
* *
*/ */
private function _buildWorksheetEschers() private function buildWorksheetEschers()
{ {
// 1-based index to BstoreContainer // 1-based index to BstoreContainer
$blipIndex = 0; $blipIndex = 0;
$lastReducedSpId = 0; $lastReducedSpId = 0;
$lastSpId = 0; $lastSpId = 0;
foreach ($this->_phpExcel->getAllsheets() as $sheet) { foreach ($this->phpExcel->getAllsheets() as $sheet) {
// sheet index // sheet index
$sheetIndex = $sheet->getParent()->getIndex($sheet); $sheetIndex = $sheet->getParent()->getIndex($sheet);
@ -385,7 +385,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
} }
// identifier clusters, used for workbook Escher object // identifier clusters, used for workbook Escher object
$this->_IDCLs[$dgId] = $lastReducedSpId; $this->IDCLs[$dgId] = $lastReducedSpId;
// set last shape index // set last shape index
$dgContainer->setLastSpId($lastSpId); $dgContainer->setLastSpId($lastSpId);
@ -398,13 +398,13 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
/** /**
* Build the Escher object corresponding to the MSODRAWINGGROUP record * Build the Escher object corresponding to the MSODRAWINGGROUP record
*/ */
private function _buildWorkbookEscher() private function buildWorkbookEscher()
{ {
$escher = null; $escher = null;
// any drawings in this workbook? // any drawings in this workbook?
$found = false; $found = false;
foreach ($this->_phpExcel->getAllSheets() as $sheet) { foreach ($this->phpExcel->getAllSheets() as $sheet) {
if (count($sheet->getDrawingCollection()) > 0) { if (count($sheet->getDrawingCollection()) > 0) {
$found = true; $found = true;
break; break;
@ -424,14 +424,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$escher->setDggContainer($dggContainer); $escher->setDggContainer($dggContainer);
// set IDCLs (identifier clusters) // set IDCLs (identifier clusters)
$dggContainer->setIDCLs($this->_IDCLs); $dggContainer->setIDCLs($this->IDCLs);
// this loop is for determining maximum shape identifier of all drawing // this loop is for determining maximum shape identifier of all drawing
$spIdMax = 0; $spIdMax = 0;
$totalCountShapes = 0; $totalCountShapes = 0;
$countDrawings = 0; $countDrawings = 0;
foreach ($this->_phpExcel->getAllsheets() as $sheet) { foreach ($this->phpExcel->getAllsheets() as $sheet) {
$sheetCountShapes = 0; // count number of shapes (minus group shape), in sheet $sheetCountShapes = 0; // count number of shapes (minus group shape), in sheet
if (count($sheet->getDrawingCollection()) > 0) { if (count($sheet->getDrawingCollection()) > 0) {
@ -441,7 +441,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
++$sheetCountShapes; ++$sheetCountShapes;
++$totalCountShapes; ++$totalCountShapes;
$spId = $sheetCountShapes | ($this->_phpExcel->getIndex($sheet) + 1) << 10; $spId = $sheetCountShapes | ($this->phpExcel->getIndex($sheet) + 1) << 10;
$spIdMax = max($spId, $spIdMax); $spIdMax = max($spId, $spIdMax);
} }
} }
@ -456,7 +456,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dggContainer->setBstoreContainer($bstoreContainer); $dggContainer->setBstoreContainer($bstoreContainer);
// the BSE's (all the images) // the BSE's (all the images)
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();
@ -537,7 +537,7 @@ 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);
@ -571,8 +571,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
// GKPIDDSI_CATEGORY : Category // GKPIDDSI_CATEGORY : Category
if ($this->_phpExcel->getProperties()->getCategory()) { if ($this->phpExcel->getProperties()->getCategory()) {
$dataProp = $this->_phpExcel->getProperties()->getCategory(); $dataProp = $this->phpExcel->getProperties()->getCategory();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), 'type' => array('pack' => 'V', 'data' => 0x1E),
@ -733,7 +733,7 @@ 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);
@ -767,8 +767,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
// Title // Title
if ($this->_phpExcel->getProperties()->getTitle()) { if ($this->phpExcel->getProperties()->getTitle()) {
$dataProp = $this->_phpExcel->getProperties()->getTitle(); $dataProp = $this->phpExcel->getProperties()->getTitle();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -776,8 +776,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Subject // Subject
if ($this->_phpExcel->getProperties()->getSubject()) { if ($this->phpExcel->getProperties()->getSubject()) {
$dataProp = $this->_phpExcel->getProperties()->getSubject(); $dataProp = $this->phpExcel->getProperties()->getSubject();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -785,8 +785,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Author (Creator) // Author (Creator)
if ($this->_phpExcel->getProperties()->getCreator()) { if ($this->phpExcel->getProperties()->getCreator()) {
$dataProp = $this->_phpExcel->getProperties()->getCreator(); $dataProp = $this->phpExcel->getProperties()->getCreator();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -794,8 +794,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Keywords // Keywords
if ($this->_phpExcel->getProperties()->getKeywords()) { if ($this->phpExcel->getProperties()->getKeywords()) {
$dataProp = $this->_phpExcel->getProperties()->getKeywords(); $dataProp = $this->phpExcel->getProperties()->getKeywords();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -803,8 +803,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Comments (Description) // Comments (Description)
if ($this->_phpExcel->getProperties()->getDescription()) { if ($this->phpExcel->getProperties()->getDescription()) {
$dataProp = $this->_phpExcel->getProperties()->getDescription(); $dataProp = $this->phpExcel->getProperties()->getDescription();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -812,8 +812,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Last Saved By (LastModifiedBy) // Last Saved By (LastModifiedBy)
if ($this->_phpExcel->getProperties()->getLastModifiedBy()) { if ($this->phpExcel->getProperties()->getLastModifiedBy()) {
$dataProp = $this->_phpExcel->getProperties()->getLastModifiedBy(); $dataProp = $this->phpExcel->getProperties()->getLastModifiedBy();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -821,8 +821,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Created Date/Time // Created Date/Time
if ($this->_phpExcel->getProperties()->getCreated()) { if ($this->phpExcel->getProperties()->getCreated()) {
$dataProp = $this->_phpExcel->getProperties()->getCreated(); $dataProp = $this->phpExcel->getProperties()->getCreated();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) 'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
@ -830,8 +830,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Modified Date/Time // Modified Date/Time
if ($this->_phpExcel->getProperties()->getModified()) { if ($this->phpExcel->getProperties()->getModified()) {
$dataProp = $this->_phpExcel->getProperties()->getModified(); $dataProp = $this->phpExcel->getProperties()->getModified();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) 'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)

View File

@ -75,61 +75,61 @@ class PHPExcel_Writer_Excel5_Xf
* *
* @var boolean * @var boolean
*/ */
private $_isStyleXf; private $isStyleXf;
/** /**
* Index to the FONT record. Index 4 does not exist * Index to the FONT record. Index 4 does not exist
* @var integer * @var integer
*/ */
private $_fontIndex; private $fontIndex;
/** /**
* An index (2 bytes) to a FORMAT record (number format). * An index (2 bytes) to a FORMAT record (number format).
* @var integer * @var integer
*/ */
public $_numberFormatIndex; private $numberFormatIndex;
/** /**
* 1 bit, apparently not used. * 1 bit, apparently not used.
* @var integer * @var integer
*/ */
public $_text_justlast; private $textJustLast;
/** /**
* The cell's foreground color. * The cell's foreground color.
* @var integer * @var integer
*/ */
public $_fg_color; private $foregroundColor;
/** /**
* The cell's background color. * The cell's background color.
* @var integer * @var integer
*/ */
public $_bg_color; private $backgroundColor;
/** /**
* Color of the bottom border of the cell. * Color of the bottom border of the cell.
* @var integer * @var integer
*/ */
public $_bottom_color; private $bottomBorderColor;
/** /**
* Color of the top border of the cell. * Color of the top border of the cell.
* @var integer * @var integer
*/ */
public $_top_color; private $topBorderColor;
/** /**
* Color of the left border of the cell. * Color of the left border of the cell.
* @var integer * @var integer
*/ */
public $_left_color; private $leftBorderColor;
/** /**
* Color of the right border of the cell. * Color of the right border of the cell.
* @var integer * @var integer
*/ */
public $_right_color; private $rightBorderColor;
/** /**
* Constructor * Constructor
@ -139,22 +139,22 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function __construct(PHPExcel_Style $style = null) public function __construct(PHPExcel_Style $style = null)
{ {
$this->_isStyleXf = false; $this->isStyleXf = false;
$this->_fontIndex = 0; $this->fontIndex = 0;
$this->_numberFormatIndex = 0; $this->numberFormatIndex = 0;
$this->_text_justlast = 0; $this->textJustLast = 0;
$this->_fg_color = 0x40; $this->foregroundColor = 0x40;
$this->_bg_color = 0x41; $this->backgroundColor = 0x41;
$this->_diag = 0; $this->_diag = 0;
$this->_bottom_color = 0x40; $this->bottomBorderColor = 0x40;
$this->_top_color = 0x40; $this->topBorderColor = 0x40;
$this->_left_color = 0x40; $this->leftBorderColor = 0x40;
$this->_right_color = 0x40; $this->rightBorderColor = 0x40;
$this->_diag_color = 0x40; $this->_diag_color = 0x40;
$this->_style = $style; $this->_style = $style;
@ -169,54 +169,54 @@ class PHPExcel_Writer_Excel5_Xf
public 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) {
$style = 0xFFF5; $style = 0xFFF5;
} else { } else {
$style = self::_mapLocked($this->_style->getProtection()->getLocked()); $style = self::mapLocked($this->_style->getProtection()->getLocked());
$style |= self::_mapHidden($this->_style->getProtection()->getHidden()) << 1; $style |= self::mapHidden($this->_style->getProtection()->getHidden()) << 1;
} }
// Flags to indicate if attributes have been set. // Flags to indicate if attributes have been set.
$atr_num = ($this->_numberFormatIndex != 0)?1:0; $atr_num = ($this->numberFormatIndex != 0)?1:0;
$atr_fnt = ($this->_fontIndex != 0)?1:0; $atr_fnt = ($this->fontIndex != 0)?1:0;
$atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0; $atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0;
$atr_bdr = (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) || $atr_bdr = (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) || self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) || self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0; self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0;
$atr_pat = (($this->_fg_color != 0x40) || $atr_pat = (($this->foregroundColor != 0x40) ||
($this->_bg_color != 0x41) || ($this->backgroundColor != 0x41) ||
self::_mapFillType($this->_style->getFill()->getFillType()))?1:0; self::mapFillType($this->_style->getFill()->getFillType()))?1:0;
$atr_prot = self::_mapLocked($this->_style->getProtection()->getLocked()) $atr_prot = self::mapLocked($this->_style->getProtection()->getLocked())
| self::_mapHidden($this->_style->getProtection()->getHidden()); | self::mapHidden($this->_style->getProtection()->getHidden());
// Zero the default border colour if the border has not been set. // Zero the default border colour if the border has not been set.
if (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) { if (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) {
$this->_bottom_color = 0; $this->bottomBorderColor = 0;
} }
if (self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) { if (self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) {
$this->_top_color = 0; $this->topBorderColor = 0;
} }
if (self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) { if (self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) {
$this->_right_color = 0; $this->rightBorderColor = 0;
} }
if (self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) { if (self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) {
$this->_left_color = 0; $this->leftBorderColor = 0;
} }
if (self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) == 0) { if (self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) == 0) {
$this->_diag_color = 0; $this->_diag_color = 0;
} }
$record = 0x00E0; // Record identifier $record = 0x00E0; // Record identifier
$length = 0x0014; // Number of bytes to follow $length = 0x0014; // Number of bytes to follow
$ifnt = $this->_fontIndex; // Index to FONT record $ifnt = $this->fontIndex; // Index to FONT record
$ifmt = $this->_numberFormatIndex; // Index to FORMAT record $ifmt = $this->numberFormatIndex; // Index to FORMAT record
$align = $this->_mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment $align = $this->mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment
$align |= (int) $this->_style->getAlignment()->getWrapText() << 3; $align |= (int) $this->_style->getAlignment()->getWrapText() << 3;
$align |= self::_mapVAlign($this->_style->getAlignment()->getVertical()) << 4; $align |= self::mapVAlign($this->_style->getAlignment()->getVertical()) << 4;
$align |= $this->_text_justlast << 7; $align |= $this->textJustLast << 7;
$used_attrib = $atr_num << 2; $used_attrib = $atr_num << 2;
$used_attrib |= $atr_fnt << 3; $used_attrib |= $atr_fnt << 3;
@ -225,15 +225,15 @@ class PHPExcel_Writer_Excel5_Xf
$used_attrib |= $atr_pat << 6; $used_attrib |= $atr_pat << 6;
$used_attrib |= $atr_prot << 7; $used_attrib |= $atr_prot << 7;
$icv = $this->_fg_color; // fg and bg pattern colors $icv = $this->foregroundColor; // fg and bg pattern colors
$icv |= $this->_bg_color << 7; $icv |= $this->backgroundColor << 7;
$border1 = self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color $border1 = self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4; $border1 |= self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4;
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8; $border1 |= self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8;
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12; $border1 |= self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12;
$border1 |= $this->_left_color << 16; $border1 |= $this->leftBorderColor << 16;
$border1 |= $this->_right_color << 23; $border1 |= $this->rightBorderColor << 23;
$diagonalDirection = $this->_style->getBorders()->getDiagonalDirection(); $diagonalDirection = $this->_style->getBorders()->getDiagonalDirection();
$diag_tl_to_rb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH $diag_tl_to_rb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH
@ -243,11 +243,11 @@ class PHPExcel_Writer_Excel5_Xf
$border1 |= $diag_tl_to_rb << 30; $border1 |= $diag_tl_to_rb << 30;
$border1 |= $diag_tr_to_lb << 31; $border1 |= $diag_tr_to_lb << 31;
$border2 = $this->_top_color; // Border color $border2 = $this->topBorderColor; // Border color
$border2 |= $this->_bottom_color << 7; $border2 |= $this->bottomBorderColor << 7;
$border2 |= $this->_diag_color << 14; $border2 |= $this->_diag_color << 14;
$border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21; $border2 |= self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
$border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26; $border2 |= self::mapFillType($this->_style->getFill()->getFillType()) << 26;
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);
@ -256,7 +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", self::_mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib); $data .= pack("CCC", self::mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
$data .= pack("VVv", $border1, $border2, $icv); $data .= pack("VVv", $border1, $border2, $icv);
return($header . $data); return($header . $data);
@ -269,7 +269,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setIsStyleXf($value) public function setIsStyleXf($value)
{ {
$this->_isStyleXf = $value; $this->isStyleXf = $value;
} }
/** /**
@ -280,7 +280,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setBottomColor($colorIndex) public function setBottomColor($colorIndex)
{ {
$this->_bottom_color = $colorIndex; $this->bottomBorderColor = $colorIndex;
} }
/** /**
@ -291,7 +291,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setTopColor($colorIndex) public function setTopColor($colorIndex)
{ {
$this->_top_color = $colorIndex; $this->topBorderColor = $colorIndex;
} }
/** /**
@ -302,7 +302,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setLeftColor($colorIndex) public function setLeftColor($colorIndex)
{ {
$this->_left_color = $colorIndex; $this->leftBorderColor = $colorIndex;
} }
/** /**
@ -313,7 +313,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setRightColor($colorIndex) public function setRightColor($colorIndex)
{ {
$this->_right_color = $colorIndex; $this->rightBorderColor = $colorIndex;
} }
/** /**
@ -336,7 +336,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setFgColor($colorIndex) public function setFgColor($colorIndex)
{ {
$this->_fg_color = $colorIndex; $this->foregroundColor = $colorIndex;
} }
/** /**
@ -347,7 +347,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setBgColor($colorIndex) public function setBgColor($colorIndex)
{ {
$this->_bg_color = $colorIndex; $this->backgroundColor = $colorIndex;
} }
/** /**
@ -359,7 +359,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setNumberFormatIndex($numberFormatIndex) public function setNumberFormatIndex($numberFormatIndex)
{ {
$this->_numberFormatIndex = $numberFormatIndex; $this->numberFormatIndex = $numberFormatIndex;
} }
/** /**
@ -369,7 +369,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setFontIndex($value) public function setFontIndex($value)
{ {
$this->_fontIndex = $value; $this->fontIndex = $value;
} }
/** /**
@ -377,7 +377,8 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int * @static array of int
* *
*/ */
private static $_mapBorderStyle = array ( PHPExcel_Style_Border::BORDER_NONE => 0x00, private static $mapBorderStyles = array(
PHPExcel_Style_Border::BORDER_NONE => 0x00,
PHPExcel_Style_Border::BORDER_THIN => 0x01, PHPExcel_Style_Border::BORDER_THIN => 0x01,
PHPExcel_Style_Border::BORDER_MEDIUM => 0x02, PHPExcel_Style_Border::BORDER_MEDIUM => 0x02,
PHPExcel_Style_Border::BORDER_DASHED => 0x03, PHPExcel_Style_Border::BORDER_DASHED => 0x03,
@ -399,10 +400,10 @@ 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::$mapBorderStyles[$borderStyle])) {
return self::$_mapBorderStyle[$borderStyle]; return self::$mapBorderStyles[$borderStyle];
} }
return 0x00; return 0x00;
} }
@ -412,7 +413,8 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int * @static array of int
* *
*/ */
private static $_mapFillType = array( PHPExcel_Style_Fill::FILL_NONE => 0x00, private static $mapFillTypes = array(
PHPExcel_Style_Fill::FILL_NONE => 0x00,
PHPExcel_Style_Fill::FILL_SOLID => 0x01, PHPExcel_Style_Fill::FILL_SOLID => 0x01,
PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02, PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02,
PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03, PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03,
@ -434,16 +436,17 @@ class PHPExcel_Writer_Excel5_Xf
PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8
PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8
); );
/** /**
* Map fill type * Map fill type
* *
* @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::$mapFillTypes[$fillType])) {
return self::$_mapFillType[$fillType]; return self::$mapFillTypes[$fillType];
} }
return 0x00; return 0x00;
} }
@ -453,7 +456,8 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int * @static array of int
* *
*/ */
private static $_mapHAlign = array( PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0, private static $mapHAlignments = array(
PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0,
PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1, PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2, PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2,
PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3, PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3,
@ -461,16 +465,17 @@ class PHPExcel_Writer_Excel5_Xf
PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5, PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6, PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6,
); );
/** /**
* Map to BIFF2-BIFF8 codes for horizontal alignment * Map to BIFF2-BIFF8 codes for horizontal alignment
* *
* @param string $hAlign * @param string $hAlign
* @return int * @return int
*/ */
private function _mapHAlign($hAlign) private function mapHAlign($hAlign)
{ {
if (isset(self::$_mapHAlign[$hAlign])) { if (isset(self::$mapHAlignments[$hAlign])) {
return self::$_mapHAlign[$hAlign]; return self::$mapHAlignments[$hAlign];
} }
return 0; return 0;
} }
@ -480,21 +485,23 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int * @static array of int
* *
*/ */
private static $_mapVAlign = array( PHPExcel_Style_Alignment::VERTICAL_TOP => 0, private static $mapVAlignments = array(
PHPExcel_Style_Alignment::VERTICAL_TOP => 0,
PHPExcel_Style_Alignment::VERTICAL_CENTER => 1, PHPExcel_Style_Alignment::VERTICAL_CENTER => 1,
PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2, PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2,
PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3, PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3,
); );
/** /**
* Map to BIFF2-BIFF8 codes for vertical alignment * Map to BIFF2-BIFF8 codes for vertical alignment
* *
* @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::$mapVAlignments[$vAlign])) {
return self::$_mapVAlign[$vAlign]; return self::$mapVAlignments[$vAlign];
} }
return 2; return 2;
} }
@ -505,15 +512,13 @@ 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;
} } elseif ($textRotation == -165) {
if ($textRotation == -165) {
return 255; return 255;
} } elseif ($textRotation < 0) {
if ($textRotation < 0) {
return 90 - $textRotation; return 90 - $textRotation;
} }
} }
@ -524,7 +529,7 @@ 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: case PHPExcel_Style_Protection::PROTECTION_INHERIT:
@ -544,7 +549,7 @@ 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: case PHPExcel_Style_Protection::PROTECTION_INHERIT:

View File

@ -32,14 +32,14 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
* *
* @var string * @var string
*/ */
protected $_tempDir = ''; protected $tempDir = '';
/** /**
* Font * Font
* *
* @var string * @var string
*/ */
protected $_font = 'freesans'; protected $font = 'freesans';
/** /**
* Orientation (Over-ride) * Orientation (Over-ride)
@ -212,7 +212,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
{ {
parent::__construct($phpExcel); parent::__construct($phpExcel);
$this->setUseInlineCss(true); $this->setUseInlineCss(true);
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir(); $this->tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
} }
/** /**
@ -222,7 +222,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
*/ */
public function getFont() public function getFont()
{ {
return $this->_font; return $this->font;
} }
/** /**
@ -236,7 +236,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
*/ */
public function setFont($fontName) public function setFont($fontName)
{ {
$this->_font = $fontName; $this->font = $fontName;
return $this; return $this;
} }
@ -291,7 +291,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
*/ */
public function getTempDir() public function getTempDir()
{ {
return $this->_tempDir; return $this->tempDir;
} }
/** /**
@ -304,7 +304,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
public function setTempDir($pValue = '') public function setTempDir($pValue = '')
{ {
if (is_dir($pValue)) { if (is_dir($pValue)) {
$this->_tempDir = $pValue; $this->tempDir = $pValue;
} else { } else {
throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue"); throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue");
} }

View File

@ -6,8 +6,7 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -52,5 +51,4 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result, 'PHPExcel_Calculation_Function')); $this->assertTrue(is_a($result, 'PHPExcel_Calculation_Function'));
} }
} }

View File

@ -8,8 +8,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -25,7 +24,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDATE() public function providerDATE()
@ -38,7 +37,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31); $result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1327968000, $result, NULL, 1E-8); $this->assertEquals(1327968000, $result, null, 1E-8);
} }
public function testDATEtoPHPObject() public function testDATEtoPHPObject()
@ -78,7 +77,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEVALUE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEVALUE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDATEVALUE() public function providerDATEVALUE()
@ -91,7 +90,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31'); $result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1327968000, $result, NULL, 1E-8); $this->assertEquals(1327968000, $result, null, 1E-8);
} }
public function testDATEVALUEtoPHPObject() public function testDATEVALUEtoPHPObject()
@ -115,7 +114,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEAR'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEAR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerYEAR() public function providerYEAR()
@ -131,7 +130,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MONTHOFYEAR'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MONTHOFYEAR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerMONTH() public function providerMONTH()
@ -147,7 +146,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WEEKOFYEAR'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WEEKOFYEAR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerWEEKNUM() public function providerWEEKNUM()
@ -163,7 +162,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFWEEK'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFWEEK'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerWEEKDAY() public function providerWEEKDAY()
@ -179,7 +178,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFMONTH'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFMONTH'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDAY() public function providerDAY()
@ -195,7 +194,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIME'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIME'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerTIME() public function providerTIME()
@ -208,7 +207,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20); $result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(27020, $result, NULL, 1E-8); $this->assertEquals(27020, $result, null, 1E-8);
} }
public function testTIMEtoPHPObject() public function testTIMEtoPHPObject()
@ -232,7 +231,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIMEVALUE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIMEVALUE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerTIMEVALUE() public function providerTIMEVALUE()
@ -245,7 +244,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20'); $result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(23420, $result, NULL, 1E-8); $this->assertEquals(23420, $result, null, 1E-8);
} }
public function testTIMEVALUEtoPHPObject() public function testTIMEVALUEtoPHPObject()
@ -269,7 +268,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'HOUROFDAY'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'HOUROFDAY'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerHOUR() public function providerHOUR()
@ -285,7 +284,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MINUTEOFHOUR'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MINUTEOFHOUR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerMINUTE() public function providerMINUTE()
@ -301,7 +300,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'SECONDOFMINUTE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'SECONDOFMINUTE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerSECOND() public function providerSECOND()
@ -317,7 +316,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'NETWORKDAYS'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'NETWORKDAYS'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNETWORKDAYS() public function providerNETWORKDAYS()
@ -333,7 +332,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WORKDAY'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WORKDAY'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerWORKDAY() public function providerWORKDAY()
@ -349,7 +348,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EDATE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EDATE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerEDATE() public function providerEDATE()
@ -362,7 +361,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26', -1); $result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26', -1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1324857600, $result, NULL, 1E-8); $this->assertEquals(1324857600, $result, null, 1E-8);
} }
public function testEDATEtoPHPObject() public function testEDATEtoPHPObject()
@ -386,7 +385,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EOMONTH'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EOMONTH'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerEOMONTH() public function providerEOMONTH()
@ -399,7 +398,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26', -1); $result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26', -1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1325289600, $result, NULL, 1E-8); $this->assertEquals(1325289600, $result, null, 1E-8);
} }
public function testEOMONTHtoPHPObject() public function testEOMONTHtoPHPObject()
@ -423,7 +422,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEDIF'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEDIF'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDATEDIF() public function providerDATEDIF()
@ -439,7 +438,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYS360'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYS360'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDAYS360() public function providerDAYS360()
@ -455,12 +454,11 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEARFRAC'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEARFRAC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerYEARFRAC() public function providerYEARFRAC()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/YEARFRAC.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/YEARFRAC.data');
} }
} }

View File

@ -12,8 +12,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -29,7 +28,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELI'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELI'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerBESSELI() public function providerBESSELI()
@ -45,7 +44,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELJ'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELJ'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerBESSELJ() public function providerBESSELJ()
@ -61,7 +60,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELK'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELK'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerBESSELK() public function providerBESSELK()
@ -77,7 +76,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELY'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELY'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerBESSELY() public function providerBESSELY()
@ -109,7 +108,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMAGINARY'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMAGINARY'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIMAGINARY() public function providerIMAGINARY()
@ -125,7 +124,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMREAL'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMREAL'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIMREAL() public function providerIMREAL()
@ -141,7 +140,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMABS'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMABS'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIMABS() public function providerIMABS()
@ -157,7 +156,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMARGUMENT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMARGUMENT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIMARGUMENT() public function providerIMARGUMENT()
@ -174,8 +173,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCONJUGATE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCONJUGATE'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMCONJUGATE() public function providerIMCONJUGATE()
@ -192,8 +190,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCOS'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCOS'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMCOS() public function providerIMCOS()
@ -210,8 +207,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMDIV'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMDIV'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMDIV() public function providerIMDIV()
@ -228,8 +224,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMEXP'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMEXP'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMEXP() public function providerIMEXP()
@ -246,8 +241,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLN'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLN'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMLN() public function providerIMLN()
@ -264,8 +258,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG2'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG2'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMLOG2() public function providerIMLOG2()
@ -282,8 +275,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG10'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG10'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMLOG10() public function providerIMLOG10()
@ -300,8 +292,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPOWER'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPOWER'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMPOWER() public function providerIMPOWER()
@ -318,8 +309,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPRODUCT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPRODUCT'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMPRODUCT() public function providerIMPRODUCT()
@ -336,8 +326,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSIN'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSIN'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMSIN() public function providerIMSIN()
@ -354,8 +343,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSQRT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSQRT'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMSQRT() public function providerIMSQRT()
@ -372,8 +360,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUB'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUB'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMSUB() public function providerIMSUB()
@ -390,8 +377,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUM'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUM'), $args);
$complexAssert = new complexAssert(); $complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage());
$complexAssert->getErrorMessage());
} }
public function providerIMSUM() public function providerIMSUM()
@ -407,7 +393,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERF'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERF'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerERF() public function providerERF()
@ -423,7 +409,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERFC'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERFC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerERFC() public function providerERFC()
@ -487,7 +473,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOBIN'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOBIN'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerDEC2BIN() public function providerDEC2BIN()
@ -503,7 +489,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOHEX'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOHEX'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerDEC2HEX() public function providerDEC2HEX()
@ -519,7 +505,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOOCT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOOCT'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerDEC2OCT() public function providerDEC2OCT()
@ -535,7 +521,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOBIN'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOBIN'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerHEX2BIN() public function providerHEX2BIN()
@ -551,7 +537,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTODEC'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTODEC'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerHEX2DEC() public function providerHEX2DEC()
@ -567,7 +553,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOOCT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOOCT'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerHEX2OCT() public function providerHEX2OCT()
@ -583,7 +569,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOBIN'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOBIN'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerOCT2BIN() public function providerOCT2BIN()
@ -599,7 +585,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTODEC'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTODEC'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerOCT2DEC() public function providerOCT2DEC()
@ -615,7 +601,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOHEX'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOHEX'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerOCT2HEX() public function providerOCT2HEX()
@ -631,7 +617,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DELTA'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DELTA'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerDELTA() public function providerDELTA()
@ -647,7 +633,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','GESTEP'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','GESTEP'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerGESTEP() public function providerGESTEP()
@ -687,12 +673,11 @@ class EngineeringTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','CONVERTUOM'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','CONVERTUOM'), $args);
$this->assertEquals($expectedResult, $result, NULL); $this->assertEquals($expectedResult, $result, null);
} }
public function providerCONVERTUOM() public function providerCONVERTUOM()
{ {
return new testDataFileIterator('rawTestData/Calculation/Engineering/CONVERTUOM.data'); return new testDataFileIterator('rawTestData/Calculation/Engineering/CONVERTUOM.data');
} }
} }

View File

@ -8,8 +8,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -25,7 +24,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerACCRINT() public function providerACCRINT()
@ -41,7 +40,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINTM'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINTM'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerACCRINTM() public function providerACCRINTM()
@ -57,7 +56,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORDEGRC'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORDEGRC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerAMORDEGRC() public function providerAMORDEGRC()
@ -73,7 +72,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORLINC'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORLINC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerAMORLINC() public function providerAMORLINC()
@ -89,7 +88,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYBS'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYBS'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPDAYBS() public function providerCOUPDAYBS()
@ -105,7 +104,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYS'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYS'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPDAYS() public function providerCOUPDAYS()
@ -121,7 +120,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYSNC'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYSNC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPDAYSNC() public function providerCOUPDAYSNC()
@ -137,7 +136,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNCD'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNCD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPNCD() public function providerCOUPNCD()
@ -153,7 +152,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNUM'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNUM'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPNUM() public function providerCOUPNUM()
@ -169,7 +168,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPPCD'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPPCD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPPCD() public function providerCOUPPCD()
@ -185,7 +184,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMIPMT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMIPMT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCUMIPMT() public function providerCUMIPMT()
@ -201,7 +200,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMPRINC'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMPRINC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCUMPRINC() public function providerCUMPRINC()
@ -217,7 +216,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DB'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DB'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDB() public function providerDB()
@ -233,7 +232,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DDB'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DDB'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDDB() public function providerDDB()
@ -249,7 +248,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DISC'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DISC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDISC() public function providerDISC()
@ -265,7 +264,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARDE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARDE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDOLLARDE() public function providerDOLLARDE()
@ -281,7 +280,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARFR'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARFR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDOLLARFR() public function providerDOLLARFR()
@ -297,7 +296,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerEFFECT() public function providerEFFECT()
@ -313,7 +312,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerFV() public function providerFV()
@ -329,7 +328,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerFVSCHEDULE() public function providerFVSCHEDULE()
@ -345,7 +344,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerINTRATE() public function providerINTRATE()
@ -361,7 +360,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIPMT() public function providerIPMT()
@ -377,7 +376,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIRR() public function providerIRR()
@ -393,7 +392,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerISPMT() public function providerISPMT()
@ -409,7 +408,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','MIRR'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','MIRR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerMIRR() public function providerMIRR()
@ -425,7 +424,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NOMINAL'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NOMINAL'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNOMINAL() public function providerNOMINAL()
@ -441,7 +440,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPER'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPER'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNPER() public function providerNPER()
@ -457,7 +456,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPV'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPV'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNPV() public function providerNPV()
@ -473,7 +472,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','PRICE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','PRICE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerPRICE() public function providerPRICE()
@ -489,7 +488,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','RATE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','RATE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerRATE() public function providerRATE()
@ -505,12 +504,11 @@ class FinancialTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','XIRR'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','XIRR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerXIRR() public function providerXIRR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/XIRR.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/XIRR.data');
} }
} }

View File

@ -8,8 +8,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -55,7 +54,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
public function testNULL() public function testNULL()
{ {
$result = PHPExcel_Calculation_Functions::NULL(); $result = PHPExcel_Calculation_Functions::null();
$this->assertEquals('#NULL!', $result); $this->assertEquals('#NULL!', $result);
} }
@ -73,7 +72,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_BLANK'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_BLANK'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_BLANK() public function providerIS_BLANK()
@ -89,7 +88,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERR'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_ERR() public function providerIS_ERR()
@ -105,7 +104,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERROR'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERROR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_ERROR() public function providerIS_ERROR()
@ -121,7 +120,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','ERROR_TYPE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','ERROR_TYPE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerERROR_TYPE() public function providerERROR_TYPE()
@ -137,7 +136,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_LOGICAL'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_LOGICAL'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_LOGICAL() public function providerIS_LOGICAL()
@ -153,7 +152,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NA'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NA'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_NA() public function providerIS_NA()
@ -169,7 +168,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NUMBER'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NUMBER'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_NUMBER() public function providerIS_NUMBER()
@ -185,7 +184,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_TEXT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_TEXT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_TEXT() public function providerIS_TEXT()
@ -201,7 +200,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NONTEXT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NONTEXT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_NONTEXT() public function providerIS_NONTEXT()
@ -217,7 +216,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_EVEN'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_EVEN'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_EVEN() public function providerIS_EVEN()
@ -233,7 +232,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ODD'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ODD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_ODD() public function providerIS_ODD()
@ -249,7 +248,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','TYPE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','TYPE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerTYPE() public function providerTYPE()
@ -265,12 +264,11 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','N'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','N'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerN() public function providerN()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/N.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/N.data');
} }
} }

View File

@ -8,8 +8,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -20,13 +19,13 @@ class LogicalTest extends PHPUnit_Framework_TestCase
public function testTRUE() public function testTRUE()
{ {
$result = PHPExcel_Calculation_Logical::TRUE(); $result = PHPExcel_Calculation_Logical::TRUE();
$this->assertEquals(TRUE, $result); $this->assertEquals(true, $result);
} }
public function testFALSE() public function testFALSE()
{ {
$result = PHPExcel_Calculation_Logical::FALSE(); $result = PHPExcel_Calculation_Logical::FALSE();
$this->assertEquals(FALSE, $result); $this->assertEquals(false, $result);
} }
/** /**
@ -108,5 +107,4 @@ class LogicalTest extends PHPUnit_Framework_TestCase
{ {
return new testDataFileIterator('rawTestData/Calculation/Logical/IFERROR.data'); return new testDataFileIterator('rawTestData/Calculation/Logical/IFERROR.data');
} }
} }

View File

@ -8,8 +8,7 @@ class LookupRefTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -48,5 +47,4 @@ class LookupRefTest extends PHPUnit_Framework_TestCase
{ {
return new testDataFileIterator('rawTestData/Calculation/LookupRef/VLOOKUP.data'); return new testDataFileIterator('rawTestData/Calculation/LookupRef/VLOOKUP.data');
} }
} }

View File

@ -8,8 +8,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -25,7 +24,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerATAN2() public function providerATAN2()
@ -41,7 +40,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerCEILING() public function providerCEILING()
@ -57,7 +56,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerCOMBIN() public function providerCOMBIN()
@ -73,7 +72,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerEVEN() public function providerEVEN()
@ -89,7 +88,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerODD() public function providerODD()
@ -105,7 +104,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerFACT() public function providerFACT()
@ -121,7 +120,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerFACTDOUBLE() public function providerFACTDOUBLE()
@ -137,7 +136,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerFLOOR() public function providerFLOOR()
@ -153,7 +152,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerGCD() public function providerGCD()
@ -169,7 +168,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerLCM() public function providerLCM()
@ -201,7 +200,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSIGN() public function providerSIGN()
@ -217,7 +216,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerPOWER() public function providerPOWER()
@ -233,7 +232,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerLOG() public function providerLOG()
@ -249,7 +248,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMOD() public function providerMOD()
@ -265,7 +264,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMDETERM() public function providerMDETERM()
@ -281,7 +280,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMINVERSE() public function providerMINVERSE()
@ -297,7 +296,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMMULT() public function providerMMULT()
@ -313,7 +312,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMULTINOMIAL() public function providerMULTINOMIAL()
@ -331,7 +330,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'), $args);
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_ARRAY); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_ARRAY);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMROUND() public function providerMROUND()
@ -347,7 +346,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerPRODUCT() public function providerPRODUCT()
@ -363,7 +362,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerQUOTIENT() public function providerQUOTIENT()
@ -379,7 +378,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerROUNDUP() public function providerROUNDUP()
@ -395,7 +394,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerROUNDDOWN() public function providerROUNDDOWN()
@ -411,7 +410,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSERIESSUM() public function providerSERIESSUM()
@ -427,7 +426,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSUMSQ() public function providerSUMSQ()
@ -443,7 +442,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerTRUNC() public function providerTRUNC()
@ -475,7 +474,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSQRTPI() public function providerSQRTPI()
@ -491,7 +490,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig', 'SUMIF'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig', 'SUMIF'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSUMIF() public function providerSUMIF()
@ -556,5 +555,4 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
), ),
); );
} }
} }

View File

@ -8,8 +8,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -354,12 +353,11 @@ class TextDataTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'VALUE'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'VALUE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerVALUE() public function providerVALUE()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/VALUE.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/VALUE.data');
} }
} }

View File

@ -4,7 +4,6 @@ require_once 'testDataFileIterator.php';
class CalculationTest extends PHPUnit_Framework_TestCase class CalculationTest extends PHPUnit_Framework_TestCase
{ {
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
@ -33,5 +32,4 @@ class CalculationTest extends PHPUnit_Framework_TestCase
{ {
return new testDataFileIterator('rawTestData/CalculationBinaryComparisonOperation.data'); return new testDataFileIterator('rawTestData/CalculationBinaryComparisonOperation.data');
} }
} }

View File

@ -64,7 +64,7 @@ class AdvancedValueBinderTest extends PHPUnit_Framework_TestCase
PHPExcel_Shared_String::setDecimalSeparator($decimalSeparator); PHPExcel_Shared_String::setDecimalSeparator($decimalSeparator);
PHPExcel_Shared_String::setThousandsSeparator($thousandsSeparator); PHPExcel_Shared_String::setThousandsSeparator($thousandsSeparator);
$cell = new PHPExcel_Cell(NULL, PHPExcel_Cell_DataType::TYPE_STRING, $sheet); $cell = new PHPExcel_Cell(null, PHPExcel_Cell_DataType::TYPE_STRING, $sheet);
$binder = new PHPExcel_Cell_AdvancedValueBinder(); $binder = new PHPExcel_Cell_AdvancedValueBinder();
$binder->bindValue($cell, $value); $binder->bindValue($cell, $value);

View File

@ -6,8 +6,7 @@ class DataTypeTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -20,5 +19,4 @@ class DataTypeTest extends PHPUnit_Framework_TestCase
$this->assertGreaterThan(0, count($result)); $this->assertGreaterThan(0, count($result));
$this->assertArrayHasKey('#NULL!', $result); $this->assertArrayHasKey('#NULL!', $result);
} }
} }

View File

@ -8,8 +8,7 @@ class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');

View File

@ -6,8 +6,7 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -40,7 +39,7 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
{ {
$tooltipValue = 'PHPExcel Web Site'; $tooltipValue = 'PHPExcel Web Site';
$testInstance = new PHPExcel_Cell_Hyperlink(NULL, $tooltipValue); $testInstance = new PHPExcel_Cell_Hyperlink(null, $tooltipValue);
$result = $testInstance->getTooltip(); $result = $testInstance->getTooltip();
$this->assertEquals($tooltipValue, $result); $this->assertEquals($tooltipValue, $result);
@ -51,7 +50,7 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
$initialTooltipValue = 'PHPExcel Web Site'; $initialTooltipValue = 'PHPExcel Web Site';
$newTooltipValue = 'PHPExcel Repository on Github'; $newTooltipValue = 'PHPExcel Repository on Github';
$testInstance = new PHPExcel_Cell_Hyperlink(NULL, $initialTooltipValue); $testInstance = new PHPExcel_Cell_Hyperlink(null, $initialTooltipValue);
$result = $testInstance->setTooltip($newTooltipValue); $result = $testInstance->setTooltip($newTooltipValue);
$this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink); $this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
@ -84,5 +83,4 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
$result = $testInstance->getHashCode(); $result = $testInstance->getHashCode();
$this->assertEquals($initialExpectedHash, $result); $this->assertEquals($initialExpectedHash, $result);
} }
} }

View File

@ -291,5 +291,4 @@ class CellTest extends PHPUnit_Framework_TestCase
{ {
return new testDataFileIterator('rawTestData/CellExtractAllCellReferencesInRange.data'); return new testDataFileIterator('rawTestData/CellExtractAllCellReferencesInRange.data');
} }
} }

View File

@ -6,8 +6,7 @@ class DataSeriesValuesTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -51,5 +50,4 @@ class DataSeriesValuesTest extends PHPUnit_Framework_TestCase
$result = $testInstance->getDataType(); $result = $testInstance->getDataType();
$this->assertEquals($dataTypeValue, $result); $this->assertEquals($dataTypeValue, $result);
} }
} }

View File

@ -6,8 +6,7 @@ class LayoutTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -33,5 +32,4 @@ class LayoutTest extends PHPUnit_Framework_TestCase
$result = $testInstance->getLayoutTarget(); $result = $testInstance->getLayoutTarget();
$this->assertEquals($LayoutTargetValue, $result); $this->assertEquals($LayoutTargetValue, $result);
} }
} }

View File

@ -6,8 +6,7 @@ class LegendTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -97,8 +96,8 @@ class LegendTest extends PHPUnit_Framework_TestCase
public function testSetOverlay() public function testSetOverlay()
{ {
$overlayValues = array( $overlayValues = array(
TRUE, true,
FALSE, false,
); );
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
@ -122,7 +121,7 @@ class LegendTest extends PHPUnit_Framework_TestCase
public function testGetOverlay() public function testGetOverlay()
{ {
$OverlayValue = TRUE; $OverlayValue = true;
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$setValue = $testInstance->setOverlay($OverlayValue); $setValue = $testInstance->setOverlay($OverlayValue);
@ -130,5 +129,4 @@ class LegendTest extends PHPUnit_Framework_TestCase
$result = $testInstance->getOverlay(); $result = $testInstance->getOverlay();
$this->assertEquals($OverlayValue, $result); $this->assertEquals($OverlayValue, $result);
} }
} }

View File

@ -51,5 +51,4 @@ class XEEValidatorTest extends PHPUnit_Framework_TestCase
} }
return $tests; return $tests;
} }
} }

View File

@ -54,5 +54,4 @@ class ReferenceHelperTest extends PHPUnit_Framework_TestCase
$this->assertEquals($columnExpectedResult[$key], $value); $this->assertEquals($columnExpectedResult[$key], $value);
} }
} }
} }

View File

@ -53,5 +53,4 @@ class CodePageTest extends PHPUnit_Framework_TestCase
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
} }

View File

@ -71,7 +71,7 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'), $args); $result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5); $this->assertEquals($expectedResult, $result, null, 1E-5);
} }
public function providerDateTimePHPToExcel1900() public function providerDateTimePHPToExcel1900()
@ -92,7 +92,7 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','FormattedPHPToExcel'), $args); $result = call_user_func_array(array('PHPExcel_Shared_Date','FormattedPHPToExcel'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5); $this->assertEquals($expectedResult, $result, null, 1E-5);
} }
public function providerDateTimeFormattedPHPToExcel1900() public function providerDateTimeFormattedPHPToExcel1900()
@ -137,7 +137,7 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'), $args); $result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5); $this->assertEquals($expectedResult, $result, null, 1E-5);
} }
public function providerDateTimePHPToExcel1904() public function providerDateTimePHPToExcel1904()
@ -184,5 +184,4 @@ class DateTest extends PHPUnit_Framework_TestCase
{ {
return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900Timezone.data'); return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900Timezone.data');
} }
} }

View File

@ -16,7 +16,7 @@ class FileTest extends PHPUnit_Framework_TestCase
public function testGetUseUploadTempDirectory() public function testGetUseUploadTempDirectory()
{ {
$expectedResult = FALSE; $expectedResult = false;
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory')); $result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
@ -25,8 +25,8 @@ class FileTest extends PHPUnit_Framework_TestCase
public function testSetUseUploadTempDirectory() public function testSetUseUploadTempDirectory()
{ {
$useUploadTempDirectoryValues = array( $useUploadTempDirectoryValues = array(
TRUE, true,
FALSE, false,
); );
foreach ($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) { foreach ($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {

View File

@ -90,5 +90,4 @@ class FontTest extends PHPUnit_Framework_TestCase
{ {
return new testDataFileIterator('rawTestData/Shared/CentimeterSizeToPixels.data'); return new testDataFileIterator('rawTestData/Shared/CentimeterSizeToPixels.data');
} }
} }

View File

@ -29,5 +29,4 @@ class PasswordHasherTest extends PHPUnit_Framework_TestCase
{ {
return new testDataFileIterator('rawTestData/Shared/PasswordHashes.data'); return new testDataFileIterator('rawTestData/Shared/PasswordHashes.data');
} }
} }

View File

@ -79,5 +79,4 @@ class StringTest extends PHPUnit_Framework_TestCase
$result = call_user_func(array('PHPExcel_Shared_String','getCurrencyCode')); $result = call_user_func(array('PHPExcel_Shared_String','getCurrencyCode'));
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
} }

View File

@ -35,5 +35,4 @@ class TimeZoneTest extends PHPUnit_Framework_TestCase
$result = call_user_func(array('PHPExcel_Shared_TimeZone','setTimezone'), $unsupportedTimezone); $result = call_user_func(array('PHPExcel_Shared_TimeZone','setTimezone'), $unsupportedTimezone);
$this->assertFalse($result); $this->assertFalse($result);
} }
} }

View File

@ -77,5 +77,4 @@ class ColorTest extends PHPUnit_Framework_TestCase
{ {
return new testDataFileIterator('rawTestData/Style/ColorChangeBrightness.data'); return new testDataFileIterator('rawTestData/Style/ColorChangeBrightness.data');
} }
} }

View File

@ -32,5 +32,4 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase
{ {
return new testDataFileIterator('rawTestData/Style/NumberFormat.data'); return new testDataFileIterator('rawTestData/Style/NumberFormat.data');
} }
} }

View File

@ -105,5 +105,4 @@ class RuleTest extends PHPUnit_Framework_TestCase
$result = clone $this->_testAutoFilterRuleObject; $result = clone $this->_testAutoFilterRuleObject;
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
} }
} }

View File

@ -169,5 +169,4 @@ class AutofilterColumnTest extends PHPUnit_Framework_TestCase
$result = clone $this->_testAutoFilterColumnObject; $result = clone $this->_testAutoFilterColumnObject;
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
} }
} }

View File

@ -336,5 +336,4 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
$result = clone $this->_testAutoFilterObject; $result = clone $this->_testAutoFilterObject;
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
} }
} }

View File

@ -5,8 +5,7 @@ class CellCollectionTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -27,5 +26,4 @@ class CellCollectionTest extends PHPUnit_Framework_TestCase
PHPExcel_CachedObjectStorageFactory::finalize(); PHPExcel_CachedObjectStorageFactory::finalize();
} }
} }
} }

View File

@ -83,5 +83,4 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
$iterator->prev(); $iterator->prev();
} }
} }

View File

@ -85,5 +85,4 @@ class ColumnIteratorTest extends PHPUnit_Framework_TestCase
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D'); $iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
$iterator->prev(); $iterator->prev();
} }
} }

Some files were not shown because too many files have changed in this diff Show More