mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-29 00:36:02 +03:00
Merge branch 'psr2' of https://github.com/PHPOffice/PHPExcel into psr2
Conflicts: Classes/PHPExcel/Calculation.php Classes/PHPExcel/Cell.php
This commit is contained in:
commit
7d9f45c176
@ -847,7 +847,7 @@ class PHPExcel_Calculation_DateTime
|
||||
}
|
||||
|
||||
if (((is_numeric($method)) && (!is_string($method))) || ($method == '')) {
|
||||
switch($method) {
|
||||
switch ($method) {
|
||||
case 0:
|
||||
return self::DAYS360($startDate, $endDate) / 360;
|
||||
case 1:
|
||||
|
@ -1019,7 +1019,7 @@ class PHPExcel_Calculation_Engineering
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
|
||||
switch(floor($ord)) {
|
||||
switch (floor($ord)) {
|
||||
case 0:
|
||||
return self::besselK0($x);
|
||||
case 1:
|
||||
@ -1103,7 +1103,7 @@ class PHPExcel_Calculation_Engineering
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
|
||||
switch(floor($ord)) {
|
||||
switch (floor($ord)) {
|
||||
case 0:
|
||||
return self::besselY0($x);
|
||||
case 1:
|
||||
|
@ -1120,7 +1120,7 @@ class PHPExcel_Calculation_MathTrig
|
||||
$subtotal = array_shift($aArgs);
|
||||
|
||||
if ((is_numeric($subtotal)) && (!is_string($subtotal))) {
|
||||
switch($subtotal) {
|
||||
switch ($subtotal) {
|
||||
case 1:
|
||||
return PHPExcel_Calculation_Statistical::AVERAGE($aArgs);
|
||||
case 2:
|
||||
|
@ -3452,7 +3452,7 @@ class PHPExcel_Calculation_Statistical
|
||||
* of a data set.
|
||||
*
|
||||
* Excel Function:
|
||||
* TRIMEAN(value1[,value2[, ...]],$discard)
|
||||
* TRIMEAN(value1[,value2[, ...]], $discard)
|
||||
*
|
||||
* @access public
|
||||
* @category Statistical Functions
|
||||
|
@ -90,33 +90,33 @@ class PHPExcel_Chart
|
||||
*/
|
||||
private $_displayBlanksAs = '0';
|
||||
|
||||
/**
|
||||
* Chart Asix Y as
|
||||
*
|
||||
* @var PHPExcel_Chart_Axis
|
||||
*/
|
||||
private $_yAxis = null;
|
||||
/**
|
||||
* Chart Asix Y as
|
||||
*
|
||||
* @var PHPExcel_Chart_Axis
|
||||
*/
|
||||
private $_yAxis = null;
|
||||
|
||||
/**
|
||||
* Chart Asix X as
|
||||
*
|
||||
* @var PHPExcel_Chart_Axis
|
||||
*/
|
||||
private $_xAxis = null;
|
||||
/**
|
||||
* Chart Asix X as
|
||||
*
|
||||
* @var PHPExcel_Chart_Axis
|
||||
*/
|
||||
private $_xAxis = null;
|
||||
|
||||
/**
|
||||
* Chart Major Gridlines as
|
||||
*
|
||||
* @var PHPExcel_Chart_GridLines
|
||||
*/
|
||||
private $_majorGridlines = null;
|
||||
/**
|
||||
* Chart Major Gridlines as
|
||||
*
|
||||
* @var PHPExcel_Chart_GridLines
|
||||
*/
|
||||
private $_majorGridlines = null;
|
||||
|
||||
/**
|
||||
* Chart Minor Gridlines as
|
||||
*
|
||||
* @var PHPExcel_Chart_GridLines
|
||||
*/
|
||||
private $_minorGridlines = null;
|
||||
/**
|
||||
* Chart Minor Gridlines as
|
||||
*
|
||||
* @var PHPExcel_Chart_GridLines
|
||||
*/
|
||||
private $_minorGridlines = null;
|
||||
|
||||
/**
|
||||
* Top-Left Cell Position
|
||||
@ -304,7 +304,8 @@ class PHPExcel_Chart
|
||||
* @param PHPExcel_Chart_Title $label
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setYAxisLabel(PHPExcel_Chart_Title $label) {
|
||||
public function setYAxisLabel(PHPExcel_Chart_Title $label)
|
||||
{
|
||||
$this->_yAxisLabel = $label;
|
||||
|
||||
return $this;
|
||||
@ -365,62 +366,62 @@ class PHPExcel_Chart
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get yAxis
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
public function getChartAxisY()
|
||||
{
|
||||
if ($this->_yAxis !== null) {
|
||||
return $this->_yAxis;
|
||||
/**
|
||||
* Get yAxis
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
public function getChartAxisY()
|
||||
{
|
||||
if ($this->_yAxis !== null) {
|
||||
return $this->_yAxis;
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_Axis();
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_Axis();
|
||||
}
|
||||
/**
|
||||
* Get xAxis
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
public function getChartAxisX()
|
||||
{
|
||||
if ($this->_xAxis !== null) {
|
||||
return $this->_xAxis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get xAxis
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
public function getChartAxisX()
|
||||
{
|
||||
if ($this->_xAxis !== null) {
|
||||
return $this->_xAxis;
|
||||
return new PHPExcel_Chart_Axis();
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_Axis();
|
||||
}
|
||||
/**
|
||||
* Get Major Gridlines
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
public function getMajorGridlines()
|
||||
{
|
||||
if ($this->_majorGridlines !== null) {
|
||||
return $this->_majorGridlines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Major Gridlines
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
public function getMajorGridlines()
|
||||
{
|
||||
if ($this->_majorGridlines !== null) {
|
||||
return $this->_majorGridlines;
|
||||
return new PHPExcel_Chart_GridLines();
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_GridLines();
|
||||
}
|
||||
/**
|
||||
* Get Minor Gridlines
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
public function getMinorGridlines()
|
||||
{
|
||||
if ($this->_minorGridlines !== null) {
|
||||
return $this->_minorGridlines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Minor Gridlines
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
public function getMinorGridlines()
|
||||
{
|
||||
if ($this->_minorGridlines !== null) {
|
||||
return $this->_minorGridlines;
|
||||
return new PHPExcel_Chart_GridLines();
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_GridLines();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the Top Left position for the chart
|
||||
@ -430,7 +431,7 @@ class PHPExcel_Chart
|
||||
* @param integer $yOffset
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setTopLeftPosition($cell, $xOffset=null, $yOffset=null)
|
||||
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
|
||||
{
|
||||
$this->_topLeftCellRef = $cell;
|
||||
if (!is_null($xOffset)) {
|
||||
@ -662,9 +663,9 @@ class PHPExcel_Chart
|
||||
$this->refresh();
|
||||
|
||||
$libraryPath = PHPExcel_Settings::getChartRendererPath();
|
||||
$includePath = str_replace('\\','/',get_include_path());
|
||||
$rendererPath = str_replace('\\','/',$libraryPath);
|
||||
if (strpos($rendererPath,$includePath) === false) {
|
||||
$includePath = str_replace('\\', '/', get_include_path());
|
||||
$rendererPath = str_replace('\\', '/', $libraryPath);
|
||||
if (strpos($rendererPath, $includePath) === false) {
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ class PHPExcel_Chart_DataSeriesValues
|
||||
*/
|
||||
public function multiLevelCount() {
|
||||
$levelCount = 0;
|
||||
foreach($this->_dataValues as $dataValueSet) {
|
||||
foreach ($this->_dataValues as $dataValueSet) {
|
||||
$levelCount = max($levelCount,count($dataValueSet));
|
||||
}
|
||||
return $levelCount;
|
||||
@ -281,31 +281,31 @@ class PHPExcel_Chart_DataSeriesValues
|
||||
);
|
||||
if ($flatten) {
|
||||
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
|
||||
foreach($this->_dataValues as &$dataValue) {
|
||||
foreach ($this->_dataValues as &$dataValue) {
|
||||
if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
|
||||
$dataValue = 0.0;
|
||||
}
|
||||
}
|
||||
unset($dataValue);
|
||||
} else {
|
||||
$cellRange = explode('!',$this->_dataSource);
|
||||
$cellRange = explode('!', $this->_dataSource);
|
||||
if (count($cellRange) > 1) {
|
||||
list(,$cellRange) = $cellRange;
|
||||
list(, $cellRange) = $cellRange;
|
||||
}
|
||||
|
||||
$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$','',$cellRange));
|
||||
$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$','', $cellRange));
|
||||
if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
|
||||
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
|
||||
} else {
|
||||
$newArray = array_values(array_shift($newDataValues));
|
||||
foreach($newArray as $i => $newDataSet) {
|
||||
foreach ($newArray as $i => $newDataSet) {
|
||||
$newArray[$i] = array($newDataSet);
|
||||
}
|
||||
|
||||
foreach($newDataValues as $newDataSet) {
|
||||
foreach ($newDataValues as $newDataSet) {
|
||||
$i = 0;
|
||||
foreach($newDataSet as $newDataVal) {
|
||||
array_unshift($newArray[$i++],$newDataVal);
|
||||
foreach ($newDataSet as $newDataVal) {
|
||||
array_unshift($newArray[$i++], $newDataVal);
|
||||
}
|
||||
}
|
||||
$this->_dataValues = $newArray;
|
||||
|
@ -71,7 +71,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
private static $_plotMark = 0;
|
||||
|
||||
|
||||
private function _formatPointMarker($seriesPlot,$markerID) {
|
||||
private function _formatPointMarker($seriesPlot, $markerID) {
|
||||
$plotMarkKeys = array_keys(self::$_markSet);
|
||||
if (is_null($markerID)) {
|
||||
// Use default plot marker (next marker in the series)
|
||||
@ -106,18 +106,18 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
}
|
||||
|
||||
$testCurrentIndex = 0;
|
||||
foreach($datasetLabels as $i => $datasetLabel) {
|
||||
foreach ($datasetLabels as $i => $datasetLabel) {
|
||||
if (is_array($datasetLabel)) {
|
||||
if ($rotation == 'bar') {
|
||||
$datasetLabels[$i] = implode(" ",$datasetLabel);
|
||||
$datasetLabels[$i] = implode(" ", $datasetLabel);
|
||||
} else {
|
||||
$datasetLabel = array_reverse($datasetLabel);
|
||||
$datasetLabels[$i] = implode("\n",$datasetLabel);
|
||||
$datasetLabels[$i] = implode("\n", $datasetLabel);
|
||||
}
|
||||
} else {
|
||||
// Format labels according to any formatting code
|
||||
if (!is_null($datasetLabelFormatCode)) {
|
||||
$datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel,$datasetLabelFormatCode);
|
||||
$datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel, $datasetLabelFormatCode);
|
||||
}
|
||||
}
|
||||
++$testCurrentIndex;
|
||||
@ -127,14 +127,14 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
} // function _formatDataSetLabels()
|
||||
|
||||
|
||||
private function _percentageSumCalculation($groupID,$seriesCount) {
|
||||
private function _percentageSumCalculation($groupID, $seriesCount) {
|
||||
// Adjust our values to a percentage value across all series in the group
|
||||
for($i = 0; $i < $seriesCount; ++$i) {
|
||||
if ($i == 0) {
|
||||
$sumValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
} else {
|
||||
$nextValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
foreach($nextValues as $k => $value) {
|
||||
foreach ($nextValues as $k => $value) {
|
||||
if (isset($sumValues[$k])) {
|
||||
$sumValues[$k] += $value;
|
||||
} else {
|
||||
@ -148,8 +148,8 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
} // function _percentageSumCalculation()
|
||||
|
||||
|
||||
private function _percentageAdjustValues($dataValues,$sumValues) {
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
private function _percentageAdjustValues($dataValues, $sumValues) {
|
||||
foreach ($dataValues as $k => $dataValue) {
|
||||
$dataValues[$k] = $dataValue / $sumValues[$k] * 100;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
// If we do, it could be a plain string or an array
|
||||
if (is_array($caption)) {
|
||||
// Implode an array to a plain string
|
||||
$caption = implode('',$caption);
|
||||
$caption = implode('', $caption);
|
||||
}
|
||||
}
|
||||
return $caption;
|
||||
@ -276,7 +276,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$seriesPlots = array();
|
||||
if ($grouping == 'percentStacked') {
|
||||
$sumValues = $this->_percentageSumCalculation($groupID,$seriesCount);
|
||||
$sumValues = $this->_percentageSumCalculation($groupID, $seriesCount);
|
||||
}
|
||||
|
||||
// Loop through each data series in turn
|
||||
@ -285,13 +285,13 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
|
||||
|
||||
if ($grouping == 'percentStacked') {
|
||||
$dataValues = $this->_percentageAdjustValues($dataValues,$sumValues);
|
||||
$dataValues = $this->_percentageAdjustValues($dataValues, $sumValues);
|
||||
}
|
||||
|
||||
// Fill in any missing values in the $dataValues array
|
||||
$testCurrentIndex = 0;
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
while($k != $testCurrentIndex) {
|
||||
foreach ($dataValues as $k => $dataValue) {
|
||||
while ($k != $testCurrentIndex) {
|
||||
$dataValues[$testCurrentIndex] = null;
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
@ -309,7 +309,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]);
|
||||
} else {
|
||||
// Set the appropriate plot marker
|
||||
$this->_formatPointMarker($seriesPlot,$marker);
|
||||
$this->_formatPointMarker($seriesPlot, $marker);
|
||||
}
|
||||
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
|
||||
$seriesPlot->SetLegend($dataLabel);
|
||||
@ -352,20 +352,20 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$seriesPlots = array();
|
||||
if ($grouping == 'percentStacked') {
|
||||
$sumValues = $this->_percentageSumCalculation($groupID,$seriesCount);
|
||||
$sumValues = $this->_percentageSumCalculation($groupID, $seriesCount);
|
||||
}
|
||||
|
||||
// Loop through each data series in turn
|
||||
for($j = 0; $j < $seriesCount; ++$j) {
|
||||
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
|
||||
if ($grouping == 'percentStacked') {
|
||||
$dataValues = $this->_percentageAdjustValues($dataValues,$sumValues);
|
||||
$dataValues = $this->_percentageAdjustValues($dataValues, $sumValues);
|
||||
}
|
||||
|
||||
// Fill in any missing values in the $dataValues array
|
||||
$testCurrentIndex = 0;
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
while($k != $testCurrentIndex) {
|
||||
foreach ($dataValues as $k => $dataValue) {
|
||||
while ($k != $testCurrentIndex) {
|
||||
$dataValues[$testCurrentIndex] = null;
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
@ -411,7 +411,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
} // function _renderPlotBar()
|
||||
|
||||
|
||||
private function _renderPlotScatter($groupID,$bubble) {
|
||||
private function _renderPlotScatter($groupID, $bubble) {
|
||||
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
|
||||
$scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
|
||||
|
||||
@ -423,18 +423,18 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
|
||||
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
|
||||
foreach($dataValuesY as $k => $dataValueY) {
|
||||
foreach ($dataValuesY as $k => $dataValueY) {
|
||||
$dataValuesY[$k] = $k;
|
||||
}
|
||||
|
||||
$seriesPlot = new ScatterPlot($dataValuesX,$dataValuesY);
|
||||
$seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY);
|
||||
if ($scatterStyle == 'lineMarker') {
|
||||
$seriesPlot->SetLinkPoints();
|
||||
$seriesPlot->link->SetColor(self::$_colourSet[self::$_plotColour]);
|
||||
} elseif ($scatterStyle == 'smoothMarker') {
|
||||
$spline = new Spline($dataValuesY,$dataValuesX);
|
||||
list($splineDataY,$splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20);
|
||||
$lplot = new LinePlot($splineDataX,$splineDataY);
|
||||
$spline = new Spline($dataValuesY, $dataValuesX);
|
||||
list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20);
|
||||
$lplot = new LinePlot($splineDataX, $splineDataY);
|
||||
$lplot->SetColor(self::$_colourSet[self::$_plotColour]);
|
||||
|
||||
$this->_graph->Add($lplot);
|
||||
@ -446,7 +446,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$seriesPlot->mark->SetSize($bubbleSize);
|
||||
} else {
|
||||
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
|
||||
$this->_formatPointMarker($seriesPlot,$marker);
|
||||
$this->_formatPointMarker($seriesPlot, $marker);
|
||||
}
|
||||
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
|
||||
$seriesPlot->SetLegend($dataLabel);
|
||||
@ -469,7 +469,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
|
||||
|
||||
$dataValues = array();
|
||||
foreach($dataValuesY as $k => $dataValueY) {
|
||||
foreach ($dataValuesY as $k => $dataValueY) {
|
||||
$dataValues[$k] = implode(' ',array_reverse($dataValueY));
|
||||
}
|
||||
$tmp = array_shift($dataValues);
|
||||
@ -486,7 +486,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
if ($radarStyle == 'filled') {
|
||||
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour]);
|
||||
}
|
||||
$this->_formatPointMarker($seriesPlot,$marker);
|
||||
$this->_formatPointMarker($seriesPlot, $marker);
|
||||
$seriesPlot->SetLegend($dataLabel);
|
||||
|
||||
$this->_graph->Add($seriesPlot);
|
||||
@ -520,13 +520,13 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
|
||||
$dataValues = array();
|
||||
// Loop through each data series in turn and build the plot arrays
|
||||
foreach($plotOrder as $i => $v) {
|
||||
foreach ($plotOrder as $i => $v) {
|
||||
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues();
|
||||
foreach($dataValuesX as $j => $dataValueX) {
|
||||
foreach ($dataValuesX as $j => $dataValueX) {
|
||||
$dataValues[$plotOrder[$i]][$j] = $dataValueX;
|
||||
}
|
||||
}
|
||||
if(empty($dataValues)) {
|
||||
if (empty($dataValues)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -559,7 +559,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$this->_renderCartesianPlotArea();
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotLine($i,True,False,$dimensions);
|
||||
$this->_renderPlotLine($i,True,False, $dimensions);
|
||||
}
|
||||
} // function _renderAreaChart()
|
||||
|
||||
@ -570,7 +570,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$this->_renderCartesianPlotArea();
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotLine($i,False,False,$dimensions);
|
||||
$this->_renderPlotLine($i,False,False, $dimensions);
|
||||
}
|
||||
} // function _renderLineChart()
|
||||
|
||||
@ -581,7 +581,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
$this->_renderCartesianPlotArea();
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotBar($i,$dimensions);
|
||||
$this->_renderPlotBar($i, $dimensions);
|
||||
}
|
||||
} // function _renderBarChart()
|
||||
|
||||
@ -640,8 +640,8 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
|
||||
// Fill in any missing values in the $dataValues array
|
||||
$testCurrentIndex = 0;
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
while($k != $testCurrentIndex) {
|
||||
foreach ($dataValues as $k => $dataValue) {
|
||||
while ($k != $testCurrentIndex) {
|
||||
$dataValues[$testCurrentIndex] = null;
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
@ -707,7 +707,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
} // function _renderStockChart()
|
||||
|
||||
|
||||
private function _renderContourChart($groupCount,$dimensions) {
|
||||
private function _renderContourChart($groupCount, $dimensions) {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_contour.php');
|
||||
|
||||
$this->_renderCartesianPlotArea('intint');
|
||||
@ -718,7 +718,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
} // function _renderContourChart()
|
||||
|
||||
|
||||
private function _renderCombinationChart($groupCount,$dimensions,$outputDestination) {
|
||||
private function _renderCombinationChart($groupCount, $dimensions, $outputDestination) {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
|
||||
@ -734,17 +734,17 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
case 'area3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'areaChart' :
|
||||
$this->_renderPlotLine($i,True,True,$dimensions);
|
||||
$this->_renderPlotLine($i,True,True, $dimensions);
|
||||
break;
|
||||
case 'bar3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'barChart' :
|
||||
$this->_renderPlotBar($i,$dimensions);
|
||||
$this->_renderPlotBar($i, $dimensions);
|
||||
break;
|
||||
case 'line3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'lineChart' :
|
||||
$this->_renderPlotLine($i,False,True,$dimensions);
|
||||
$this->_renderPlotLine($i,False,True, $dimensions);
|
||||
break;
|
||||
case 'scatterChart' :
|
||||
$this->_renderPlotScatter($i,false);
|
||||
@ -785,7 +785,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
echo 'Chart is not yet implemented<br />';
|
||||
return false;
|
||||
} else {
|
||||
return $this->_renderCombinationChart($groupCount,$dimensions,$outputDestination);
|
||||
return $this->_renderCombinationChart($groupCount, $dimensions, $outputDestination);
|
||||
}
|
||||
}
|
||||
|
||||
@ -793,27 +793,27 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
case 'area3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'areaChart' :
|
||||
$this->_renderAreaChart($groupCount,$dimensions);
|
||||
$this->_renderAreaChart($groupCount, $dimensions);
|
||||
break;
|
||||
case 'bar3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'barChart' :
|
||||
$this->_renderBarChart($groupCount,$dimensions);
|
||||
$this->_renderBarChart($groupCount, $dimensions);
|
||||
break;
|
||||
case 'line3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'lineChart' :
|
||||
$this->_renderLineChart($groupCount,$dimensions);
|
||||
$this->_renderLineChart($groupCount, $dimensions);
|
||||
break;
|
||||
case 'pie3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'pieChart' :
|
||||
$this->_renderPieChart($groupCount,$dimensions,False,False);
|
||||
$this->_renderPieChart($groupCount, $dimensions,False,False);
|
||||
break;
|
||||
case 'doughnut3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'doughnutChart' :
|
||||
$this->_renderPieChart($groupCount,$dimensions,True,True);
|
||||
$this->_renderPieChart($groupCount, $dimensions,True,True);
|
||||
break;
|
||||
case 'scatterChart' :
|
||||
$this->_renderScatterChart($groupCount);
|
||||
@ -827,10 +827,10 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||
case 'surface3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'surfaceChart' :
|
||||
$this->_renderContourChart($groupCount,$dimensions);
|
||||
$this->_renderContourChart($groupCount, $dimensions);
|
||||
break;
|
||||
case 'stockChart' :
|
||||
$this->_renderStockChart($groupCount,$dimensions);
|
||||
$this->_renderStockChart($groupCount, $dimensions);
|
||||
break;
|
||||
default :
|
||||
echo $chartType.' is not yet implemented<br />';
|
||||
|
@ -466,7 +466,7 @@ class PHPExcel_DocumentProperties
|
||||
$propertyType = self::PROPERTY_TYPE_STRING;
|
||||
} elseif (is_float($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_FLOAT;
|
||||
} elseif(is_int($propertyValue)) {
|
||||
} elseif (is_int($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_INTEGER;
|
||||
} elseif (is_bool($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_BOOLEAN;
|
||||
@ -497,7 +497,7 @@ class PHPExcel_DocumentProperties
|
||||
}
|
||||
}
|
||||
|
||||
public static function convertProperty($propertyValue,$propertyType)
|
||||
public static function convertProperty($propertyValue, $propertyType)
|
||||
{
|
||||
switch ($propertyType) {
|
||||
case 'empty': // Empty
|
||||
|
@ -637,7 +637,7 @@ class PHPExcel_Helper_HTML
|
||||
|
||||
protected function rgbToColour($rgb) {
|
||||
preg_match_all('/\d+/', $rgb, $values);
|
||||
foreach($values[0] as &$value) {
|
||||
foreach ($values[0] as &$value) {
|
||||
$value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
return implode($values[0]);
|
||||
@ -655,7 +655,7 @@ class PHPExcel_Helper_HTML
|
||||
if ($attributeName == 'color') {
|
||||
if (preg_match('/rgb\s*\(/', $attributeValue)) {
|
||||
$this->$attributeName = $this->rgbToColour($attributeValue);
|
||||
} elseif(strpos(trim($attributeValue), '#') === 0) {
|
||||
} elseif (strpos(trim($attributeValue), '#') === 0) {
|
||||
$this->$attributeName = ltrim($attributeValue, '#');
|
||||
} else {
|
||||
$this->$attributeName = $this->colourNameLookup($attributeValue);
|
||||
|
@ -203,7 +203,7 @@ class PHPExcel_IOFactory
|
||||
{
|
||||
$reader = self::createReaderForFile($pFilename);
|
||||
$className = get_class($reader);
|
||||
$classType = explode('_',$className);
|
||||
$classType = explode('_', $className);
|
||||
unset($reader);
|
||||
return array_pop($classType);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class PHPExcel_NamedRange
|
||||
|
||||
// Re-attach
|
||||
if ($this->_worksheet !== NULL) {
|
||||
$this->_worksheet->getParent()->removeNamedRange($this->_name,$this->_worksheet);
|
||||
$this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet);
|
||||
}
|
||||
$this->_name = $value;
|
||||
|
||||
|
@ -266,7 +266,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
|
||||
// Loop through each line of the file in turn
|
||||
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) {
|
||||
$columnLetter = 'A';
|
||||
foreach($rowData as $rowDatum) {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) {
|
||||
// Unescape enclosures
|
||||
$rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum);
|
||||
|
@ -101,7 +101,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
fclose($fileHandle);
|
||||
|
||||
$valid = true;
|
||||
foreach($signature as $match) {
|
||||
foreach ($signature as $match) {
|
||||
// every part of the signature must be present
|
||||
if (strpos($data, $match) === false) {
|
||||
$valid = false;
|
||||
@ -110,10 +110,10 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
|
||||
// Retrieve charset encoding
|
||||
if(preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um',$data,$matches)) {
|
||||
if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) {
|
||||
$this->_charSet = strtoupper($matches[1]);
|
||||
}
|
||||
// echo 'Character Set is ',$this->_charSet,'<br />';
|
||||
// echo 'Character Set is ', $this->_charSet,'<br />';
|
||||
|
||||
return $valid;
|
||||
}
|
||||
@ -141,9 +141,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
|
||||
$xml_ss = $xml->children($namespaces['ss']);
|
||||
foreach($xml_ss->Worksheet as $worksheet) {
|
||||
foreach ($xml_ss->Worksheet as $worksheet) {
|
||||
$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;
|
||||
@ -170,7 +170,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
|
||||
$worksheetID = 1;
|
||||
$xml_ss = $xml->children($namespaces['ss']);
|
||||
foreach($xml_ss->Worksheet as $worksheet) {
|
||||
foreach ($xml_ss->Worksheet as $worksheet) {
|
||||
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
||||
|
||||
$tmpInfo = array();
|
||||
@ -189,11 +189,11 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
if (isset($worksheet->Table->Row)) {
|
||||
$rowIndex = 0;
|
||||
|
||||
foreach($worksheet->Table->Row as $rowData) {
|
||||
foreach ($worksheet->Table->Row as $rowData) {
|
||||
$columnIndex = 0;
|
||||
$rowHasData = false;
|
||||
|
||||
foreach($rowData->Cell as $cell) {
|
||||
foreach ($rowData->Cell as $cell) {
|
||||
if (isset($cell->Data)) {
|
||||
$tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
|
||||
$rowHasData = true;
|
||||
@ -241,7 +241,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
|
||||
protected static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
|
||||
$styleAttributeValue = strtolower($styleAttributeValue);
|
||||
foreach($styleList as $style) {
|
||||
foreach ($styleList as $style) {
|
||||
if ($styleAttributeValue == strtolower($style)) {
|
||||
$styleAttributeValue = $style;
|
||||
return true;
|
||||
@ -336,52 +336,52 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
|
||||
$docProps = $objPHPExcel->getProperties();
|
||||
if (isset($xml->DocumentProperties[0])) {
|
||||
foreach($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
|
||||
foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
|
||||
switch ($propertyName) {
|
||||
case 'Title' :
|
||||
$docProps->setTitle(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Subject' :
|
||||
$docProps->setSubject(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Author' :
|
||||
$docProps->setCreator(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Created' :
|
||||
$creationDate = strtotime($propertyValue);
|
||||
$docProps->setCreated($creationDate);
|
||||
break;
|
||||
case 'LastAuthor' :
|
||||
$docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'LastSaved' :
|
||||
$lastSaveDate = strtotime($propertyValue);
|
||||
$docProps->setModified($lastSaveDate);
|
||||
break;
|
||||
case 'Company' :
|
||||
$docProps->setCompany(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Category' :
|
||||
$docProps->setCategory(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Manager' :
|
||||
$docProps->setManager(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setManager(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Keywords' :
|
||||
$docProps->setKeywords(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
case 'Description' :
|
||||
$docProps->setDescription(self::_convertStringEncoding($propertyValue,$this->_charSet));
|
||||
$docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->_charSet));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($xml->CustomDocumentProperties)) {
|
||||
foreach($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
|
||||
foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
|
||||
$propertyAttributes = $propertyValue->attributes($namespaces['dt']);
|
||||
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/','PHPExcel_Reader_Excel2003XML::_hex2str',$propertyName);
|
||||
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/','PHPExcel_Reader_Excel2003XML::_hex2str', $propertyName);
|
||||
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN;
|
||||
switch((string) $propertyAttributes) {
|
||||
switch ((string) $propertyAttributes) {
|
||||
case 'string' :
|
||||
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
|
||||
$propertyValue = trim($propertyValue);
|
||||
@ -403,11 +403,11 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$propertyValue = strtotime(trim($propertyValue));
|
||||
break;
|
||||
}
|
||||
$docProps->setCustomProperty($propertyName,$propertyValue,$propertyType);
|
||||
$docProps->setCustomProperty($propertyName, $propertyValue, $propertyType);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($xml->Styles[0] as $style) {
|
||||
foreach ($xml->Styles[0] as $style) {
|
||||
$style_ss = $style->attributes($namespaces['ss']);
|
||||
$styleID = (string) $style_ss['ID'];
|
||||
// echo 'Style ID = '.$styleID.'<br />';
|
||||
@ -421,17 +421,17 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
// echo $styleType.'<br />';
|
||||
switch ($styleType) {
|
||||
case 'Alignment' :
|
||||
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||
$styleAttributeValue = (string) $styleAttributeValue;
|
||||
switch ($styleAttributeKey) {
|
||||
case 'Vertical' :
|
||||
if (self::identifyFixedStyleValue($verticalAlignmentStyles,$styleAttributeValue)) {
|
||||
if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) {
|
||||
$this->_styles[$styleID]['alignment']['vertical'] = $styleAttributeValue;
|
||||
}
|
||||
break;
|
||||
case 'Horizontal' :
|
||||
if (self::identifyFixedStyleValue($horizontalAlignmentStyles,$styleAttributeValue)) {
|
||||
if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) {
|
||||
$this->_styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue;
|
||||
}
|
||||
break;
|
||||
@ -442,10 +442,10 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
break;
|
||||
case 'Borders' :
|
||||
foreach($styleData->Border as $borderStyle) {
|
||||
foreach ($styleData->Border as $borderStyle) {
|
||||
$borderAttributes = $borderStyle->attributes($namespaces['ss']);
|
||||
$thisBorder = array();
|
||||
foreach($borderAttributes as $borderStyleKey => $borderStyleValue) {
|
||||
foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) {
|
||||
// echo $borderStyleKey.' = '.$borderStyleValue.'<br />';
|
||||
switch ($borderStyleKey) {
|
||||
case 'LineStyle' :
|
||||
@ -472,7 +472,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
break;
|
||||
case 'Font' :
|
||||
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||
$styleAttributeValue = (string) $styleAttributeValue;
|
||||
switch ($styleAttributeKey) {
|
||||
@ -492,7 +492,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$this->_styles[$styleID]['font']['italic'] = true;
|
||||
break;
|
||||
case 'Underline' :
|
||||
if (self::identifyFixedStyleValue($underlineStyles,$styleAttributeValue)) {
|
||||
if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) {
|
||||
$this->_styles[$styleID]['font']['underline'] = $styleAttributeValue;
|
||||
}
|
||||
break;
|
||||
@ -500,7 +500,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
break;
|
||||
case 'Interior' :
|
||||
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||
switch ($styleAttributeKey) {
|
||||
case 'Color' :
|
||||
@ -510,9 +510,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
break;
|
||||
case 'NumberFormat' :
|
||||
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||
$styleAttributeValue = str_replace($fromFormats,$toFormats,$styleAttributeValue);
|
||||
$styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue);
|
||||
switch ($styleAttributeValue) {
|
||||
case 'Short Date' :
|
||||
$styleAttributeValue = 'dd/mm/yyyy';
|
||||
@ -524,7 +524,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
break;
|
||||
case 'Protection' :
|
||||
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||
}
|
||||
break;
|
||||
@ -538,7 +538,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$worksheetID = 0;
|
||||
$xml_ss = $xml->children($namespaces['ss']);
|
||||
|
||||
foreach($xml_ss->Worksheet as $worksheet) {
|
||||
foreach ($xml_ss->Worksheet as $worksheet) {
|
||||
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
||||
|
||||
if ((isset($this->_loadSheetsOnly)) && (isset($worksheet_ss['Name'])) &&
|
||||
@ -546,13 +546,13 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
continue;
|
||||
}
|
||||
|
||||
// echo '<h3>Worksheet: ',$worksheet_ss['Name'],'<h3>';
|
||||
// echo '<h3>Worksheet: ', $worksheet_ss['Name'],'<h3>';
|
||||
//
|
||||
// Create new Worksheet
|
||||
$objPHPExcel->createSheet();
|
||||
$objPHPExcel->setActiveSheetIndex($worksheetID);
|
||||
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
|
||||
// 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
|
||||
@ -561,7 +561,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
|
||||
$columnID = 'A';
|
||||
if (isset($worksheet->Table->Column)) {
|
||||
foreach($worksheet->Table->Column as $columnData) {
|
||||
foreach ($worksheet->Table->Column as $columnData) {
|
||||
$columnData_ss = $columnData->attributes($namespaces['ss']);
|
||||
if (isset($columnData_ss['Index'])) {
|
||||
$columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index']-1);
|
||||
@ -578,7 +578,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$rowID = 1;
|
||||
if (isset($worksheet->Table->Row)) {
|
||||
$additionalMergedCells = 0;
|
||||
foreach($worksheet->Table->Row as $rowData) {
|
||||
foreach ($worksheet->Table->Row as $rowData) {
|
||||
$rowHasData = false;
|
||||
$row_ss = $rowData->attributes($namespaces['ss']);
|
||||
if (isset($row_ss['Index'])) {
|
||||
@ -587,7 +587,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
// echo '<b>Row '.$rowID.'</b><br />';
|
||||
|
||||
$columnID = 'A';
|
||||
foreach($rowData->Cell as $cell) {
|
||||
foreach ($rowData->Cell as $cell) {
|
||||
|
||||
$cell_ss = $cell->attributes($namespaces['ss']);
|
||||
if (isset($cell_ss['Index'])) {
|
||||
@ -643,7 +643,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
const TYPE_ERROR = 'e';
|
||||
*/
|
||||
case 'String' :
|
||||
$cellValue = self::_convertStringEncoding($cellValue,$this->_charSet);
|
||||
$cellValue = self::_convertStringEncoding($cellValue, $this->_charSet);
|
||||
$type = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
break;
|
||||
case 'Number' :
|
||||
@ -673,31 +673,31 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
|
||||
if (substr($cellDataFormula,0,3) == 'of:') {
|
||||
$cellDataFormula = substr($cellDataFormula,3);
|
||||
// echo 'Before: ',$cellDataFormula,'<br />';
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
// echo 'Before: ', $cellDataFormula,'<br />';
|
||||
$temp = explode('"', $cellDataFormula);
|
||||
$key = false;
|
||||
foreach($temp as &$value) {
|
||||
foreach ($temp as &$value) {
|
||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||
if ($key = !$key) {
|
||||
$value = str_replace(array('[.','.',']'),'',$value);
|
||||
$value = str_replace(array('[.','.',']'),'', $value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||
// echo 'Before: ',$cellDataFormula,'<br />';
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
// echo 'Before: ', $cellDataFormula,'<br />';
|
||||
$temp = explode('"', $cellDataFormula);
|
||||
$key = false;
|
||||
foreach($temp as &$value) {
|
||||
foreach ($temp as &$value) {
|
||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||
if ($key = !$key) {
|
||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
|
||||
// through the formula from left to right. Reversing means that we work right to left.through
|
||||
// the formula
|
||||
$cellReferences = array_reverse($cellReferences);
|
||||
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
|
||||
// then modify the formula to use that new reference
|
||||
foreach($cellReferences as $cellReference) {
|
||||
foreach ($cellReferences as $cellReference) {
|
||||
$rowReference = $cellReference[2][0];
|
||||
// Empty R reference is the current row
|
||||
if ($rowReference == '') $rowReference = $rowID;
|
||||
@ -709,20 +709,20 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
// Bracketed C references are relative to the current column
|
||||
if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference,'[]');
|
||||
$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]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
// Then rebuild the formula string
|
||||
$cellDataFormula = implode('"',$temp);
|
||||
// echo 'After: ',$cellDataFormula,'<br />';
|
||||
$cellDataFormula = implode('"', $temp);
|
||||
// echo 'After: ', $cellDataFormula,'<br />';
|
||||
}
|
||||
|
||||
// echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />';
|
||||
//
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue),$type);
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type);
|
||||
if ($hasCalculatedValue) {
|
||||
// echo 'Formula result is '.$cellValue.'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($cellValue);
|
||||
@ -736,15 +736,15 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
$author = 'unknown';
|
||||
if (isset($commentAttributes->Author)) {
|
||||
$author = (string)$commentAttributes->Author;
|
||||
// echo 'Author: ',$author,'<br />';
|
||||
// echo 'Author: ', $author,'<br />';
|
||||
}
|
||||
$node = $cell->Comment->Data->asXML();
|
||||
// $annotation = str_replace('html:','',substr($node,49,-10));
|
||||
// echo $annotation,'<br />';
|
||||
$annotation = strip_tags($node);
|
||||
// echo 'Annotation: ',$annotation,'<br />';
|
||||
// echo 'Annotation: ', $annotation,'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID )
|
||||
->setAuthor(self::_convertStringEncoding($author ,$this->_charSet))
|
||||
->setAuthor(self::_convertStringEncoding($author , $this->_charSet))
|
||||
->setText($this->_parseRichText($annotation) );
|
||||
}
|
||||
|
||||
@ -790,9 +790,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
}
|
||||
|
||||
|
||||
protected static function _convertStringEncoding($string,$charset) {
|
||||
protected static function _convertStringEncoding($string, $charset) {
|
||||
if ($charset != 'UTF-8') {
|
||||
return PHPExcel_Shared_String::ConvertEncoding($string,'UTF-8',$charset);
|
||||
return PHPExcel_Shared_String::ConvertEncoding($string,'UTF-8', $charset);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
@ -801,7 +801,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||
protected function _parseRichText($is = '') {
|
||||
$value = new PHPExcel_RichText();
|
||||
|
||||
$value->createText(self::_convertStringEncoding($is,$this->_charSet));
|
||||
$value->createText(self::_convertStringEncoding($is, $this->_charSet));
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
@ -217,13 +217,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
if ($xml->name == 'row' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||
$row = $xml->getAttribute('r');
|
||||
$tmpInfo['totalRows'] = $row;
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells);
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
||||
$currCells = 0;
|
||||
} elseif ($xml->name == 'c' && $xml->nodeType == XMLReader::ELEMENT) {
|
||||
$currCells++;
|
||||
}
|
||||
}
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells);
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
||||
$xml->close();
|
||||
|
||||
$tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1;
|
||||
@ -267,7 +267,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
} // 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 '$c->f is ', $c->f, PHP_EOL;
|
||||
$cellDataType = 'f';
|
||||
@ -381,7 +381,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
|
||||
$themeColours = array();
|
||||
foreach ($colourScheme as $k => $xmlColour) {
|
||||
$themePos = array_search($k,$themeOrderArray);
|
||||
$themePos = array_search($k, $themeOrderArray);
|
||||
if ($themePos === false) {
|
||||
$themePos = $themeOrderAdditional++;
|
||||
}
|
||||
@ -393,7 +393,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$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;
|
||||
}
|
||||
@ -443,9 +443,9 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$cellDataOfficeChildren = $xmlProperty->children('http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
||||
$attributeType = $cellDataOfficeChildren->getName();
|
||||
$attributeValue = (string) $cellDataOfficeChildren->{$attributeType};
|
||||
$attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue,$attributeType);
|
||||
$attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue, $attributeType);
|
||||
$attributeType = PHPExcel_DocumentProperties::convertPropertyType($attributeType);
|
||||
$docProps->setCustomProperty($propertyName,$attributeValue,$attributeType);
|
||||
$docProps->setCustomProperty($propertyName, $attributeValue, $attributeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -453,7 +453,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
//Ribbon
|
||||
case "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility":
|
||||
$customUI = $rel['Target'];
|
||||
if(!is_null($customUI)){
|
||||
if (!is_null($customUI)) {
|
||||
$this->_readRibbon($excel, $customUI, $zip);
|
||||
}
|
||||
break;
|
||||
@ -478,7 +478,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$worksheets = array();
|
||||
$macros = $customUI = NULL;
|
||||
foreach ($relsWorkbook->Relationship as $ele) {
|
||||
switch($ele['Type']){
|
||||
switch ($ele['Type']) {
|
||||
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet":
|
||||
$worksheets[(string) $ele["Id"]] = $ele["Target"];
|
||||
break;
|
||||
@ -489,14 +489,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_null($macros)){
|
||||
if (!is_null($macros)) {
|
||||
$macrosCode = $this->_getFromZipArchive($zip, 'xl/vbaProject.bin');//vbaProject.bin always in 'xl' dir and always named vbaProject.bin
|
||||
if($macrosCode !== false){
|
||||
if ($macrosCode !== false) {
|
||||
$excel->setMacrosCode($macrosCode);
|
||||
$excel->setHasMacros(true);
|
||||
//short-circuit : not reading vbaProject.bin.rel to get Signature =>allways vbaProjectSignature.bin in 'xl' dir
|
||||
$Certificate = $this->_getFromZipArchive($zip, 'xl/vbaProjectSignature.bin');
|
||||
if($Certificate !== false)
|
||||
if ($Certificate !== false)
|
||||
$excel->setMacrosCertificate($Certificate);
|
||||
}
|
||||
}
|
||||
@ -865,7 +865,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$value = self::_castToBool($c);
|
||||
} else {
|
||||
// Formula
|
||||
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToBool');
|
||||
$this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas,'_castToBool');
|
||||
if (isset($c->f['t'])) {
|
||||
$att = array();
|
||||
$att = $c->f;
|
||||
@ -885,7 +885,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$value = self::_castToError($c);
|
||||
} else {
|
||||
// Formula
|
||||
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToError');
|
||||
$this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas,'_castToError');
|
||||
// echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
|
||||
}
|
||||
|
||||
@ -899,7 +899,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
} else {
|
||||
// echo 'Treat as Formula', PHP_EOL;
|
||||
// Formula
|
||||
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToString');
|
||||
$this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas,'_castToString');
|
||||
// echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
|
||||
}
|
||||
|
||||
@ -1207,8 +1207,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation) {
|
||||
// Uppercase coordinate
|
||||
$range = strtoupper($dataValidation["sqref"]);
|
||||
$rangeSet = explode(' ',$range);
|
||||
foreach($rangeSet as $range) {
|
||||
$rangeSet = explode(' ', $range);
|
||||
foreach ($rangeSet as $range) {
|
||||
$stRange = $docSheet->shrinkRangeToFit($range);
|
||||
|
||||
// Extract all cell references in $range
|
||||
@ -1307,7 +1307,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
|
||||
// Loop through contents
|
||||
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'] )->setText( $this->_parseRichText($comment->text) );
|
||||
}
|
||||
@ -1526,7 +1526,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000);
|
||||
}
|
||||
$objDrawing->setWorksheet($docSheet);
|
||||
} elseif(($this->_includeCharts) && ($twoCellAnchor->graphicFrame)) {
|
||||
} elseif (($this->_includeCharts) && ($twoCellAnchor->graphicFrame)) {
|
||||
$fromCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1);
|
||||
$fromOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff);
|
||||
$fromOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff);
|
||||
@ -1561,7 +1561,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$extractedRange = (string)$definedName;
|
||||
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||
if (($spos = strpos($extractedRange,'!')) !== false) {
|
||||
$extractedRange = substr($extractedRange,0,$spos).str_replace('$', '', substr($extractedRange,$spos));
|
||||
$extractedRange = substr($extractedRange,0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
||||
} else {
|
||||
$extractedRange = str_replace('$', '', $extractedRange);
|
||||
}
|
||||
@ -1611,7 +1611,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
case '_xlnm.Print_Area':
|
||||
$rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma?
|
||||
$newRangeSets = array();
|
||||
foreach($rangeSets as $rangeSet) {
|
||||
foreach ($rangeSets as $rangeSet) {
|
||||
$range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark?
|
||||
$rangeSet = isset($range[1]) ? $range[1] : $range[0];
|
||||
if (strpos($rangeSet, ':') === FALSE) {
|
||||
@ -1619,7 +1619,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
}
|
||||
$newRangeSets[] = str_replace('$', '', $rangeSet);
|
||||
}
|
||||
$docSheet->getPageSetup()->setPrintArea(implode(',',$newRangeSets));
|
||||
$docSheet->getPageSetup()->setPrintArea(implode(',', $newRangeSets));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1640,7 +1640,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$extractedRange = (string)$definedName;
|
||||
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||
if (($spos = strpos($extractedRange,'!')) !== false) {
|
||||
$extractedRange = substr($extractedRange,0,$spos).str_replace('$', '', substr($extractedRange,$spos));
|
||||
$extractedRange = substr($extractedRange,0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
||||
} else {
|
||||
$extractedRange = str_replace('$', '', $extractedRange);
|
||||
}
|
||||
@ -1731,12 +1731,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$chartElements = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $chartEntryRef)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||
$objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml'));
|
||||
|
||||
// echo 'Chart ',$chartEntryRef,'<br />';
|
||||
// echo 'Chart ', $chartEntryRef,'<br />';
|
||||
// var_dump($charts[$chartEntryRef]);
|
||||
//
|
||||
if (isset($charts[$chartEntryRef])) {
|
||||
$chartPositionRef = $charts[$chartEntryRef]['sheet'].'!'.$charts[$chartEntryRef]['id'];
|
||||
// echo 'Position Ref ',$chartPositionRef,'<br />';
|
||||
// echo 'Position Ref ', $chartPositionRef,'<br />';
|
||||
if (isset($chartDetails[$chartPositionRef])) {
|
||||
// var_dump($chartDetails[$chartPositionRef]);
|
||||
|
||||
@ -1767,7 +1767,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
if (isset($color["rgb"])) {
|
||||
return (string)$color["rgb"];
|
||||
} else if (isset($color["indexed"])) {
|
||||
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB();
|
||||
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB();
|
||||
} else if (isset($color["theme"])) {
|
||||
if (self::$_theme !== NULL) {
|
||||
$returnColour = self::$_theme->getColourByIndex((int)$color["theme"]);
|
||||
@ -1832,7 +1832,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
if (isset($style->fill)) {
|
||||
if ($style->fill->gradientFill) {
|
||||
$gradientFill = $style->fill->gradientFill[0];
|
||||
if(!empty($gradientFill["type"])) {
|
||||
if (!empty($gradientFill["type"])) {
|
||||
$docStyle->getFill()->setFillType((string) $gradientFill["type"]);
|
||||
}
|
||||
$docStyle->getFill()->setRotation(floatval($gradientFill["degree"]));
|
||||
@ -1934,7 +1934,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
if (isset($is->t)) {
|
||||
$value->createText( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $is->t ) );
|
||||
} else {
|
||||
if(is_object($is->r)) {
|
||||
if (is_object($is->r)) {
|
||||
foreach ($is->r as $run) {
|
||||
if (!isset($run->rPr)) {
|
||||
$objText = $value->createText( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $run->t ) );
|
||||
|
@ -51,95 +51,95 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
} // function _getAttribute()
|
||||
|
||||
|
||||
private static function _readColor($color,$background=false) {
|
||||
private static function _readColor($color, $background=false) {
|
||||
if (isset($color["rgb"])) {
|
||||
return (string)$color["rgb"];
|
||||
} else if (isset($color["indexed"])) {
|
||||
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB();
|
||||
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function readChart($chartElements,$chartName) {
|
||||
public static function readChart($chartElements, $chartName) {
|
||||
$namespacesChartMeta = $chartElements->getNamespaces(true);
|
||||
$chartElementsC = $chartElements->children($namespacesChartMeta['c']);
|
||||
|
||||
$XaxisLabel = $YaxisLabel = $legend = $title = NULL;
|
||||
$dispBlanksAs = $plotVisOnly = NULL;
|
||||
|
||||
foreach($chartElementsC as $chartElementKey => $chartElement) {
|
||||
foreach ($chartElementsC as $chartElementKey => $chartElement) {
|
||||
switch ($chartElementKey) {
|
||||
case "chart":
|
||||
foreach($chartElement as $chartDetailsKey => $chartDetails) {
|
||||
foreach ($chartElement as $chartDetailsKey => $chartDetails) {
|
||||
$chartDetailsC = $chartDetails->children($namespacesChartMeta['c']);
|
||||
switch ($chartDetailsKey) {
|
||||
case "plotArea":
|
||||
$plotAreaLayout = $XaxisLable = $YaxisLable = null;
|
||||
$plotSeries = $plotAttributes = array();
|
||||
foreach($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
foreach ($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
switch ($chartDetailKey) {
|
||||
case "layout":
|
||||
$plotAreaLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'plotArea');
|
||||
$plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'plotArea');
|
||||
break;
|
||||
case "catAx":
|
||||
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;
|
||||
case "dateAx":
|
||||
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;
|
||||
case "valAx":
|
||||
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;
|
||||
case "barChart":
|
||||
case "bar3DChart":
|
||||
$barDirection = self::_getAttribute($chartDetail->barDir, 'val', 'string');
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotDirection($barDirection);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "lineChart":
|
||||
case "line3DChart":
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "areaChart":
|
||||
case "area3DChart":
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "doughnutChart":
|
||||
case "pieChart":
|
||||
case "pie3DChart":
|
||||
$explosion = isset($chartDetail->ser->explosion);
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotStyle($explosion);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "scatterChart":
|
||||
$scatterStyle = self::_getAttribute($chartDetail->scatterStyle, 'val', 'string');
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotStyle($scatterStyle);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "bubbleChart":
|
||||
$bubbleScale = self::_getAttribute($chartDetail->bubbleScale, 'val', 'integer');
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotStyle($bubbleScale);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "radarChart":
|
||||
$radarStyle = self::_getAttribute($chartDetail->radarStyle, 'val', 'string');
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotStyle($radarStyle);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
@ -147,13 +147,13 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
case "surfaceChart":
|
||||
case "surface3DChart":
|
||||
$wireFrame = self::_getAttribute($chartDetail->wireframe, 'val', 'boolean');
|
||||
$plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotSer->setPlotStyle($wireFrame);
|
||||
$plotSeries[] = $plotSer;
|
||||
$plotAttributes = self::_readChartAttributes($chartDetail);
|
||||
break;
|
||||
case "stockChart":
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey);
|
||||
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
|
||||
$plotAttributes = self::_readChartAttributes($plotAreaLayout);
|
||||
break;
|
||||
}
|
||||
@ -161,8 +161,8 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
if ($plotAreaLayout == NULL) {
|
||||
$plotAreaLayout = new PHPExcel_Chart_Layout();
|
||||
}
|
||||
$plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout,$plotSeries);
|
||||
self::_setChartAttributes($plotAreaLayout,$plotAttributes);
|
||||
$plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries);
|
||||
self::_setChartAttributes($plotAreaLayout, $plotAttributes);
|
||||
break;
|
||||
case "plotVisOnly":
|
||||
$plotVisOnly = self::_getAttribute($chartDetails, 'val', 'string');
|
||||
@ -171,13 +171,13 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
$dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string');
|
||||
break;
|
||||
case "title":
|
||||
$title = self::_chartTitle($chartDetails,$namespacesChartMeta,'title');
|
||||
$title = self::_chartTitle($chartDetails, $namespacesChartMeta,'title');
|
||||
break;
|
||||
case "legend":
|
||||
$legendPos = 'r';
|
||||
$legendLayout = null;
|
||||
$legendOverlay = false;
|
||||
foreach($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
foreach ($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
switch ($chartDetailKey) {
|
||||
case "legendPos":
|
||||
$legendPos = self::_getAttribute($chartDetail, 'val', 'string');
|
||||
@ -186,7 +186,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
$legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean');
|
||||
break;
|
||||
case "layout":
|
||||
$legendLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'legend');
|
||||
$legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'legend');
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -196,20 +196,20 @@ 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;
|
||||
} // function readChart()
|
||||
|
||||
|
||||
private static function _chartTitle($titleDetails,$namespacesChartMeta,$type) {
|
||||
private static function _chartTitle($titleDetails, $namespacesChartMeta, $type) {
|
||||
$caption = array();
|
||||
$titleLayout = null;
|
||||
foreach($titleDetails as $titleDetailKey => $chartDetail) {
|
||||
foreach ($titleDetails as $titleDetailKey => $chartDetail) {
|
||||
switch ($titleDetailKey) {
|
||||
case "tx":
|
||||
$titleDetails = $chartDetail->rich->children($namespacesChartMeta['a']);
|
||||
foreach($titleDetails as $titleKey => $titleDetail) {
|
||||
foreach ($titleDetails as $titleKey => $titleDetail) {
|
||||
switch ($titleKey) {
|
||||
case "p":
|
||||
$titleDetailPart = $titleDetail->children($namespacesChartMeta['a']);
|
||||
@ -218,7 +218,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
}
|
||||
break;
|
||||
case "layout":
|
||||
$titleLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta);
|
||||
$titleLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -227,7 +227,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
} // function _chartTitle()
|
||||
|
||||
|
||||
private static function _chartLayoutDetails($chartDetail,$namespacesChartMeta) {
|
||||
private static function _chartLayoutDetails($chartDetail, $namespacesChartMeta) {
|
||||
if (!isset($chartDetail->manualLayout)) {
|
||||
return null;
|
||||
}
|
||||
@ -236,7 +236,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
return null;
|
||||
}
|
||||
$layout = array();
|
||||
foreach($details as $detailKey => $detail) {
|
||||
foreach ($details as $detailKey => $detail) {
|
||||
// echo $detailKey,' => ',self::_getAttribute($detail, 'val', 'string'),PHP_EOL;
|
||||
$layout[$detailKey] = self::_getAttribute($detail, 'val', 'string');
|
||||
}
|
||||
@ -244,20 +244,20 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
} // function _chartLayoutDetails()
|
||||
|
||||
|
||||
private static function _chartDataSeries($chartDetail,$namespacesChartMeta,$plotType) {
|
||||
private static function _chartDataSeries($chartDetail, $namespacesChartMeta, $plotType) {
|
||||
$multiSeriesType = NULL;
|
||||
$smoothLine = false;
|
||||
$seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array();
|
||||
|
||||
$seriesDetailSet = $chartDetail->children($namespacesChartMeta['c']);
|
||||
foreach($seriesDetailSet as $seriesDetailKey => $seriesDetails) {
|
||||
foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) {
|
||||
switch ($seriesDetailKey) {
|
||||
case "grouping":
|
||||
$multiSeriesType = self::_getAttribute($chartDetail->grouping, 'val', 'string');
|
||||
break;
|
||||
case "ser":
|
||||
$marker = NULL;
|
||||
foreach($seriesDetails as $seriesKey => $seriesDetail) {
|
||||
foreach ($seriesDetails as $seriesKey => $seriesDetail) {
|
||||
switch ($seriesKey) {
|
||||
case "idx":
|
||||
$seriesIndex = self::_getAttribute($seriesDetail, 'val', 'integer');
|
||||
@ -267,7 +267,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
$plotOrder[$seriesIndex] = $seriesOrder;
|
||||
break;
|
||||
case "tx":
|
||||
$seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta);
|
||||
$seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
|
||||
break;
|
||||
case "marker":
|
||||
$marker = self::_getAttribute($seriesDetail->symbol, 'val', 'string');
|
||||
@ -276,22 +276,22 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
$smoothLine = self::_getAttribute($seriesDetail, 'val', 'boolean');
|
||||
break;
|
||||
case "cat":
|
||||
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta);
|
||||
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
|
||||
break;
|
||||
case "val":
|
||||
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
||||
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
|
||||
break;
|
||||
case "xVal":
|
||||
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
||||
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
|
||||
break;
|
||||
case "yVal":
|
||||
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker);
|
||||
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
|
||||
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()
|
||||
|
||||
|
||||
@ -300,35 +300,35 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
$seriesSource = (string) $seriesDetail->strRef->f;
|
||||
$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)) {
|
||||
$seriesSource = (string) $seriesDetail->numRef->f;
|
||||
$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)) {
|
||||
$seriesSource = (string) $seriesDetail->multiLvlStrRef->f;
|
||||
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']),'s');
|
||||
$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)) {
|
||||
$seriesSource = (string) $seriesDetail->multiLvlNumRef->f;
|
||||
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']),'s');
|
||||
$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;
|
||||
} // function _chartDataSeriesValueSet()
|
||||
|
||||
|
||||
private static function _chartDataSeriesValues($seriesValueSet,$dataType='n') {
|
||||
private static function _chartDataSeriesValues($seriesValueSet, $dataType='n') {
|
||||
$seriesVal = array();
|
||||
$formatCode = '';
|
||||
$pointCount = 0;
|
||||
|
||||
foreach($seriesValueSet as $seriesValueIdx => $seriesValue) {
|
||||
foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) {
|
||||
switch ($seriesValueIdx) {
|
||||
case 'ptCount':
|
||||
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
|
||||
@ -358,13 +358,13 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
} // function _chartDataSeriesValues()
|
||||
|
||||
|
||||
private static function _chartDataSeriesValuesMultiLevel($seriesValueSet,$dataType='n') {
|
||||
private static function _chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType='n') {
|
||||
$seriesVal = array();
|
||||
$formatCode = '';
|
||||
$pointCount = 0;
|
||||
|
||||
foreach($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) {
|
||||
foreach($seriesLevel as $seriesValueIdx => $seriesValue) {
|
||||
foreach ($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) {
|
||||
foreach ($seriesLevel as $seriesValueIdx => $seriesValue) {
|
||||
switch ($seriesValueIdx) {
|
||||
case 'ptCount':
|
||||
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
|
||||
@ -393,7 +393,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
private static function _parseRichText($titleDetailPart = null) {
|
||||
$value = new PHPExcel_RichText();
|
||||
|
||||
foreach($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
|
||||
foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
|
||||
if (isset($titleDetailElement->t)) {
|
||||
$objText = $value->createTextRun( (string) $titleDetailElement->t );
|
||||
}
|
||||
@ -426,7 +426,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
if (!is_null($baseline)) {
|
||||
if ($baseline > 0) {
|
||||
$objText->getFont()->setSuperScript(true);
|
||||
} elseif($baseline < 0) {
|
||||
} elseif ($baseline < 0) {
|
||||
$objText->getFont()->setSubScript(true);
|
||||
}
|
||||
}
|
||||
@ -435,7 +435,7 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
if (!is_null($underscore)) {
|
||||
if ($underscore == 'sng') {
|
||||
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
|
||||
} elseif($underscore == 'dbl') {
|
||||
} elseif ($underscore == 'dbl') {
|
||||
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE);
|
||||
} else {
|
||||
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_NONE);
|
||||
@ -485,10 +485,10 @@ class PHPExcel_Reader_Excel2007_Chart
|
||||
return $plotAttributes;
|
||||
}
|
||||
|
||||
private static function _setChartAttributes($plotArea,$plotAttributes)
|
||||
private static function _setChartAttributes($plotArea, $plotAttributes)
|
||||
{
|
||||
foreach($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
|
||||
switch($plotAttributeKey) {
|
||||
foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
|
||||
switch ($plotAttributeKey) {
|
||||
case 'showLegendKey' :
|
||||
$plotArea->setShowLegendKey($plotAttributeValue);
|
||||
break;
|
||||
|
@ -69,7 +69,7 @@ class PHPExcel_Reader_Excel2007_Theme
|
||||
* Create a new PHPExcel_Theme
|
||||
*
|
||||
*/
|
||||
public function __construct($themeName,$colourSchemeName,$colourMap)
|
||||
public function __construct($themeName, $colourSchemeName, $colourMap)
|
||||
{
|
||||
// Initialise values
|
||||
$this->_themeName = $themeName;
|
||||
|
@ -676,7 +676,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
if (!$this->_readDataOnly) {
|
||||
foreach ($this->_objFonts as $objFont) {
|
||||
if (isset($objFont->colorIndex)) {
|
||||
$color = self::_readColor($objFont->colorIndex,$this->_palette,$this->_version);
|
||||
$color = self::_readColor($objFont->colorIndex, $this->_palette, $this->_version);
|
||||
$objFont->getColor()->setRGB($color['rgb']);
|
||||
}
|
||||
}
|
||||
@ -686,12 +686,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$fill = $objStyle->getFill();
|
||||
|
||||
if (isset($fill->startcolorIndex)) {
|
||||
$startColor = self::_readColor($fill->startcolorIndex,$this->_palette,$this->_version);
|
||||
$startColor = self::_readColor($fill->startcolorIndex, $this->_palette, $this->_version);
|
||||
$fill->getStartColor()->setRGB($startColor['rgb']);
|
||||
}
|
||||
|
||||
if (isset($fill->endcolorIndex)) {
|
||||
$endColor = self::_readColor($fill->endcolorIndex,$this->_palette,$this->_version);
|
||||
$endColor = self::_readColor($fill->endcolorIndex, $this->_palette, $this->_version);
|
||||
$fill->getEndColor()->setRGB($endColor['rgb']);
|
||||
}
|
||||
|
||||
@ -703,27 +703,27 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$diagonal = $objStyle->getBorders()->getDiagonal();
|
||||
|
||||
if (isset($top->colorIndex)) {
|
||||
$borderTopColor = self::_readColor($top->colorIndex,$this->_palette,$this->_version);
|
||||
$borderTopColor = self::_readColor($top->colorIndex, $this->_palette, $this->_version);
|
||||
$top->getColor()->setRGB($borderTopColor['rgb']);
|
||||
}
|
||||
|
||||
if (isset($right->colorIndex)) {
|
||||
$borderRightColor = self::_readColor($right->colorIndex,$this->_palette,$this->_version);
|
||||
$borderRightColor = self::_readColor($right->colorIndex, $this->_palette, $this->_version);
|
||||
$right->getColor()->setRGB($borderRightColor['rgb']);
|
||||
}
|
||||
|
||||
if (isset($bottom->colorIndex)) {
|
||||
$borderBottomColor = self::_readColor($bottom->colorIndex,$this->_palette,$this->_version);
|
||||
$borderBottomColor = self::_readColor($bottom->colorIndex, $this->_palette, $this->_version);
|
||||
$bottom->getColor()->setRGB($borderBottomColor['rgb']);
|
||||
}
|
||||
|
||||
if (isset($left->colorIndex)) {
|
||||
$borderLeftColor = self::_readColor($left->colorIndex,$this->_palette,$this->_version);
|
||||
$borderLeftColor = self::_readColor($left->colorIndex, $this->_palette, $this->_version);
|
||||
$left->getColor()->setRGB($borderLeftColor['rgb']);
|
||||
}
|
||||
|
||||
if (isset($diagonal->colorIndex)) {
|
||||
$borderDiagonalColor = self::_readColor($diagonal->colorIndex,$this->_palette,$this->_version);
|
||||
$borderDiagonalColor = self::_readColor($diagonal->colorIndex, $this->_palette, $this->_version);
|
||||
$diagonal->getColor()->setRGB($borderDiagonalColor['rgb']);
|
||||
}
|
||||
}
|
||||
@ -863,7 +863,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
|
||||
// treat OBJ records
|
||||
foreach ($this->_objs as $n => $obj) {
|
||||
// echo '<hr /><b>Object</b> reference is ',$n,'<br />';
|
||||
// echo '<hr /><b>Object</b> reference is ', $n,'<br />';
|
||||
// var_dump($obj);
|
||||
// echo '<br />';
|
||||
|
||||
@ -896,7 +896,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
case 0x19:
|
||||
// Note
|
||||
// echo 'Cell Annotation Object<br />';
|
||||
// echo 'Object ID is ',$obj['idObjID'],'<br />';
|
||||
// echo 'Object ID is ', $obj['idObjID'],'<br />';
|
||||
//
|
||||
if (isset($this->_cellNotes[$obj['idObjID']])) {
|
||||
$cellNote = $this->_cellNotes[$obj['idObjID']];
|
||||
@ -969,7 +969,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
}
|
||||
|
||||
if (!empty($this->_cellNotes)) {
|
||||
foreach($this->_cellNotes as $note => $noteDetails) {
|
||||
foreach ($this->_cellNotes as $note => $noteDetails) {
|
||||
if (!isset($noteDetails['objTextData'])) {
|
||||
if (isset($this->_textObjects[$note])) {
|
||||
$textObject = $this->_textObjects[$note];
|
||||
@ -978,10 +978,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$noteDetails['objTextData']['text'] = '';
|
||||
}
|
||||
}
|
||||
// echo '<b>Cell annotation ',$note,'</b><br />';
|
||||
// echo '<b>Cell annotation ', $note,'</b><br />';
|
||||
// var_dump($noteDetails);
|
||||
// echo '<br />';
|
||||
$cellAddress = str_replace('$','',$noteDetails['cellRef']);
|
||||
$cellAddress = str_replace('$','', $noteDetails['cellRef']);
|
||||
$this->_phpSheet->getComment( $cellAddress )
|
||||
->setAuthor( $noteDetails['author'] )
|
||||
->setText($this->_parseRichText($noteDetails['objTextData']['text']) );
|
||||
@ -1353,21 +1353,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
// offset: 8; size: 16
|
||||
// offset: 24; size: 4; section count
|
||||
$secCount = self::_GetInt4d($this->_documentSummaryInformation, 24);
|
||||
// echo '$secCount = ',$secCount,'<br />';
|
||||
// echo '$secCount = ', $secCount,'<br />';
|
||||
|
||||
// offset: 28; size: 16; first section's class id: 02 d5 cd d5 9c 2e 1b 10 93 97 08 00 2b 2c f9 ae
|
||||
// offset: 44; size: 4; first section offset
|
||||
$secOffset = self::_GetInt4d($this->_documentSummaryInformation, 44);
|
||||
// echo '$secOffset = ',$secOffset,'<br />';
|
||||
// echo '$secOffset = ', $secOffset,'<br />';
|
||||
|
||||
// section header
|
||||
// offset: $secOffset; size: 4; section length
|
||||
$secLength = self::_GetInt4d($this->_documentSummaryInformation, $secOffset);
|
||||
// echo '$secLength = ',$secLength,'<br />';
|
||||
// echo '$secLength = ', $secLength,'<br />';
|
||||
|
||||
// offset: $secOffset+4; size: 4; property count
|
||||
$countProperties = self::_GetInt4d($this->_documentSummaryInformation, $secOffset+4);
|
||||
// echo '$countProperties = ',$countProperties,'<br />';
|
||||
// echo '$countProperties = ', $countProperties,'<br />';
|
||||
|
||||
// initialize code page (used to resolve string values)
|
||||
$codePage = 'CP1252';
|
||||
@ -1375,17 +1375,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
// offset: ($secOffset+8); size: var
|
||||
// loop through property decarations and properties
|
||||
for ($i = 0; $i < $countProperties; ++$i) {
|
||||
// echo 'Property ',$i,'<br />';
|
||||
// echo 'Property ', $i,'<br />';
|
||||
// offset: ($secOffset+8) + (8 * $i); size: 4; property ID
|
||||
$id = self::_GetInt4d($this->_documentSummaryInformation, ($secOffset+8) + (8 * $i));
|
||||
// echo 'ID is ',$id,'<br />';
|
||||
// echo 'ID is ', $id,'<br />';
|
||||
|
||||
// Use value of property id as appropriate
|
||||
// offset: 60 + 8 * $i; size: 4; offset from beginning of section (48)
|
||||
$offset = self::_GetInt4d($this->_documentSummaryInformation, ($secOffset+12) + (8 * $i));
|
||||
|
||||
$type = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + $offset);
|
||||
// echo 'Type is ',$type,', ';
|
||||
// echo 'Type is ', $type,', ';
|
||||
|
||||
// initialize property value
|
||||
$value = null;
|
||||
@ -1531,9 +1531,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$noteObjID = self::_GetInt2d($recordData, 6);
|
||||
$noteAuthor = self::_readUnicodeStringLong(substr($recordData, 8));
|
||||
$noteAuthor = $noteAuthor['value'];
|
||||
// echo 'Note Address=',$cellAddress,'<br />';
|
||||
// echo 'Note Object ID=',$noteObjID,'<br />';
|
||||
// echo 'Note Author=',$noteAuthor,'<hr />';
|
||||
// echo 'Note Address=', $cellAddress,'<br />';
|
||||
// echo 'Note Object ID=', $noteObjID,'<br />';
|
||||
// echo 'Note Author=', $noteAuthor,'<hr />';
|
||||
//
|
||||
$this->_cellNotes[$noteObjID] = array('cellRef' => $cellAddress,
|
||||
'objectID' => $noteObjID,
|
||||
@ -1549,13 +1549,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$extension = true;
|
||||
$cellAddress = array_pop(array_keys($this->_phpSheet->getComments()));
|
||||
}
|
||||
// echo 'Note Address=',$cellAddress,'<br />';
|
||||
// echo 'Note Address=', $cellAddress,'<br />';
|
||||
|
||||
$cellAddress = str_replace('$','',$cellAddress);
|
||||
$cellAddress = str_replace('$','', $cellAddress);
|
||||
$noteLength = self::_GetInt2d($recordData, 4);
|
||||
$noteText = trim(substr($recordData, 6));
|
||||
// echo 'Note Length=',$noteLength,'<br />';
|
||||
// echo 'Note Text=',$noteText,'<br />';
|
||||
// echo 'Note Length=', $noteLength,'<br />';
|
||||
// echo 'Note Text=', $noteText,'<br />';
|
||||
|
||||
if ($extension) {
|
||||
// Concatenate this extension with the currently set comment for the cell
|
||||
@ -1601,8 +1601,8 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$text = $this->_getSplicedRecordData();
|
||||
|
||||
$this->_textObjects[$this->textObjRef] = array(
|
||||
'text' => substr($text["recordData"],$text["spliceOffsets"][0]+1,$cchText),
|
||||
'format' => substr($text["recordData"],$text["spliceOffsets"][1],$cbRuns),
|
||||
'text' => substr($text["recordData"], $text["spliceOffsets"][0]+1, $cchText),
|
||||
'format' => substr($text["recordData"], $text["spliceOffsets"][1], $cbRuns),
|
||||
'alignment' => $grbitOpts,
|
||||
'rotation' => $rot
|
||||
);
|
||||
@ -4294,7 +4294,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
/**
|
||||
* Read PLV Record(Created by Excel2007 or upper)
|
||||
*/
|
||||
private function _readPageLayoutView(){
|
||||
private function _readPageLayoutView() {
|
||||
$length = self::_GetInt2d($this->_data, $this->_pos + 2);
|
||||
$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);
|
||||
|
||||
@ -4564,7 +4564,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$url = self::_encodeUTF16(substr($recordData, $offset, $us - 2), false);
|
||||
$nullOffset = strpos($url, 0x00);
|
||||
if ($nullOffset)
|
||||
$url = substr($url,0,$nullOffset);
|
||||
$url = substr($url,0, $nullOffset);
|
||||
$url .= $hasText ? '#' : '';
|
||||
$offset += $us;
|
||||
break;
|
||||
@ -4858,7 +4858,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
case 0x14:
|
||||
// offset: 16; size: 2; color index for sheet tab
|
||||
$colorIndex = self::_GetInt2d($recordData, 16);
|
||||
$color = self::_readColor($colorIndex,$this->_palette,$this->_version);
|
||||
$color = self::_readColor($colorIndex, $this->_palette, $this->_version);
|
||||
$this->_phpSheet->getTabColor()->setRGB($color['rgb']);
|
||||
break;
|
||||
|
||||
@ -6807,7 +6807,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
* @param array $palette Color palette
|
||||
* @return array RGB color value, example: array('rgb' => 'FF0000')
|
||||
*/
|
||||
private static function _readColor($color,$palette,$version)
|
||||
private static function _readColor($color, $palette, $version)
|
||||
{
|
||||
if ($color <= 0x07 || $color >= 0x40) {
|
||||
// special built-in color
|
||||
|
@ -257,13 +257,13 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$officeDocXML = $officeXML->{'document-meta'};
|
||||
$officeDocMetaXML = $officeDocXML->meta;
|
||||
|
||||
foreach($officeDocMetaXML as $officePropertyData) {
|
||||
foreach ($officeDocMetaXML as $officePropertyData) {
|
||||
|
||||
$officePropertyDC = array();
|
||||
if (isset($namespacesMeta['dc'])) {
|
||||
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
|
||||
}
|
||||
foreach($officePropertyDC as $propertyName => $propertyValue) {
|
||||
foreach ($officePropertyDC as $propertyName => $propertyValue) {
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
case 'title' :
|
||||
@ -290,7 +290,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
if (isset($namespacesMeta['meta'])) {
|
||||
$officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']);
|
||||
}
|
||||
foreach($officePropertyMeta as $propertyName => $propertyValue) {
|
||||
foreach ($officePropertyMeta as $propertyName => $propertyValue) {
|
||||
$attributes = $propertyValue->attributes($namespacesMeta['meta']);
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
@ -307,7 +307,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$docProps->setModified($creationDate);
|
||||
break;
|
||||
case 'user-defined' :
|
||||
list(,$attrName) = explode(':',$attributes['name']);
|
||||
list(, $attrName) = explode(':', $attributes['name']);
|
||||
switch ($attrName) {
|
||||
case 'publisher' :
|
||||
$docProps->setCompany(trim($propertyValue));
|
||||
@ -324,7 +324,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
}
|
||||
}
|
||||
} elseif (isset($gnmXML->Summary)) {
|
||||
foreach($gnmXML->Summary->Item as $summaryItem) {
|
||||
foreach ($gnmXML->Summary->Item as $summaryItem) {
|
||||
$propertyName = $summaryItem->name;
|
||||
$propertyValue = $summaryItem->{'val-string'};
|
||||
switch ($propertyName) {
|
||||
@ -355,9 +355,9 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
}
|
||||
|
||||
$worksheetID = 0;
|
||||
foreach($gnmXML->Sheets->Sheet as $sheet) {
|
||||
foreach ($gnmXML->Sheets->Sheet as $sheet) {
|
||||
$worksheetName = (string) $sheet->Name;
|
||||
// echo '<b>Worksheet: ',$worksheetName,'</b><br />';
|
||||
// echo '<b>Worksheet: ', $worksheetName,'</b><br />';
|
||||
if ((isset($this->_loadSheetsOnly)) && (!in_array($worksheetName, $this->_loadSheetsOnly))) {
|
||||
continue;
|
||||
}
|
||||
@ -374,15 +374,15 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
|
||||
if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) {
|
||||
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();
|
||||
$marginSize = 72 / 100; // Default
|
||||
switch($marginAttributes['PrefUnit']) {
|
||||
switch ($marginAttributes['PrefUnit']) {
|
||||
case 'mm' :
|
||||
$marginSize = intval($marginAttributes['Points']) / 100;
|
||||
break;
|
||||
}
|
||||
switch($key) {
|
||||
switch ($key) {
|
||||
case 'top' :
|
||||
$objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize);
|
||||
break;
|
||||
@ -406,7 +406,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
}
|
||||
}
|
||||
|
||||
foreach($sheet->Cells->Cell as $cell) {
|
||||
foreach ($sheet->Cells->Cell as $cell) {
|
||||
$cellAttributes = $cell->attributes();
|
||||
$row = (int) $cellAttributes->Row + 1;
|
||||
$column = (int) $cellAttributes->Col;
|
||||
@ -425,9 +425,9 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
|
||||
$ValueType = $cellAttributes->ValueType;
|
||||
$ExprID = (string) $cellAttributes->ExprID;
|
||||
// echo 'Cell ',$column,$row,'<br />';
|
||||
// echo 'Type is ',$ValueType,'<br />';
|
||||
// echo 'Value is ',$cell,'<br />';
|
||||
// echo 'Cell ', $column, $row,'<br />';
|
||||
// echo 'Type is ', $ValueType,'<br />';
|
||||
// echo 'Value is ', $cell,'<br />';
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
if ($ExprID > '') {
|
||||
if (((string) $cell) > '') {
|
||||
@ -436,7 +436,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
'row' => $cellAttributes->Row,
|
||||
'formula' => (string) $cell
|
||||
);
|
||||
// echo 'NEW EXPRESSION ',$ExprID,'<br />';
|
||||
// echo 'NEW EXPRESSION ', $ExprID,'<br />';
|
||||
} else {
|
||||
$expression = $this->_expressions[$ExprID];
|
||||
|
||||
@ -446,12 +446,12 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$cellAttributes->Row - $expression['row'],
|
||||
$worksheetName
|
||||
);
|
||||
// echo 'SHARED EXPRESSION ',$ExprID,'<br />';
|
||||
// echo 'New Value is ',$cell,'<br />';
|
||||
// echo 'SHARED EXPRESSION ', $ExprID,'<br />';
|
||||
// echo 'New Value is ', $cell,'<br />';
|
||||
}
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
} else {
|
||||
switch($ValueType) {
|
||||
switch ($ValueType) {
|
||||
case '10' : // NULL
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NULL;
|
||||
break;
|
||||
@ -474,11 +474,11 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
case '80' : // Array
|
||||
}
|
||||
}
|
||||
$objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell,$type);
|
||||
$objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell, $type);
|
||||
}
|
||||
|
||||
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();
|
||||
// Only comment objects are handled at the moment
|
||||
if ($commentAttributes->Text) {
|
||||
@ -488,9 +488,9 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
}
|
||||
}
|
||||
}
|
||||
// echo '$maxCol=',$maxCol,'; $maxRow=',$maxRow,'<br />';
|
||||
// echo '$maxCol=', $maxCol,'; $maxRow=', $maxRow,'<br />';
|
||||
//
|
||||
foreach($sheet->Styles->StyleRegion as $styleRegion) {
|
||||
foreach ($sheet->Styles->StyleRegion as $styleRegion) {
|
||||
$styleAttributes = $styleRegion->attributes();
|
||||
if (($styleAttributes['startRow'] <= $maxRow) &&
|
||||
($styleAttributes['startCol'] <= $maxCol)) {
|
||||
@ -516,7 +516,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$styleArray['numberformat']['code'] = (string) $styleAttributes['Format'];
|
||||
// If _readDataOnly is false, we set all formatting information
|
||||
if (!$this->_readDataOnly) {
|
||||
switch($styleAttributes['HAlign']) {
|
||||
switch ($styleAttributes['HAlign']) {
|
||||
case '1' :
|
||||
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
break;
|
||||
@ -538,7 +538,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
break;
|
||||
}
|
||||
|
||||
switch($styleAttributes['VAlign']) {
|
||||
switch ($styleAttributes['VAlign']) {
|
||||
case '1' :
|
||||
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP;
|
||||
break;
|
||||
@ -565,7 +565,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$styleArray['fill']['color']['rgb'] = $styleArray['fill']['startcolor']['rgb'] = $RGB;
|
||||
$RGB2 = self::_parseGnumericColour($styleAttributes["PatternColor"]);
|
||||
$styleArray['fill']['endcolor']['rgb'] = $RGB2;
|
||||
switch($shade) {
|
||||
switch ($shade) {
|
||||
case '1' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID;
|
||||
break;
|
||||
@ -637,7 +637,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? True : False;
|
||||
$styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? True : False;
|
||||
$styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? True : False;
|
||||
switch($fontAttributes['Underline']) {
|
||||
switch ($fontAttributes['Underline']) {
|
||||
case '1' :
|
||||
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE;
|
||||
break;
|
||||
@ -654,7 +654,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE;
|
||||
break;
|
||||
}
|
||||
switch($fontAttributes['Script']) {
|
||||
switch ($fontAttributes['Script']) {
|
||||
case '1' :
|
||||
$styleArray['font']['superScript'] = True;
|
||||
break;
|
||||
@ -704,7 +704,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$columnAttributes = $sheet->Cols->attributes();
|
||||
$defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4;
|
||||
$c = 0;
|
||||
foreach($sheet->Cols->ColInfo as $columnOverride) {
|
||||
foreach ($sheet->Cols->ColInfo as $columnOverride) {
|
||||
$columnAttributes = $columnOverride->attributes();
|
||||
$column = $columnAttributes['No'];
|
||||
$columnWidth = $columnAttributes['Unit'] / 5.4;
|
||||
@ -734,7 +734,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
$defaultHeight = $rowAttributes['DefaultSizePts'];
|
||||
$r = 0;
|
||||
|
||||
foreach($sheet->Rows->RowInfo as $rowOverride) {
|
||||
foreach ($sheet->Rows->RowInfo as $rowOverride) {
|
||||
$rowAttributes = $rowOverride->attributes();
|
||||
$row = $rowAttributes['No'];
|
||||
$rowHeight = $rowAttributes['Unit'];
|
||||
@ -760,7 +760,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
|
||||
// Handle Merged Cells in this worksheet
|
||||
if (isset($sheet->MergedRegions)) {
|
||||
foreach($sheet->MergedRegions->Merge as $mergeCells) {
|
||||
foreach ($sheet->MergedRegions->Merge as $mergeCells) {
|
||||
if (strpos($mergeCells,':') !== FALSE) {
|
||||
$objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
|
||||
}
|
||||
@ -772,14 +772,14 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
|
||||
// Loop through definedNames (global named ranges)
|
||||
if (isset($gnmXML->Names)) {
|
||||
foreach($gnmXML->Names->Name as $namedRange) {
|
||||
foreach ($gnmXML->Names->Name as $namedRange) {
|
||||
$name = (string) $namedRange->name;
|
||||
$range = (string) $namedRange->value;
|
||||
if (stripos($range, '#REF!') !== false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$range = explode('!',$range);
|
||||
$range = explode('!', $range);
|
||||
$range[0] = trim($range[0],"'");;
|
||||
if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
|
||||
$extractedRange = str_replace('$', '', $range[1]);
|
||||
@ -861,12 +861,12 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
|
||||
|
||||
|
||||
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);
|
||||
$gnmG = substr(str_pad($gnmG,4,'0',STR_PAD_RIGHT),0,2);
|
||||
$gnmB = substr(str_pad($gnmB,4,'0',STR_PAD_RIGHT),0,2);
|
||||
$RGB = $gnmR.$gnmG.$gnmB;
|
||||
// echo 'Excel Colour: ',$RGB,'<br />';
|
||||
// echo 'Excel Colour: ', $RGB,'<br />';
|
||||
return $RGB;
|
||||
}
|
||||
|
||||
|
@ -89,12 +89,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$stat = $zip->statName('mimetype');
|
||||
if ($stat && ($stat['size'] <= 255)) {
|
||||
$mimeType = $zip->getFromName($stat['name']);
|
||||
} elseif($stat = $zip->statName('META-INF/manifest.xml')) {
|
||||
} elseif ($stat = $zip->statName('META-INF/manifest.xml')) {
|
||||
$xml = simplexml_load_string($this->securityScan($zip->getFromName('META-INF/manifest.xml')), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||
$namespacesContent = $xml->getNamespaces(true);
|
||||
if (isset($namespacesContent['manifest'])) {
|
||||
$manifest = $xml->children($namespacesContent['manifest']);
|
||||
foreach($manifest as $manifestDataSet) {
|
||||
foreach ($manifest as $manifestDataSet) {
|
||||
$manifestAttributes = $manifestDataSet->attributes($namespacesContent['manifest']);
|
||||
if ($manifestAttributes->{'full-path'} == '/') {
|
||||
$mimeType = (string) $manifestAttributes->{'media-type'};
|
||||
@ -222,7 +222,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$rowspan = $xml->getAttribute('table:number-rows-repeated');
|
||||
$rowspan = empty($rowspan) ? 1 : $rowspan;
|
||||
$tmpInfo['totalRows'] += $rowspan;
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells);
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
||||
$currCells = 0;
|
||||
// Step into the row
|
||||
$xml->read();
|
||||
@ -243,14 +243,14 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
}
|
||||
} while ($xml->name != 'table:table');
|
||||
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells);
|
||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
||||
$tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1;
|
||||
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||
$worksheetInfo[] = $tmpInfo;
|
||||
}
|
||||
}
|
||||
|
||||
// foreach($workbookData->table as $worksheetDataSet) {
|
||||
// foreach ($workbookData->table as $worksheetDataSet) {
|
||||
// $worksheetData = $worksheetDataSet->children($namespacesContent['table']);
|
||||
// $worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']);
|
||||
//
|
||||
@ -309,7 +309,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
|
||||
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
|
||||
$styleAttributeValue = strtolower($styleAttributeValue);
|
||||
foreach($styleList as $style) {
|
||||
foreach ($styleList as $style) {
|
||||
if ($styleAttributeValue == strtolower($style)) {
|
||||
$styleAttributeValue = $style;
|
||||
return true;
|
||||
@ -353,12 +353,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
|
||||
$docProps = $objPHPExcel->getProperties();
|
||||
$officeProperty = $xml->children($namespacesMeta['office']);
|
||||
foreach($officeProperty as $officePropertyData) {
|
||||
foreach ($officeProperty as $officePropertyData) {
|
||||
$officePropertyDC = array();
|
||||
if (isset($namespacesMeta['dc'])) {
|
||||
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
|
||||
}
|
||||
foreach($officePropertyDC as $propertyName => $propertyValue) {
|
||||
foreach ($officePropertyDC as $propertyName => $propertyValue) {
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
case 'title' :
|
||||
@ -385,7 +385,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
if (isset($namespacesMeta['dc'])) {
|
||||
$officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']);
|
||||
}
|
||||
foreach($officePropertyMeta as $propertyName => $propertyValue) {
|
||||
foreach ($officePropertyMeta as $propertyName => $propertyValue) {
|
||||
$propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
@ -404,7 +404,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
foreach ($propertyValueAttributes as $key => $value) {
|
||||
if ($key == 'name') {
|
||||
$propertyValueName = (string) $value;
|
||||
} elseif($key == 'value-type') {
|
||||
} elseif ($key == 'value-type') {
|
||||
switch ($value) {
|
||||
case 'date' :
|
||||
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'date');
|
||||
@ -423,7 +423,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
}
|
||||
}
|
||||
}
|
||||
$docProps->setCustomProperty($propertyValueName,$propertyValue,$propertyValueType);
|
||||
$docProps->setCustomProperty($propertyValueName, $propertyValue, $propertyValueType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -438,10 +438,10 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
// echo '</pre><hr />';
|
||||
|
||||
$workbook = $xml->children($namespacesContent['office']);
|
||||
foreach($workbook->body->spreadsheet as $workbookData) {
|
||||
foreach ($workbook->body->spreadsheet as $workbookData) {
|
||||
$workbookData = $workbookData->children($namespacesContent['table']);
|
||||
$worksheetID = 0;
|
||||
foreach($workbookData->table as $worksheetDataSet) {
|
||||
foreach ($workbookData->table as $worksheetDataSet) {
|
||||
$worksheetData = $worksheetDataSet->children($namespacesContent['table']);
|
||||
// print_r($worksheetData);
|
||||
// echo '<br />';
|
||||
@ -466,7 +466,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
}
|
||||
|
||||
$rowID = 1;
|
||||
foreach($worksheetData as $key => $rowData) {
|
||||
foreach ($worksheetData as $key => $rowData) {
|
||||
// echo '<b>'.$key.'</b><br />';
|
||||
switch ($key) {
|
||||
case 'table-header-rows':
|
||||
@ -479,7 +479,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ?
|
||||
$rowDataTableAttributes['number-rows-repeated'] : 1;
|
||||
$columnID = 'A';
|
||||
foreach($rowData as $key => $cellData) {
|
||||
foreach ($rowData as $key => $cellData) {
|
||||
if ($this->getReadFilter() !== NULL) {
|
||||
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
||||
continue;
|
||||
@ -514,16 +514,16 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
// echo 'Cell has comment<br />';
|
||||
$annotationText = $cellDataOffice->annotation->children($namespacesContent['text']);
|
||||
$textArray = array();
|
||||
foreach($annotationText as $t) {
|
||||
foreach ($annotationText as $t) {
|
||||
if (isset($t->span)) {
|
||||
foreach($t->span as $text) {
|
||||
foreach ($t->span as $text) {
|
||||
$textArray[] = (string)$text;
|
||||
}
|
||||
} else {
|
||||
$textArray[] = (string) $t;
|
||||
}
|
||||
}
|
||||
$text = implode("\n",$textArray);
|
||||
$text = implode("\n", $textArray);
|
||||
// echo $text,'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID )
|
||||
// ->setAuthor( $author )
|
||||
@ -596,8 +596,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT);
|
||||
$dateObj->setTimeZone($timezoneObj);
|
||||
list($year,$month,$day,$hour,$minute,$second) = explode(' ',$dateObj->format('Y m d H i s'));
|
||||
$dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year,$month,$day,$hour,$minute,$second);
|
||||
list($year, $month, $day, $hour, $minute, $second) = explode(' ', $dateObj->format('Y m d H i s'));
|
||||
$dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day, $hour, $minute, $second);
|
||||
if ($dataValue != floor($dataValue)) {
|
||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15.' '.PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
|
||||
} else {
|
||||
@ -623,21 +623,21 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
// echo 'Formula: ', $cellDataFormula, PHP_EOL;
|
||||
$cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula,':=')+1);
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
$temp = explode('"', $cellDataFormula);
|
||||
$tKey = false;
|
||||
foreach($temp as &$value) {
|
||||
foreach ($temp as &$value) {
|
||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||
if ($tKey = !$tKey) {
|
||||
$value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui','$1!$2:$3',$value); // Cell range reference in another sheet
|
||||
$value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui','$1!$2',$value); // Cell reference in another sheet
|
||||
$value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui','$1:$2',$value); // Cell range reference
|
||||
$value = preg_replace('/\[\.([^\.]+)\]/Ui','$1',$value); // Simple cell reference
|
||||
$value = PHPExcel_Calculation::_translateSeparator(';',',',$value,$inBraces);
|
||||
$value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui','$1!$2:$3', $value); // Cell range reference in another sheet
|
||||
$value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui','$1!$2', $value); // Cell reference in another sheet
|
||||
$value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui','$1:$2', $value); // Cell range reference
|
||||
$value = preg_replace('/\[\.([^\.]+)\]/Ui','$1', $value); // Simple cell reference
|
||||
$value = PHPExcel_Calculation::_translateSeparator(';',',', $value, $inBraces);
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
// Then rebuild the formula string
|
||||
$cellDataFormula = implode('"',$temp);
|
||||
$cellDataFormula = implode('"', $temp);
|
||||
// echo 'Adjusted Formula: ', $cellDataFormula, PHP_EOL;
|
||||
}
|
||||
|
||||
@ -651,7 +651,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
if ($type !== PHPExcel_Cell_DataType::TYPE_NULL) {
|
||||
for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) {
|
||||
$rID = $rowID + $rowAdjust;
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type);
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue), $type);
|
||||
if ($hasCalculatedValue) {
|
||||
// echo 'Forumla result is '.$dataValue.'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue);
|
||||
|
@ -167,8 +167,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
$dataType = array_shift($rowData);
|
||||
if ($dataType == 'C') {
|
||||
// Read cell value data
|
||||
foreach($rowData as $rowDatum) {
|
||||
switch($rowDatum{0}) {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'C' :
|
||||
case 'X' :
|
||||
$columnIndex = substr($rowDatum,1) - 1;
|
||||
@ -256,9 +256,9 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
// Read shared styles
|
||||
if ($dataType == 'P') {
|
||||
$formatArray = array();
|
||||
foreach($rowData as $rowDatum) {
|
||||
switch($rowDatum{0}) {
|
||||
case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats,$toFormats,substr($rowDatum,1));
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats,substr($rowDatum,1));
|
||||
break;
|
||||
case 'E' :
|
||||
case 'F' : $formatArray['font']['name'] = substr($rowDatum,1);
|
||||
@ -290,8 +290,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
} elseif ($dataType == 'C') {
|
||||
$hasCalculatedValue = false;
|
||||
$cellData = $cellDataFormula = '';
|
||||
foreach($rowData as $rowDatum) {
|
||||
switch($rowDatum{0}) {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'C' :
|
||||
case 'X' : $column = substr($rowDatum,1);
|
||||
break;
|
||||
@ -302,19 +302,19 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
break;
|
||||
case 'E' : $cellDataFormula = '='.substr($rowDatum,1);
|
||||
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
$temp = explode('"', $cellDataFormula);
|
||||
$key = false;
|
||||
foreach($temp as &$value) {
|
||||
foreach ($temp as &$value) {
|
||||
// Only count/replace in alternate array entries
|
||||
if ($key = !$key) {
|
||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
|
||||
// through the formula from left to right. Reversing means that we work right to left.through
|
||||
// the formula
|
||||
$cellReferences = array_reverse($cellReferences);
|
||||
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
|
||||
// then modify the formula to use that new reference
|
||||
foreach($cellReferences as $cellReference) {
|
||||
foreach ($cellReferences as $cellReference) {
|
||||
$rowReference = $cellReference[2][0];
|
||||
// Empty R reference is the current row
|
||||
if ($rowReference == '') $rowReference = $row;
|
||||
@ -327,13 +327,13 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]');
|
||||
$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]));
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
// Then rebuild the formula string
|
||||
$cellDataFormula = implode('"',$temp);
|
||||
$cellDataFormula = implode('"', $temp);
|
||||
$hasCalculatedValue = true;
|
||||
break;
|
||||
}
|
||||
@ -351,8 +351,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
} elseif ($dataType == 'F') {
|
||||
$formatStyle = $columnWidth = $styleSettings = '';
|
||||
$styleData = array();
|
||||
foreach($rowData as $rowDatum) {
|
||||
switch($rowDatum{0}) {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'C' :
|
||||
case 'X' : $column = substr($rowDatum,1);
|
||||
break;
|
||||
@ -361,7 +361,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
break;
|
||||
case 'P' : $formatStyle = $rowDatum;
|
||||
break;
|
||||
case 'W' : list($startCol,$endCol,$columnWidth) = explode(' ',substr($rowDatum,1));
|
||||
case 'W' : list($startCol, $endCol, $columnWidth) = explode(' ',substr($rowDatum,1));
|
||||
break;
|
||||
case 'S' : $styleSettings = substr($rowDatum,1);
|
||||
for ($i=0;$i<strlen($styleSettings);++$i) {
|
||||
@ -407,8 +407,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach($rowData as $rowDatum) {
|
||||
switch($rowDatum{0}) {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'C' :
|
||||
case 'X' : $column = substr($rowDatum,1);
|
||||
break;
|
||||
|
@ -416,7 +416,7 @@ class PHPExcel_ReferenceHelper
|
||||
}
|
||||
|
||||
// Loop through cells, bottom-up, and change cell coordinates
|
||||
if($remove) {
|
||||
if ($remove) {
|
||||
// It's faster to reverse and pop than to use unshift, especially with large cell collections
|
||||
$aCellCollection = array_reverse($aCellCollection);
|
||||
}
|
||||
@ -548,7 +548,7 @@ class PHPExcel_ReferenceHelper
|
||||
if (count($autoFilterColumns) > 0) {
|
||||
sscanf($pBefore,'%[A-Z]%d', $column, $row);
|
||||
$columnIndex = PHPExcel_Cell::columnIndexFromString($column);
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
|
||||
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
|
||||
if ($columnIndex <= $rangeEnd[0]) {
|
||||
if ($pNumCols < 0) {
|
||||
// If we're actually deleting any columns that fall within the autofilter range,
|
||||
@ -556,7 +556,7 @@ class PHPExcel_ReferenceHelper
|
||||
$deleteColumn = $columnIndex + $pNumCols - 1;
|
||||
$deleteCount = abs($pNumCols);
|
||||
for ($i = 1; $i <= $deleteCount; ++$i) {
|
||||
if (in_array(PHPExcel_Cell::stringFromColumnIndex($deleteColumn),$autoFilterColumns)) {
|
||||
if (in_array(PHPExcel_Cell::stringFromColumnIndex($deleteColumn), $autoFilterColumns)) {
|
||||
$autoFilter->clearColumn(PHPExcel_Cell::stringFromColumnIndex($deleteColumn));
|
||||
}
|
||||
++$deleteColumn;
|
||||
@ -586,7 +586,7 @@ class PHPExcel_ReferenceHelper
|
||||
$toColID = PHPExcel_Cell::stringFromColumnIndex($startCol+$pNumCols-1);
|
||||
$endColID = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]);
|
||||
do {
|
||||
$autoFilter->shiftColumn($startColID,$toColID);
|
||||
$autoFilter->shiftColumn($startColID, $toColID);
|
||||
++$startColID;
|
||||
++$toColID;
|
||||
} while ($startColID != $endColID);
|
||||
@ -644,9 +644,9 @@ class PHPExcel_ReferenceHelper
|
||||
*/
|
||||
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
|
||||
// Update cell references in the formula
|
||||
$formulaBlocks = explode('"',$pFormula);
|
||||
$formulaBlocks = explode('"', $pFormula);
|
||||
$i = false;
|
||||
foreach($formulaBlocks as &$formulaBlock) {
|
||||
foreach ($formulaBlocks as &$formulaBlock) {
|
||||
// Ignore blocks that were enclosed in quotes (alternating entries in the $formulaBlocks array after the explode)
|
||||
if ($i = !$i) {
|
||||
$adjustCount = 0;
|
||||
@ -654,11 +654,11 @@ class PHPExcel_ReferenceHelper
|
||||
// Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5)
|
||||
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_ROWRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
|
||||
if ($matchCount > 0) {
|
||||
foreach($matches as $match) {
|
||||
foreach ($matches as $match) {
|
||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$fromString .= $match[3].':'.$match[4];
|
||||
$modified3 = substr($this->updateCellReference('$A'.$match[3],$pBefore,$pNumCols,$pNumRows),2);
|
||||
$modified4 = substr($this->updateCellReference('$A'.$match[4],$pBefore,$pNumCols,$pNumRows),2);
|
||||
$modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows),2);
|
||||
$modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows),2);
|
||||
|
||||
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
|
||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||
@ -679,11 +679,11 @@ class PHPExcel_ReferenceHelper
|
||||
// Search for column ranges (e.g. 'Sheet1'!C:E or C:E) with or without $ absolutes (e.g. $C:E)
|
||||
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_COLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
|
||||
if ($matchCount > 0) {
|
||||
foreach($matches as $match) {
|
||||
foreach ($matches as $match) {
|
||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$fromString .= $match[3].':'.$match[4];
|
||||
$modified3 = substr($this->updateCellReference($match[3].'$1',$pBefore,$pNumCols,$pNumRows),0,-2);
|
||||
$modified4 = substr($this->updateCellReference($match[4].'$1',$pBefore,$pNumCols,$pNumRows),0,-2);
|
||||
$modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows),0,-2);
|
||||
$modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows),0,-2);
|
||||
|
||||
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
|
||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||
@ -704,17 +704,17 @@ class PHPExcel_ReferenceHelper
|
||||
// Search for cell ranges (e.g. 'Sheet1'!A3:C5 or A3:C5) with or without $ absolutes (e.g. $A1:C$5)
|
||||
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
|
||||
if ($matchCount > 0) {
|
||||
foreach($matches as $match) {
|
||||
foreach ($matches as $match) {
|
||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$fromString .= $match[3].':'.$match[4];
|
||||
$modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
|
||||
$modified4 = $this->updateCellReference($match[4],$pBefore,$pNumCols,$pNumRows);
|
||||
$modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows);
|
||||
$modified4 = $this->updateCellReference($match[4], $pBefore, $pNumCols, $pNumRows);
|
||||
|
||||
if ($match[3].$match[4] !== $modified3.$modified4) {
|
||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||
$toString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$toString .= $modified3.':'.$modified4;
|
||||
list($column,$row) = PHPExcel_Cell::coordinateFromString($match[3]);
|
||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($match[3]);
|
||||
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
|
||||
$column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000;
|
||||
$row = trim($row,'$') + 10000000;
|
||||
@ -731,16 +731,16 @@ class PHPExcel_ReferenceHelper
|
||||
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
|
||||
|
||||
if ($matchCount > 0) {
|
||||
foreach($matches as $match) {
|
||||
foreach ($matches as $match) {
|
||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$fromString .= $match[3];
|
||||
|
||||
$modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
|
||||
$modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows);
|
||||
if ($match[3] !== $modified3) {
|
||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||
$toString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$toString .= $modified3;
|
||||
list($column,$row) = PHPExcel_Cell::coordinateFromString($match[3]);
|
||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($match[3]);
|
||||
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
|
||||
$column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000;
|
||||
$row = trim($row,'$') + 10000000;
|
||||
@ -761,14 +761,14 @@ class PHPExcel_ReferenceHelper
|
||||
ksort($cellTokens);
|
||||
ksort($newCellTokens);
|
||||
} // Update cell references in the formula
|
||||
$formulaBlock = str_replace('\\','',preg_replace($cellTokens,$newCellTokens,$formulaBlock));
|
||||
$formulaBlock = str_replace('\\','',preg_replace($cellTokens, $newCellTokens, $formulaBlock));
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($formulaBlock);
|
||||
|
||||
// Then rebuild the formula string
|
||||
return implode('"',$formulaBlocks);
|
||||
return implode('"', $formulaBlocks);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -846,7 +846,7 @@ class PHPExcel_ReferenceHelper
|
||||
if (ctype_alpha($range[$i][$j])) {
|
||||
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows));
|
||||
$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));
|
||||
$range[$i][$j] = $r[1];
|
||||
} else {
|
||||
|
@ -162,7 +162,7 @@ class PHPExcel_Shared_Date
|
||||
$seconds = round($time) - ($hours * 3600) - ($minutes * 60);
|
||||
|
||||
$dateObj = date_create('1-Jan-1970+'.$days.' days');
|
||||
$dateObj->setTime($hours,$minutes,$seconds);
|
||||
$dateObj->setTime($hours, $minutes, $seconds);
|
||||
|
||||
return $dateObj;
|
||||
}
|
||||
@ -188,8 +188,8 @@ class PHPExcel_Shared_Date
|
||||
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
|
||||
);
|
||||
} elseif (is_numeric($dateValue)) {
|
||||
$retValue = self::FormattedPHPToExcel( date('Y',$dateValue), date('m',$dateValue), date('d',$dateValue),
|
||||
date('H',$dateValue), date('i',$dateValue), date('s',$dateValue)
|
||||
$retValue = self::FormattedPHPToExcel( date('Y', $dateValue), date('m', $dateValue), date('d', $dateValue),
|
||||
date('H', $dateValue), date('i', $dateValue), date('s', $dateValue)
|
||||
);
|
||||
}
|
||||
date_default_timezone_set($saveTimeZone);
|
||||
@ -327,7 +327,7 @@ class PHPExcel_Shared_Date
|
||||
// we don't want to test for any of our characters within the quoted blocks
|
||||
if (strpos($pFormatCode, '"') !== false) {
|
||||
$segMatcher = false;
|
||||
foreach(explode('"', $pFormatCode) as $subVal) {
|
||||
foreach (explode('"', $pFormatCode) as $subVal) {
|
||||
// Only test in alternate array entries (the non-quoted blocks)
|
||||
if (($segMatcher = !$segMatcher) &&
|
||||
(preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i', $subVal))) {
|
||||
@ -376,7 +376,7 @@ class PHPExcel_Shared_Date
|
||||
public static function monthStringToNumber($month)
|
||||
{
|
||||
$monthIndex = 1;
|
||||
foreach(self::$monthNames as $shortMonthName => $longMonthName) {
|
||||
foreach (self::$monthNames as $shortMonthName => $longMonthName) {
|
||||
if (($month === $longMonthName) || ($month === $shortMonthName)) {
|
||||
return $monthIndex;
|
||||
}
|
||||
|
@ -181,10 +181,10 @@ class PHPExcel_Shared_Drawing
|
||||
// Load the image into a string
|
||||
$file = fopen($p_sFile,"rb");
|
||||
$read = fread($file,10);
|
||||
while(!feof($file)&&($read<>""))
|
||||
while (!feof($file)&&($read<>""))
|
||||
$read .= fread($file,1024);
|
||||
|
||||
$temp = unpack("H*",$read);
|
||||
$temp = unpack("H*", $read);
|
||||
$hex = $temp[1];
|
||||
$header = substr($hex,0,108);
|
||||
|
||||
@ -210,7 +210,7 @@ class PHPExcel_Shared_Drawing
|
||||
$y = 1;
|
||||
|
||||
// Create newimage
|
||||
$image = imagecreatetruecolor($width,$height);
|
||||
$image = imagecreatetruecolor($width, $height);
|
||||
|
||||
// Grab the body from the image
|
||||
$body = substr($hex,108);
|
||||
@ -255,8 +255,8 @@ class PHPExcel_Shared_Drawing
|
||||
$b = hexdec($body[$i_pos].$body[$i_pos+1]);
|
||||
|
||||
// Calculate and draw the pixel
|
||||
$color = imagecolorallocate($image,$r,$g,$b);
|
||||
imagesetpixel($image,$x,$height-$y,$color);
|
||||
$color = imagecolorallocate($image, $r, $g, $b);
|
||||
imagesetpixel($image, $x, $height-$y, $color);
|
||||
|
||||
// Raise the horizontal position
|
||||
$x++;
|
||||
|
@ -111,7 +111,7 @@ class PHPExcel_Shared_File
|
||||
// Found something?
|
||||
if ($returnValue == '' || ($returnValue === NULL)) {
|
||||
$pathArray = explode('/' , $pFilename);
|
||||
while(in_array('..', $pathArray) && $pathArray[0] != '..') {
|
||||
while (in_array('..', $pathArray) && $pathArray[0] != '..') {
|
||||
for ($i = 0; $i < count($pathArray); ++$i) {
|
||||
if ($pathArray[$i] == '..' && $i > 0) {
|
||||
unset($pathArray[$i]);
|
||||
|
@ -763,7 +763,7 @@ class EigenvalueDecomposition {
|
||||
for ($j = $nn-1; $j >= $low; --$j) {
|
||||
for ($i = $low; $i <= $high; ++$i) {
|
||||
$z = 0.0;
|
||||
for ($k = $low; $k <= min($j,$high); ++$k) {
|
||||
for ($k = $low; $k <= min($j, $high); ++$k) {
|
||||
$z = $z + $this->V[$i][$k] * $this->H[$k][$j];
|
||||
}
|
||||
$this->V[$i][$j] = $z;
|
||||
|
@ -82,7 +82,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
$LUrowi = $this->LU[$i];
|
||||
// Most of the time is spent in the following dot product.
|
||||
$kmax = min($i,$j);
|
||||
$kmax = min($i, $j);
|
||||
$s = 0.0;
|
||||
for ($k = 0; $k < $kmax; ++$k) {
|
||||
$s += $LUrowi[$k] * $LUcolj[$k];
|
||||
|
@ -68,7 +68,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
//Rectangular matrix - m x n initialized from 2D array
|
||||
case 'array':
|
||||
$this->m = count($args[0]);
|
||||
@ -173,7 +173,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
//A($i0...; $j0...)
|
||||
case 'integer,integer':
|
||||
list($i0, $j0) = $args;
|
||||
@ -426,7 +426,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -462,7 +462,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -512,7 +512,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -548,7 +548,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -599,7 +599,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -636,7 +636,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -687,7 +687,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -743,7 +743,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -780,7 +780,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -817,7 +817,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -853,7 +853,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $B = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
if ($this->n == $B->m) {
|
||||
@ -944,7 +944,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
break;
|
||||
@ -969,7 +969,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||
}
|
||||
if ($validValues) {
|
||||
$this->A[$i][$j] = pow($this->A[$i][$j],$value);
|
||||
$this->A[$i][$j] = pow($this->A[$i][$j], $value);
|
||||
} else {
|
||||
$this->A[$i][$j] = PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
@ -994,7 +994,7 @@ class PHPExcel_Shared_JAMA_Matrix {
|
||||
$args = func_get_args();
|
||||
$match = implode(",", array_map('gettype', $args));
|
||||
|
||||
switch($match) {
|
||||
switch ($match) {
|
||||
case 'object':
|
||||
if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); }
|
||||
case 'array':
|
||||
|
@ -52,7 +52,7 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
|
||||
* @return Structure to access R and the Householder vectors and compute Q.
|
||||
*/
|
||||
public function __construct($A) {
|
||||
if($A instanceof PHPExcel_Shared_JAMA_Matrix) {
|
||||
if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
|
||||
// Initialize.
|
||||
$this->QR = $A->getArrayCopy();
|
||||
$this->m = $A->getRowDimension();
|
||||
@ -175,7 +175,7 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
|
||||
/*
|
||||
for($i = 0; $i < count($Q); ++$i) {
|
||||
for($j = 0; $j < count($Q); ++$j) {
|
||||
if(! isset($Q[$i][$j]) ) {
|
||||
if (! isset($Q[$i][$j]) ) {
|
||||
$Q[$i][$j] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class SingularValueDecomposition {
|
||||
|
||||
// Reduce A to bidiagonal form, storing the diagonal elements
|
||||
// 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) {
|
||||
// Compute the transformation for the k-th column and
|
||||
@ -291,7 +291,7 @@ class SingularValueDecomposition {
|
||||
$f = $e[$p-2];
|
||||
$e[$p-2] = 0.0;
|
||||
for ($j = $p - 2; $j >= $k; --$j) {
|
||||
$t = hypo($this->s[$j],$f);
|
||||
$t = hypo($this->s[$j], $f);
|
||||
$cs = $this->s[$j] / $t;
|
||||
$sn = $f / $t;
|
||||
$this->s[$j] = $t;
|
||||
@ -353,7 +353,7 @@ class SingularValueDecomposition {
|
||||
$g = $sk * $ek;
|
||||
// Chase zeros.
|
||||
for ($j = $k; $j < $p-1; ++$j) {
|
||||
$t = hypo($f,$g);
|
||||
$t = hypo($f, $g);
|
||||
$cs = $f/$t;
|
||||
$sn = $g/$t;
|
||||
if ($j != $k) {
|
||||
@ -370,7 +370,7 @@ class SingularValueDecomposition {
|
||||
$this->V[$i][$j] = $t;
|
||||
}
|
||||
}
|
||||
$t = hypo($f,$g);
|
||||
$t = hypo($f, $g);
|
||||
$cs = $f/$t;
|
||||
$sn = $g/$t;
|
||||
$this->s[$j] = $t;
|
||||
|
@ -473,8 +473,8 @@ class PHPExcel_Shared_OLE
|
||||
// days from 1-1-1601 until the beggining of UNIX era
|
||||
$days = 134774;
|
||||
// calculate seconds
|
||||
$big_date = $days*24*3600 + gmmktime(date("H",$date),date("i",$date),date("s",$date),
|
||||
date("m",$date),date("d",$date),date("Y",$date));
|
||||
$big_date = $days*24*3600 + gmmktime(date("H", $date),date("i", $date),date("s", $date),
|
||||
date("m", $date),date("d", $date),date("Y", $date));
|
||||
// multiply just to make MS happy
|
||||
$big_date *= 10000000;
|
||||
|
||||
|
@ -204,7 +204,7 @@ class PHPExcel_Shared_OLE_PPS
|
||||
{
|
||||
if ( !is_array($to_save) || (empty($to_save)) ) {
|
||||
return 0xFFFFFFFF;
|
||||
} elseif( count($to_save) == 1 ) {
|
||||
} elseif ( count($to_save) == 1 ) {
|
||||
$cnt = count($raList);
|
||||
// If the first entry, it's the root... Don't clone it!
|
||||
$raList[$cnt] = ( $depth == 0 ) ? $to_save[0] : clone $to_save[0];
|
||||
|
@ -271,7 +271,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
//if (isset($raList[$i]->_PPS_FILE)) {
|
||||
// $iLen = 0;
|
||||
// fseek($raList[$i]->_PPS_FILE, 0); // To The Top
|
||||
// while($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
|
||||
// while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
|
||||
// $iLen += strlen($sBuff);
|
||||
// fwrite($FILE, $sBuff);
|
||||
// }
|
||||
@ -337,7 +337,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
$sRes .= $raList[$i]->_data;
|
||||
//}
|
||||
if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) {
|
||||
$sRes .= str_repeat("\x00",$this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
|
||||
$sRes .= str_repeat("\x00", $this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
|
||||
}
|
||||
// Set for PPS
|
||||
$raList[$i]->_StartBlock = $iSmBlk;
|
||||
|
@ -76,7 +76,7 @@ class PHPExcel_Shared_OLERead {
|
||||
public function read($sFileName)
|
||||
{
|
||||
// Check if file exists and is readable
|
||||
if(!is_readable($sFileName)) {
|
||||
if (!is_readable($sFileName)) {
|
||||
throw new PHPExcel_Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable.");
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ class PHPExcel_Shared_OLERead {
|
||||
|
||||
$size = self::_GetInt4d($d, self::SIZE_POS);
|
||||
|
||||
$name = str_replace("\x00", "", substr($d,0,$nameSize));
|
||||
$name = str_replace("\x00", "", substr($d,0, $nameSize));
|
||||
|
||||
|
||||
$this->props[] = array (
|
||||
|
@ -1837,13 +1837,13 @@
|
||||
$v_memory_limit = trim($v_memory_limit);
|
||||
$last = strtolower(substr($v_memory_limit, -1));
|
||||
|
||||
if($last == 'g')
|
||||
if ($last == 'g')
|
||||
//$v_memory_limit = $v_memory_limit*1024*1024*1024;
|
||||
$v_memory_limit = $v_memory_limit*1073741824;
|
||||
if($last == 'm')
|
||||
if ($last == 'm')
|
||||
//$v_memory_limit = $v_memory_limit*1024*1024;
|
||||
$v_memory_limit = $v_memory_limit*1048576;
|
||||
if($last == 'k')
|
||||
if ($last == 'k')
|
||||
$v_memory_limit = $v_memory_limit*1024;
|
||||
|
||||
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
|
||||
@ -2412,7 +2412,7 @@
|
||||
$v_offset = @ftell($this->zip_fd);
|
||||
|
||||
// ----- Create the Central Dir files header
|
||||
for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
|
||||
for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
|
||||
{
|
||||
// ----- Create the file header
|
||||
if ($v_header_list[$i]['status'] == 'ok') {
|
||||
|
@ -330,10 +330,10 @@ class PHPExcel_Shared_String
|
||||
}
|
||||
|
||||
public static function buildCharacterSets() {
|
||||
if(empty(self::$_controlCharacters)) {
|
||||
if (empty(self::$_controlCharacters)) {
|
||||
self::_buildControlCharacters();
|
||||
}
|
||||
if(empty(self::$_SYLKCharacters)) {
|
||||
if (empty(self::$_SYLKCharacters)) {
|
||||
self::_buildSYLKCharacters();
|
||||
}
|
||||
}
|
||||
@ -436,19 +436,18 @@ class PHPExcel_Shared_String
|
||||
// character count
|
||||
$ln = self::CountCharacters($value, 'UTF-8');
|
||||
// option flags
|
||||
if(empty($arrcRuns)){
|
||||
if (empty($arrcRuns)) {
|
||||
$opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
|
||||
0x0001 : 0x0000;
|
||||
$data = pack('CC', $ln, $opt);
|
||||
// characters
|
||||
$data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$data = pack('vC', $ln, 0x09);
|
||||
$data .= pack('v', count($arrcRuns));
|
||||
// characters
|
||||
$data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
|
||||
foreach ($arrcRuns as $cRun){
|
||||
foreach ($arrcRuns as $cRun) {
|
||||
$data .= pack('v', $cRun['strlen']);
|
||||
$data .= pack('v', $cRun['fontidx']);
|
||||
}
|
||||
@ -500,9 +499,9 @@ class PHPExcel_Shared_String
|
||||
return mb_convert_encoding($value, $to, $from);
|
||||
}
|
||||
|
||||
if($from == 'UTF-16LE'){
|
||||
if ($from == 'UTF-16LE') {
|
||||
return self::utf16_decode($value, false);
|
||||
}else if($from == 'UTF-16BE'){
|
||||
} else if ($from == 'UTF-16BE') {
|
||||
return self::utf16_decode($value);
|
||||
}
|
||||
// else, no conversion
|
||||
@ -525,15 +524,15 @@ class PHPExcel_Shared_String
|
||||
* @author vadik56
|
||||
*/
|
||||
public static function utf16_decode($str, $bom_be = TRUE) {
|
||||
if( strlen($str) < 2 ) return $str;
|
||||
if ( strlen($str) < 2 ) return $str;
|
||||
$c0 = ord($str{0});
|
||||
$c1 = ord($str{1});
|
||||
if( $c0 == 0xfe && $c1 == 0xff ) { $str = substr($str,2); }
|
||||
elseif( $c0 == 0xff && $c1 == 0xfe ) { $str = substr($str,2); $bom_be = false; }
|
||||
if ( $c0 == 0xfe && $c1 == 0xff ) { $str = substr($str,2); }
|
||||
elseif ( $c0 == 0xff && $c1 == 0xfe ) { $str = substr($str,2); $bom_be = false; }
|
||||
$len = strlen($str);
|
||||
$newstr = '';
|
||||
for($i=0;$i<$len;$i+=2) {
|
||||
if( $bom_be ) { $val = ord($str{$i}) << 4; $val += ord($str{$i+1}); }
|
||||
if ( $bom_be ) { $val = ord($str{$i}) << 4; $val += ord($str{$i+1}); }
|
||||
else { $val = ord($str{$i+1}) << 4; $val += ord($str{$i}); }
|
||||
$newstr .= ($val == 0x228) ? "\n" : chr($val);
|
||||
}
|
||||
@ -649,8 +648,8 @@ class PHPExcel_Shared_String
|
||||
{
|
||||
if (self::getIsMbstringEnabled()) {
|
||||
$characters = self::mb_str_split($pValue);
|
||||
foreach($characters as &$character) {
|
||||
if(self::mb_is_upper($character)) {
|
||||
foreach ($characters as &$character) {
|
||||
if (self::mb_is_upper($character)) {
|
||||
$character = mb_strtolower($character, 'UTF-8');
|
||||
} else {
|
||||
$character = mb_strtoupper($character, 'UTF-8');
|
||||
|
@ -129,7 +129,7 @@ class PHPExcel_Shared_TimeZone
|
||||
|
||||
$objTimezone = new DateTimeZone($timezone);
|
||||
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||
$transitions = $objTimezone->getTransitions($timestamp,$timestamp);
|
||||
$transitions = $objTimezone->getTransitions($timestamp, $timestamp);
|
||||
} else {
|
||||
$transitions = self::_getTimezoneTransitions($objTimezone, $timestamp);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter {
|
||||
public function writeRawData($text)
|
||||
{
|
||||
if (is_array($text)) {
|
||||
$text = implode("\n",$text);
|
||||
$text = implode("\n", $text);
|
||||
}
|
||||
|
||||
if (method_exists($this, 'writeRaw')) {
|
||||
|
@ -174,7 +174,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getSlope($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_slope,$dp);
|
||||
return round($this->_slope, $dp);
|
||||
}
|
||||
return $this->_slope;
|
||||
} // function getSlope()
|
||||
@ -188,7 +188,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getSlopeSE($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_slopeSE,$dp);
|
||||
return round($this->_slopeSE, $dp);
|
||||
}
|
||||
return $this->_slopeSE;
|
||||
} // function getSlopeSE()
|
||||
@ -202,7 +202,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getIntersect($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_intersect,$dp);
|
||||
return round($this->_intersect, $dp);
|
||||
}
|
||||
return $this->_intersect;
|
||||
} // function getIntersect()
|
||||
@ -216,7 +216,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getIntersectSE($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_intersectSE,$dp);
|
||||
return round($this->_intersectSE, $dp);
|
||||
}
|
||||
return $this->_intersectSE;
|
||||
} // function getIntersectSE()
|
||||
@ -230,7 +230,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getGoodnessOfFit($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_goodnessOfFit,$dp);
|
||||
return round($this->_goodnessOfFit, $dp);
|
||||
}
|
||||
return $this->_goodnessOfFit;
|
||||
} // function getGoodnessOfFit()
|
||||
@ -238,7 +238,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getGoodnessOfFitPercent($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_goodnessOfFit * 100,$dp);
|
||||
return round($this->_goodnessOfFit * 100, $dp);
|
||||
}
|
||||
return $this->_goodnessOfFit * 100;
|
||||
} // function getGoodnessOfFitPercent()
|
||||
@ -252,7 +252,7 @@ class PHPExcel_Best_Fit
|
||||
*/
|
||||
public function getStdevOfResiduals($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_stdevOfResiduals,$dp);
|
||||
return round($this->_stdevOfResiduals, $dp);
|
||||
}
|
||||
return $this->_stdevOfResiduals;
|
||||
} // function getStdevOfResiduals()
|
||||
@ -260,7 +260,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getSSRegression($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_SSRegression,$dp);
|
||||
return round($this->_SSRegression, $dp);
|
||||
}
|
||||
return $this->_SSRegression;
|
||||
} // function getSSRegression()
|
||||
@ -268,7 +268,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getSSResiduals($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_SSResiduals,$dp);
|
||||
return round($this->_SSResiduals, $dp);
|
||||
}
|
||||
return $this->_SSResiduals;
|
||||
} // function getSSResiduals()
|
||||
@ -276,7 +276,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getDFResiduals($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_DFResiduals,$dp);
|
||||
return round($this->_DFResiduals, $dp);
|
||||
}
|
||||
return $this->_DFResiduals;
|
||||
} // function getDFResiduals()
|
||||
@ -284,7 +284,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getF($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_F,$dp);
|
||||
return round($this->_F, $dp);
|
||||
}
|
||||
return $this->_F;
|
||||
} // function getF()
|
||||
@ -292,7 +292,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getCovariance($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_covariance,$dp);
|
||||
return round($this->_covariance, $dp);
|
||||
}
|
||||
return $this->_covariance;
|
||||
} // function getCovariance()
|
||||
@ -300,7 +300,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
public function getCorrelation($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round($this->_correlation,$dp);
|
||||
return round($this->_correlation, $dp);
|
||||
}
|
||||
return $this->_correlation;
|
||||
} // function getCorrelation()
|
||||
@ -311,9 +311,9 @@ class PHPExcel_Best_Fit
|
||||
} // function getYBestFitValues()
|
||||
|
||||
|
||||
protected function _calculateGoodnessOfFit($sumX,$sumY,$sumX2,$sumY2,$sumXY,$meanX,$meanY, $const) {
|
||||
protected function _calculateGoodnessOfFit($sumX, $sumY, $sumX2, $sumY2, $sumXY, $meanX, $meanY, $const) {
|
||||
$SSres = $SScov = $SScor = $SStot = $SSsex = 0.0;
|
||||
foreach($this->_xValues as $xKey => $xValue) {
|
||||
foreach ($this->_xValues as $xKey => $xValue) {
|
||||
$bestFitY = $this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
|
||||
|
||||
$SSres += ($this->_yValues[$xKey] - $bestFitY) * ($this->_yValues[$xKey] - $bestFitY);
|
||||
@ -398,7 +398,7 @@ class PHPExcel_Best_Fit
|
||||
$this->_intersect = 0;
|
||||
}
|
||||
|
||||
$this->_calculateGoodnessOfFit($x_sum,$y_sum,$xx_sum,$yy_sum,$xy_sum,$meanX,$meanY,$const);
|
||||
$this->_calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum, $meanX, $meanY, $const);
|
||||
} // function _leastSquareFit()
|
||||
|
||||
|
||||
@ -416,7 +416,7 @@ class PHPExcel_Best_Fit
|
||||
|
||||
// Define X Values if necessary
|
||||
if ($nX == 0) {
|
||||
$xValues = range(1,$nY);
|
||||
$xValues = range(1, $nY);
|
||||
$nX = $nY;
|
||||
} elseif ($nY != $nX) {
|
||||
// Ensure both arrays of points are the same size
|
||||
|
@ -91,7 +91,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||
**/
|
||||
public function getSlope($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round(exp($this->_slope),$dp);
|
||||
return round(exp($this->_slope), $dp);
|
||||
}
|
||||
return exp($this->_slope);
|
||||
} // function getSlope()
|
||||
@ -105,7 +105,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||
**/
|
||||
public function getIntersect($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round(exp($this->_intersect),$dp);
|
||||
return round(exp($this->_intersect), $dp);
|
||||
}
|
||||
return exp($this->_intersect);
|
||||
} // function getIntersect()
|
||||
@ -119,7 +119,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||
* @param boolean $const
|
||||
*/
|
||||
private function _exponential_regression($yValues, $xValues, $const) {
|
||||
foreach($yValues as &$value) {
|
||||
foreach ($yValues as &$value) {
|
||||
if ($value < 0.0) {
|
||||
$value = 0 - log(abs($value));
|
||||
} elseif ($value > 0.0) {
|
||||
|
@ -91,7 +91,7 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
|
||||
* @param boolean $const
|
||||
*/
|
||||
private function _linear_regression($yValues, $xValues, $const) {
|
||||
$this->_leastSquareFit($yValues, $xValues,$const);
|
||||
$this->_leastSquareFit($yValues, $xValues, $const);
|
||||
} // function _linear_regression()
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
||||
* @param boolean $const
|
||||
*/
|
||||
private function _logarithmic_regression($yValues, $xValues, $const) {
|
||||
foreach($xValues as &$value) {
|
||||
foreach ($xValues as &$value) {
|
||||
if ($value < 0.0) {
|
||||
$value = 0 - log(abs($value));
|
||||
} elseif ($value > 0.0) {
|
||||
|
@ -75,7 +75,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||
public function getValueOfYForX($xValue) {
|
||||
$retVal = $this->getIntersect();
|
||||
$slope = $this->getSlope();
|
||||
foreach($slope as $key => $value) {
|
||||
foreach ($slope as $key => $value) {
|
||||
if ($value != 0.0) {
|
||||
$retVal += $value * pow($xValue, $key + 1);
|
||||
}
|
||||
@ -106,7 +106,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||
$intersect = $this->getIntersect($dp);
|
||||
|
||||
$equation = 'Y = '.$intersect;
|
||||
foreach($slope as $key => $value) {
|
||||
foreach ($slope as $key => $value) {
|
||||
if ($value != 0.0) {
|
||||
$equation .= ' + '.$value.' * X';
|
||||
if ($key > 0) {
|
||||
@ -127,8 +127,8 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||
public function getSlope($dp=0) {
|
||||
if ($dp != 0) {
|
||||
$coefficients = array();
|
||||
foreach($this->_slope as $coefficient) {
|
||||
$coefficients[] = round($coefficient,$dp);
|
||||
foreach ($this->_slope as $coefficient) {
|
||||
$coefficients[] = round($coefficient, $dp);
|
||||
}
|
||||
return $coefficients;
|
||||
}
|
||||
@ -137,7 +137,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||
|
||||
|
||||
public function getCoefficients($dp=0) {
|
||||
return array_merge(array($this->getIntersect($dp)),$this->getSlope($dp));
|
||||
return array_merge(array($this->getIntersect($dp)), $this->getSlope($dp));
|
||||
} // function getCoefficients()
|
||||
|
||||
|
||||
@ -191,8 +191,8 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||
$this->_intersect = array_shift($coefficients);
|
||||
$this->_slope = $coefficients;
|
||||
|
||||
$this->_calculateGoodnessOfFit($x_sum,$y_sum,$xx_sum,$yy_sum,$xy_sum);
|
||||
foreach($this->_xValues as $xKey => $xValue) {
|
||||
$this->_calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum);
|
||||
foreach ($this->_xValues as $xKey => $xValue) {
|
||||
$this->_yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
|
||||
}
|
||||
} // function _polynomial_regression()
|
||||
|
@ -54,7 +54,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||
* @return float Y-Value
|
||||
**/
|
||||
public function getValueOfYForX($xValue) {
|
||||
return $this->getIntersect() * pow(($xValue - $this->_Xoffset),$this->getSlope());
|
||||
return $this->getIntersect() * pow(($xValue - $this->_Xoffset), $this->getSlope());
|
||||
} // function getValueOfYForX()
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||
**/
|
||||
public function getIntersect($dp=0) {
|
||||
if ($dp != 0) {
|
||||
return round(exp($this->_intersect),$dp);
|
||||
return round(exp($this->_intersect), $dp);
|
||||
}
|
||||
return exp($this->_intersect);
|
||||
} // function getIntersect()
|
||||
@ -105,7 +105,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||
* @param boolean $const
|
||||
*/
|
||||
private function _power_regression($yValues, $xValues, $const) {
|
||||
foreach($xValues as &$value) {
|
||||
foreach ($xValues as &$value) {
|
||||
if ($value < 0.0) {
|
||||
$value = 0 - log(abs($value));
|
||||
} elseif ($value > 0.0) {
|
||||
@ -113,7 +113,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
foreach($yValues as &$value) {
|
||||
foreach ($yValues as &$value) {
|
||||
if ($value < 0.0) {
|
||||
$value = 0 - log(abs($value));
|
||||
} elseif ($value > 0.0) {
|
||||
|
@ -91,7 +91,7 @@ class trendClass
|
||||
|
||||
// Define X Values if necessary
|
||||
if ($nX == 0) {
|
||||
$xValues = range(1,$nY);
|
||||
$xValues = range(1, $nY);
|
||||
$nX = $nY;
|
||||
} elseif ($nY != $nX) {
|
||||
// Ensure both arrays of points are the same size
|
||||
@ -108,7 +108,7 @@ class trendClass
|
||||
case self::TREND_POWER :
|
||||
if (!isset(self::$_trendCache[$key])) {
|
||||
$className = 'PHPExcel_'.$trendType.'_Best_Fit';
|
||||
self::$_trendCache[$key] = new $className($yValues,$xValues,$const);
|
||||
self::$_trendCache[$key] = new $className($yValues, $xValues, $const);
|
||||
}
|
||||
return self::$_trendCache[$key];
|
||||
break;
|
||||
@ -119,7 +119,7 @@ class trendClass
|
||||
case self::TREND_POLYNOMIAL_6 :
|
||||
if (!isset(self::$_trendCache[$key])) {
|
||||
$order = substr($trendType,-1);
|
||||
self::$_trendCache[$key] = new PHPExcel_Polynomial_Best_Fit($order,$yValues,$xValues,$const);
|
||||
self::$_trendCache[$key] = new PHPExcel_Polynomial_Best_Fit($order, $yValues, $xValues, $const);
|
||||
}
|
||||
return self::$_trendCache[$key];
|
||||
break;
|
||||
@ -127,15 +127,15 @@ class trendClass
|
||||
case self::TREND_BEST_FIT_NO_POLY :
|
||||
// If the request is to determine the best fit regression, then we test each trend line in turn
|
||||
// Start by generating an instance of each available trend method
|
||||
foreach(self::$_trendTypes as $trendMethod) {
|
||||
foreach (self::$_trendTypes as $trendMethod) {
|
||||
$className = 'PHPExcel_'.$trendMethod.'BestFit';
|
||||
$bestFit[$trendMethod] = new $className($yValues,$xValues,$const);
|
||||
$bestFit[$trendMethod] = new $className($yValues, $xValues, $const);
|
||||
$bestFitValue[$trendMethod] = $bestFit[$trendMethod]->getGoodnessOfFit();
|
||||
}
|
||||
if ($trendType != self::TREND_BEST_FIT_NO_POLY) {
|
||||
foreach(self::$_trendTypePolyOrders as $trendMethod) {
|
||||
foreach (self::$_trendTypePolyOrders as $trendMethod) {
|
||||
$order = substr($trendMethod,-1);
|
||||
$bestFit[$trendMethod] = new PHPExcel_Polynomial_Best_Fit($order,$yValues,$xValues,$const);
|
||||
$bestFit[$trendMethod] = new PHPExcel_Polynomial_Best_Fit($order, $yValues, $xValues, $const);
|
||||
if ($bestFit[$trendMethod]->getError()) {
|
||||
unset($bestFit[$trendMethod]);
|
||||
} else {
|
||||
|
@ -378,7 +378,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
*
|
||||
*/
|
||||
public function disconnectCells() {
|
||||
if ( $this->_cellCollection !== NULL){
|
||||
if ( $this->_cellCollection !== NULL) {
|
||||
$this->_cellCollection->unsetWorksheetCells();
|
||||
$this->_cellCollection = NULL;
|
||||
}
|
||||
@ -620,7 +620,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
public function getChartNames()
|
||||
{
|
||||
$chartNames = array();
|
||||
foreach($this->_chartCollection as $chart) {
|
||||
foreach ($this->_chartCollection as $chart) {
|
||||
$chartNames[] = $chart->getName();
|
||||
}
|
||||
return $chartNames;
|
||||
@ -639,7 +639,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
if ($chartCount == 0) {
|
||||
return false;
|
||||
}
|
||||
foreach($this->_chartCollection as $index => $chart) {
|
||||
foreach ($this->_chartCollection as $index => $chart) {
|
||||
if ($chart->getName() == $chartName) {
|
||||
return $this->_chartCollection[$index];
|
||||
}
|
||||
@ -858,7 +858,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
}
|
||||
|
||||
$altTitle = $pValue . ' ' . $i;
|
||||
return $this->setTitle($altTitle,$updateFormulaCellReferences);
|
||||
return $this->setTitle($altTitle, $updateFormulaCellReferences);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1314,7 +1314,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
return NULL;
|
||||
$this->_rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow);
|
||||
|
||||
$this->_cachedHighestRow = max($this->_cachedHighestRow,$pRow);
|
||||
$this->_cachedHighestRow = max($this->_cachedHighestRow, $pRow);
|
||||
}
|
||||
return $this->_rowDimensions[$pRow];
|
||||
}
|
||||
@ -1571,7 +1571,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
*/
|
||||
public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '')
|
||||
{
|
||||
foreach($pCellStyle as $cellStyle) {
|
||||
foreach ($pCellStyle as $cellStyle) {
|
||||
if (!($cellStyle instanceof PHPExcel_Style_Conditional)) {
|
||||
throw new PHPExcel_Exception('Style is not a conditional style');
|
||||
}
|
||||
@ -1899,7 +1899,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
|
||||
if (is_string($pValue)) {
|
||||
$this->_autoFilter->setRange($pValue);
|
||||
} elseif(is_object($pValue) && ($pValue instanceof PHPExcel_Worksheet_AutoFilter)) {
|
||||
} elseif (is_object($pValue) && ($pValue instanceof PHPExcel_Worksheet_AutoFilter)) {
|
||||
$this->_autoFilter = $pValue;
|
||||
}
|
||||
return $this;
|
||||
@ -2406,7 +2406,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
// Loop through $source
|
||||
foreach ($source as $rowData) {
|
||||
$currentColumn = $startColumn;
|
||||
foreach($rowData as $cellValue) {
|
||||
foreach ($rowData as $cellValue) {
|
||||
if ($strictNullComparison) {
|
||||
if ($cellValue !== $nullValue) {
|
||||
// Set cell value
|
||||
@ -2600,7 +2600,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
|
||||
// Loop through row dimensions
|
||||
foreach ($this->_rowDimensions as $dimension) {
|
||||
$highestRow = max($highestRow,$dimension->getRowIndex());
|
||||
$highestRow = max($highestRow, $dimension->getRowIndex());
|
||||
}
|
||||
|
||||
// Cache values
|
||||
@ -2779,7 +2779,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
$maxRow = $this->getHighestRow();
|
||||
$maxCol = PHPExcel_Cell::columnIndexFromString($maxCol);
|
||||
|
||||
$rangeBlocks = explode(' ',$range);
|
||||
$rangeBlocks = explode(' ', $range);
|
||||
foreach ($rangeBlocks as &$rangeSet) {
|
||||
$rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($rangeSet);
|
||||
|
||||
@ -2790,7 +2790,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
$rangeSet = $rangeBoundaries[0][0].$rangeBoundaries[0][1].':'.$rangeBoundaries[1][0].$rangeBoundaries[1][1];
|
||||
}
|
||||
unset($rangeSet);
|
||||
$stRange = implode(' ',$rangeBlocks);
|
||||
$stRange = implode(' ', $rangeBlocks);
|
||||
|
||||
return $stRange;
|
||||
}
|
||||
@ -2876,7 +2876,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
* @return objWorksheet
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function setCodeName($pValue=null){
|
||||
public function setCodeName($pValue=null) {
|
||||
// Is this a 'rename' or not?
|
||||
if ($this->getCodeName() == $pValue) {
|
||||
return $this;
|
||||
@ -2912,7 +2912,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
|
||||
$pValue = $pValue . '_' . $i;// ok, we have a valid name
|
||||
//codeName is'nt used in formula : no need to call for an update
|
||||
//return $this->setTitle($altTitle,$updateFormulaCellReferences);
|
||||
//return $this->setTitle($altTitle, $updateFormulaCellReferences);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2924,14 +2924,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getCodeName(){
|
||||
public function getCodeName() {
|
||||
return $this->_codeName;
|
||||
}
|
||||
/**
|
||||
* Sheet has a code name ?
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasCodeName(){
|
||||
public function hasCodeName() {
|
||||
return !(is_null($this->_codeName));
|
||||
}
|
||||
}
|
||||
|
@ -112,12 +112,12 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
// Uppercase coordinate
|
||||
$cellAddress = explode('!',strtoupper($pRange));
|
||||
if (count($cellAddress) > 1) {
|
||||
list($worksheet,$pRange) = $cellAddress;
|
||||
list($worksheet, $pRange) = $cellAddress;
|
||||
}
|
||||
|
||||
if (strpos($pRange,':') !== FALSE) {
|
||||
$this->_range = $pRange;
|
||||
} elseif(empty($pRange)) {
|
||||
} elseif (empty($pRange)) {
|
||||
$this->_range = '';
|
||||
} else {
|
||||
throw new PHPExcel_Exception('Autofilter must be set on a range of cells.');
|
||||
@ -128,8 +128,8 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
$this->_columns = array();
|
||||
} else {
|
||||
// Discard any column rules that are no longer valid within this range
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
foreach($this->_columns as $key => $value) {
|
||||
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
foreach ($this->_columns as $key => $value) {
|
||||
$colIndex = PHPExcel_Cell::columnIndexFromString($key);
|
||||
if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) {
|
||||
unset($this->_columns[$key]);
|
||||
@ -163,7 +163,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
}
|
||||
|
||||
$columnIndex = PHPExcel_Cell::columnIndexFromString($column);
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) {
|
||||
throw new PHPExcel_Exception("Column is outside of current autofilter range.");
|
||||
}
|
||||
@ -207,7 +207,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function getColumnByOffset($pColumnOffset = 0) {
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
$pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1);
|
||||
|
||||
return $this->getColumn($pColumn);
|
||||
@ -225,7 +225,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
{
|
||||
if ((is_string($pColumn)) && (!empty($pColumn))) {
|
||||
$column = $pColumn;
|
||||
} elseif(is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
|
||||
} elseif (is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
|
||||
$column = $pColumn->getColumnIndex();
|
||||
} else {
|
||||
throw new PHPExcel_Exception("Column is not within the autofilter range.");
|
||||
@ -234,7 +234,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
|
||||
if (is_string($pColumn)) {
|
||||
$this->_columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this);
|
||||
} elseif(is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
|
||||
} elseif (is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
|
||||
$pColumn->setParent($this);
|
||||
$this->_columns[$column] = $pColumn;
|
||||
}
|
||||
@ -271,7 +271,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
* @param string $toColumn Column name (e.g. B)
|
||||
* @return PHPExcel_Worksheet_AutoFilter
|
||||
*/
|
||||
public function shiftColumn($fromColumn=NULL,$toColumn=NULL) {
|
||||
public function shiftColumn($fromColumn=NULL, $toColumn=NULL) {
|
||||
$fromColumn = strtoupper($fromColumn);
|
||||
$toColumn = strtoupper($toColumn);
|
||||
|
||||
@ -296,14 +296,14 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
* @param mixed[] $dataSet
|
||||
* @return boolean
|
||||
*/
|
||||
private static function _filterTestInSimpleDataSet($cellValue,$dataSet)
|
||||
private static function _filterTestInSimpleDataSet($cellValue, $dataSet)
|
||||
{
|
||||
$dataSetValues = $dataSet['filterValues'];
|
||||
$blanks = $dataSet['blanks'];
|
||||
if (($cellValue == '') || ($cellValue === NULL)) {
|
||||
return $blanks;
|
||||
}
|
||||
return in_array($cellValue,$dataSetValues);
|
||||
return in_array($cellValue, $dataSetValues);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -313,7 +313,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
* @param mixed[] $dataSet
|
||||
* @return boolean
|
||||
*/
|
||||
private static function _filterTestInDateGroupSet($cellValue,$dataSet)
|
||||
private static function _filterTestInDateGroupSet($cellValue, $dataSet)
|
||||
{
|
||||
$dateSet = $dataSet['filterValues'];
|
||||
$blanks = $dataSet['blanks'];
|
||||
@ -325,18 +325,18 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
$dateValue = PHPExcel_Shared_Date::ExcelToPHP($cellValue);
|
||||
if ($cellValue < 1) {
|
||||
// Just the time part
|
||||
$dtVal = date('His',$dateValue);
|
||||
$dtVal = date('His', $dateValue);
|
||||
$dateSet = $dateSet['time'];
|
||||
} elseif($cellValue == floor($cellValue)) {
|
||||
} elseif ($cellValue == floor($cellValue)) {
|
||||
// Just the date part
|
||||
$dtVal = date('Ymd',$dateValue);
|
||||
$dtVal = date('Ymd', $dateValue);
|
||||
$dateSet = $dateSet['date'];
|
||||
} else {
|
||||
// date and time parts
|
||||
$dtVal = date('YmdHis',$dateValue);
|
||||
$dtVal = date('YmdHis', $dateValue);
|
||||
$dateSet = $dateSet['dateTime'];
|
||||
}
|
||||
foreach($dateSet as $dateValue) {
|
||||
foreach ($dateSet as $dateValue) {
|
||||
// Use of substr to extract value at the appropriate group level
|
||||
if (substr($dtVal,0,strlen($dateValue)) == $dateValue)
|
||||
return TRUE;
|
||||
@ -366,7 +366,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
}
|
||||
}
|
||||
$returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
|
||||
foreach($dataSet as $rule) {
|
||||
foreach ($dataSet as $rule) {
|
||||
if (is_numeric($rule['value'])) {
|
||||
// Numeric values are tested using the appropriate operator
|
||||
switch ($rule['operator']) {
|
||||
@ -389,7 +389,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
$retVal = ($cellValue <= $rule['value']);
|
||||
break;
|
||||
}
|
||||
} elseif($rule['value'] == '') {
|
||||
} elseif ($rule['value'] == '') {
|
||||
switch ($rule['operator']) {
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL :
|
||||
$retVal = (($cellValue == '') || ($cellValue === NULL));
|
||||
@ -403,7 +403,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
}
|
||||
} else {
|
||||
// String values are always tested for equality, factoring in for wildcards (hence a regexp test)
|
||||
$retVal = preg_match('/^'.$rule['value'].'$/i',$cellValue);
|
||||
$retVal = preg_match('/^'.$rule['value'].'$/i', $cellValue);
|
||||
}
|
||||
// If there are multiple conditions, then we need to test both using the appropriate join operator
|
||||
switch ($join) {
|
||||
@ -439,7 +439,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
|
||||
if (is_numeric($cellValue)) {
|
||||
$dateValue = date('m',PHPExcel_Shared_Date::ExcelToPHP($cellValue));
|
||||
if (in_array($dateValue,$monthSet)) {
|
||||
if (in_array($dateValue, $monthSet)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -474,28 +474,28 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
// Calculate start/end dates for the required date range based on current date
|
||||
switch ($dynamicRuleType) {
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK :
|
||||
$baseDate = strtotime('-7 days',$baseDate);
|
||||
$baseDate = strtotime('-7 days', $baseDate);
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK :
|
||||
$baseDate = strtotime('-7 days',$baseDate);
|
||||
$baseDate = strtotime('-7 days', $baseDate);
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH :
|
||||
$baseDate = strtotime('-1 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('-1 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH :
|
||||
$baseDate = strtotime('+1 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('+1 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER :
|
||||
$baseDate = strtotime('-3 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('-3 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER :
|
||||
$baseDate = strtotime('+3 month',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('+3 month',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR :
|
||||
$baseDate = strtotime('-1 year',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('-1 year',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR :
|
||||
$baseDate = strtotime('+1 year',gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$baseDate = strtotime('+1 year',gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -503,40 +503,40 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TODAY :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW :
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day',$baseDate));
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day', $baseDate));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate);
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE :
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day',$baseDate));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y',$baseDate)));
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day', $baseDate));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR :
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,31,12,date('Y',$baseDate)));
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,31,12,date('Y', $baseDate)));
|
||||
++$maxVal;
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y',$baseDate)));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1,date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER :
|
||||
$thisMonth = date('m',$baseDate);
|
||||
$thisMonth = date('m', $baseDate);
|
||||
$thisQuarter = floor(--$thisMonth / 3);
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t',$baseDate),(1+$thisQuarter)*3,date('Y',$baseDate)));
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t', $baseDate),(1+$thisQuarter)*3,date('Y', $baseDate)));
|
||||
++$maxVal;
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1+$thisQuarter*3,date('Y',$baseDate)));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,1+$thisQuarter*3,date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH :
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t',$baseDate),date('m',$baseDate),date('Y',$baseDate)));
|
||||
$maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0,0,0,date('t', $baseDate),date('m', $baseDate),date('Y', $baseDate)));
|
||||
++$maxVal;
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,date('m',$baseDate),date('Y',$baseDate)));
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0,0,0,1,date('m', $baseDate),date('Y', $baseDate)));
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK :
|
||||
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK :
|
||||
$dayOfWeek = date('w',$baseDate);
|
||||
$dayOfWeek = date('w', $baseDate);
|
||||
$val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate) - $dayOfWeek;
|
||||
$maxVal = $val + 7;
|
||||
break;
|
||||
@ -577,7 +577,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
);
|
||||
}
|
||||
|
||||
private function _calculateTopTenValue($columnID,$startRow,$endRow,$ruleType,$ruleValue) {
|
||||
private function _calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue) {
|
||||
$range = $columnID.$startRow.':'.$columnID.$endRow;
|
||||
$dataValues = PHPExcel_Calculation_Functions::flattenArray(
|
||||
$this->_workSheet->rangeToArray($range,NULL,TRUE,FALSE)
|
||||
@ -590,7 +590,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
sort($dataValues);
|
||||
}
|
||||
|
||||
return array_pop(array_slice($dataValues,0,$ruleValue));
|
||||
return array_pop(array_slice($dataValues,0, $ruleValue));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -601,20 +601,20 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
*/
|
||||
public function showHideRows()
|
||||
{
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
|
||||
|
||||
// The heading row should always be visible
|
||||
// echo 'AutoFilter Heading Row ',$rangeStart[1],' is always SHOWN',PHP_EOL;
|
||||
// echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL;
|
||||
$this->_workSheet->getRowDimension($rangeStart[1])->setVisible(TRUE);
|
||||
|
||||
$columnFilterTests = array();
|
||||
foreach($this->_columns as $columnID => $filterColumn) {
|
||||
foreach ($this->_columns as $columnID => $filterColumn) {
|
||||
$rules = $filterColumn->getRules();
|
||||
switch ($filterColumn->getFilterType()) {
|
||||
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER :
|
||||
$ruleValues = array();
|
||||
// Build a list of the filter value selections
|
||||
foreach($rules as $rule) {
|
||||
foreach ($rules as $rule) {
|
||||
$ruleType = $rule->getRuleType();
|
||||
$ruleValues[] = $rule->getValue();
|
||||
}
|
||||
@ -638,26 +638,26 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
'time' => array(),
|
||||
'dateTime' => array(),
|
||||
);
|
||||
foreach($ruleDataSet as $ruleValue) {
|
||||
foreach ($ruleDataSet as $ruleValue) {
|
||||
$date = $time = '';
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR] !== ''))
|
||||
$date .= sprintf('%04d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]);
|
||||
$date .= sprintf('%04d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]);
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH] != ''))
|
||||
$date .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]);
|
||||
$date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]);
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY] !== ''))
|
||||
$date .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]);
|
||||
$date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]);
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR] !== ''))
|
||||
$time .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]);
|
||||
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]);
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE] !== ''))
|
||||
$time .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]);
|
||||
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]);
|
||||
if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND])) &&
|
||||
($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND] !== ''))
|
||||
$time .= sprintf('%02d',$ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]);
|
||||
$time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]);
|
||||
$dateTime = $date . $time;
|
||||
$arguments['date'][] = $date;
|
||||
$arguments['time'][] = $time;
|
||||
@ -679,13 +679,13 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
$customRuleForBlanks = FALSE;
|
||||
$ruleValues = array();
|
||||
// Build a list of the filter value selections
|
||||
foreach($rules as $rule) {
|
||||
foreach ($rules as $rule) {
|
||||
$ruleType = $rule->getRuleType();
|
||||
$ruleValue = $rule->getValue();
|
||||
if (!is_numeric($ruleValue)) {
|
||||
// Convert to a regexp allowing for regexp reserved characters, wildcards and escaped wildcards
|
||||
$ruleValue = preg_quote($ruleValue);
|
||||
$ruleValue = str_replace(self::$_fromReplace,self::$_toReplace,$ruleValue);
|
||||
$ruleValue = str_replace(self::$_fromReplace,self::$_toReplace, $ruleValue);
|
||||
if (trim($ruleValue) == '') {
|
||||
$customRuleForBlanks = TRUE;
|
||||
$ruleValue = trim($ruleValue);
|
||||
@ -706,7 +706,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
break;
|
||||
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER :
|
||||
$ruleValues = array();
|
||||
foreach($rules as $rule) {
|
||||
foreach ($rules as $rule) {
|
||||
// We should only ever have one Dynamic Filter Rule anyway
|
||||
$dynamicRuleType = $rule->getGrouping();
|
||||
if (($dynamicRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) ||
|
||||
@ -714,7 +714,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
// Number (Average) based
|
||||
// Calculate the average
|
||||
$averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')';
|
||||
$average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula,NULL,$this->_workSheet->getCell('A1'));
|
||||
$average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula,NULL, $this->_workSheet->getCell('A1'));
|
||||
// Set above/below rule based on greaterThan or LessTan
|
||||
$operator = ($dynamicRuleType === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE)
|
||||
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN
|
||||
@ -757,7 +757,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER :
|
||||
$ruleValues = array();
|
||||
$dataRowCount = $rangeEnd[1] - $rangeStart[1];
|
||||
foreach($rules as $rule) {
|
||||
foreach ($rules as $rule) {
|
||||
// We should only ever have one Dynamic Filter Rule anyway
|
||||
$toptenRuleType = $rule->getGrouping();
|
||||
$ruleValue = $rule->getValue();
|
||||
@ -769,7 +769,7 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
if ($ruleValue < 1) $ruleValue = 1;
|
||||
if ($ruleValue > 500) $ruleValue = 500;
|
||||
|
||||
$maxVal = $this->_calculateTopTenValue($columnID,$rangeStart[1]+1,$rangeEnd[1],$toptenRuleType,$ruleValue);
|
||||
$maxVal = $this->_calculateTopTenValue($columnID, $rangeStart[1]+1, $rangeEnd[1], $toptenRuleType, $ruleValue);
|
||||
|
||||
$operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP)
|
||||
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL
|
||||
@ -795,16 +795,16 @@ class PHPExcel_Worksheet_AutoFilter
|
||||
//
|
||||
// Execute the column tests for each row in the autoFilter range to determine show/hide,
|
||||
for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) {
|
||||
// echo 'Testing Row = ',$row,PHP_EOL;
|
||||
// echo 'Testing Row = ', $row,PHP_EOL;
|
||||
$result = TRUE;
|
||||
foreach($columnFilterTests as $columnID => $columnFilterTest) {
|
||||
// echo 'Testing cell ',$columnID.$row,PHP_EOL;
|
||||
foreach ($columnFilterTests as $columnID => $columnFilterTest) {
|
||||
// echo 'Testing cell ', $columnID.$row,PHP_EOL;
|
||||
$cellValue = $this->_workSheet->getCell($columnID.$row)->getCalculatedValue();
|
||||
// echo 'Value is ',$cellValue,PHP_EOL;
|
||||
// echo 'Value is ', $cellValue,PHP_EOL;
|
||||
// Execute the filter test
|
||||
$result = $result &&
|
||||
call_user_func_array(
|
||||
array('PHPExcel_Worksheet_AutoFilter',$columnFilterTest['method']),
|
||||
array('PHPExcel_Worksheet_AutoFilter', $columnFilterTest['method']),
|
||||
array(
|
||||
$cellValue,
|
||||
$columnFilterTest['arguments']
|
||||
|
@ -79,7 +79,7 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
*
|
||||
* @var PHPExcel_Worksheet_AutoFilter
|
||||
*/
|
||||
private $_parent = NULL;
|
||||
private $_parent = null;
|
||||
|
||||
|
||||
/**
|
||||
@ -128,7 +128,7 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @param string $pColumn Column (e.g. A)
|
||||
* @param PHPExcel_Worksheet_AutoFilter $pParent Autofilter for this column
|
||||
*/
|
||||
public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = NULL)
|
||||
public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = null)
|
||||
{
|
||||
$this->_columnIndex = $pColumn;
|
||||
$this->_parent = $pParent;
|
||||
@ -139,7 +139,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColumnIndex() {
|
||||
public function getColumnIndex()
|
||||
{
|
||||
return $this->_columnIndex;
|
||||
}
|
||||
|
||||
@ -150,10 +151,11 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setColumnIndex($pColumn) {
|
||||
public function setColumnIndex($pColumn)
|
||||
{
|
||||
// Uppercase coordinate
|
||||
$pColumn = strtoupper($pColumn);
|
||||
if ($this->_parent !== NULL) {
|
||||
if ($this->_parent !== null) {
|
||||
$this->_parent->testColumnInRange($pColumn);
|
||||
}
|
||||
|
||||
@ -167,7 +169,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter
|
||||
*/
|
||||
public function getParent() {
|
||||
public function getParent()
|
||||
{
|
||||
return $this->_parent;
|
||||
}
|
||||
|
||||
@ -177,7 +180,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @param PHPExcel_Worksheet_AutoFilter
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = NULL) {
|
||||
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = null)
|
||||
{
|
||||
$this->_parent = $pParent;
|
||||
|
||||
return $this;
|
||||
@ -188,7 +192,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFilterType() {
|
||||
public function getFilterType()
|
||||
{
|
||||
return $this->_filterType;
|
||||
}
|
||||
|
||||
@ -199,8 +204,9 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) {
|
||||
if (!in_array($pFilterType,self::$_filterTypes)) {
|
||||
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER)
|
||||
{
|
||||
if (!in_array($pFilterType, self::$_filterTypes)) {
|
||||
throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.');
|
||||
}
|
||||
|
||||
@ -225,10 +231,11 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR) {
|
||||
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR)
|
||||
{
|
||||
// Lowercase And/Or
|
||||
$pJoin = strtolower($pJoin);
|
||||
if (!in_array($pJoin,self::$_ruleJoins)) {
|
||||
if (!in_array($pJoin, self::$_ruleJoins)) {
|
||||
throw new PHPExcel_Exception('Invalid rule connection for column AutoFilter.');
|
||||
}
|
||||
|
||||
@ -244,7 +251,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setAttributes($pAttributes = array()) {
|
||||
public function setAttributes($pAttributes = array())
|
||||
{
|
||||
$this->_attributes = $pAttributes;
|
||||
|
||||
return $this;
|
||||
@ -258,7 +266,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setAttribute($pName, $pValue) {
|
||||
public function setAttribute($pName, $pValue)
|
||||
{
|
||||
$this->_attributes[$pName] = $pValue;
|
||||
|
||||
return $this;
|
||||
@ -269,7 +278,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAttributes() {
|
||||
public function getAttributes()
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
@ -279,10 +289,12 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @param string $pName Attribute Name
|
||||
* @return string
|
||||
*/
|
||||
public function getAttribute($pName) {
|
||||
if (isset($this->_attributes[$pName]))
|
||||
public function getAttribute($pName)
|
||||
{
|
||||
if (isset($this->_attributes[$pName])) {
|
||||
return $this->_attributes[$pName];
|
||||
return NULL;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -291,7 +303,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @throws PHPExcel_Exception
|
||||
* @return array of PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function getRules() {
|
||||
public function getRules()
|
||||
{
|
||||
return $this->_ruleset;
|
||||
}
|
||||
|
||||
@ -301,7 +314,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @param integer $pIndex Rule index in the ruleset array
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function getRule($pIndex) {
|
||||
public function getRule($pIndex)
|
||||
{
|
||||
if (!isset($this->_ruleset[$pIndex])) {
|
||||
$this->_ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
|
||||
}
|
||||
@ -313,7 +327,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function createRule() {
|
||||
public function createRule()
|
||||
{
|
||||
$this->_ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
|
||||
|
||||
return end($this->_ruleset);
|
||||
@ -326,7 +341,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @param boolean $returnRule Flag indicating whether the rule object or the column object should be returned
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column|PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule=TRUE) {
|
||||
public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule = true)
|
||||
{
|
||||
$pRule->setParent($this);
|
||||
$this->_ruleset[] = $pRule;
|
||||
|
||||
@ -340,7 +356,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @param integer $pIndex Rule index in the ruleset array
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function deleteRule($pIndex) {
|
||||
public function deleteRule($pIndex)
|
||||
{
|
||||
if (isset($this->_ruleset[$pIndex])) {
|
||||
unset($this->_ruleset[$pIndex]);
|
||||
// If we've just deleted down to a single rule, then reset And/Or joining to Or
|
||||
@ -357,7 +374,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function clearRules() {
|
||||
public function clearRules()
|
||||
{
|
||||
$this->_ruleset = array();
|
||||
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
|
||||
|
||||
@ -367,13 +385,14 @@ class PHPExcel_Worksheet_AutoFilter_Column
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
if ($key == '_parent') {
|
||||
// Detach from autofilter parent
|
||||
$this->$key = NULL;
|
||||
$this->$key = null;
|
||||
} else {
|
||||
$this->$key = clone $value;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*
|
||||
* @var PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
private $_parent = NULL;
|
||||
private $_parent = null;
|
||||
|
||||
|
||||
/**
|
||||
@ -272,7 +272,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*
|
||||
* @param PHPExcel_Worksheet_AutoFilter_Column $pParent
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL)
|
||||
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = null)
|
||||
{
|
||||
$this->_parent = $pParent;
|
||||
}
|
||||
@ -282,7 +282,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRuleType() {
|
||||
public function getRuleType()
|
||||
{
|
||||
return $this->_ruleType;
|
||||
}
|
||||
|
||||
@ -293,8 +294,9 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) {
|
||||
if (!in_array($pRuleType,self::$_ruleTypes)) {
|
||||
public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER)
|
||||
{
|
||||
if (!in_array($pRuleType, self::$_ruleTypes)) {
|
||||
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
|
||||
}
|
||||
|
||||
@ -308,7 +310,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue() {
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
@ -319,17 +322,18 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setValue($pValue = '') {
|
||||
public function setValue($pValue = '')
|
||||
{
|
||||
if (is_array($pValue)) {
|
||||
$grouping = -1;
|
||||
foreach($pValue as $key => $value) {
|
||||
foreach ($pValue as $key => $value) {
|
||||
// Validate array entries
|
||||
if (!in_array($key,self::$_dateTimeGroups)) {
|
||||
if (!in_array($key, self::$_dateTimeGroups)) {
|
||||
// Remove any invalid entries from the value array
|
||||
unset($pValue[$key]);
|
||||
} else {
|
||||
// Work out what the dateTime grouping will be
|
||||
$grouping = max($grouping,array_search($key,self::$_dateTimeGroups));
|
||||
$grouping = max($grouping, array_search($key,self::$_dateTimeGroups));
|
||||
}
|
||||
}
|
||||
if (count($pValue) == 0) {
|
||||
@ -348,7 +352,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOperator() {
|
||||
public function getOperator()
|
||||
{
|
||||
return $this->_operator;
|
||||
}
|
||||
|
||||
@ -359,11 +364,13 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL) {
|
||||
if (empty($pOperator))
|
||||
public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL)
|
||||
{
|
||||
if (empty($pOperator)) {
|
||||
$pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
|
||||
if ((!in_array($pOperator,self::$_operators)) &&
|
||||
(!in_array($pOperator,self::$_topTenValue))) {
|
||||
}
|
||||
if ((!in_array($pOperator, self::$_operators)) &&
|
||||
(!in_array($pOperator, self::$_topTenValue))) {
|
||||
throw new PHPExcel_Exception('Invalid operator for column AutoFilter Rule.');
|
||||
}
|
||||
$this->_operator = $pOperator;
|
||||
@ -376,7 +383,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGrouping() {
|
||||
public function getGrouping()
|
||||
{
|
||||
return $this->_grouping;
|
||||
}
|
||||
|
||||
@ -387,14 +395,14 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setGrouping($pGrouping = NULL) {
|
||||
if (($pGrouping !== NULL) &&
|
||||
(!in_array($pGrouping,self::$_dateTimeGroups)) &&
|
||||
(!in_array($pGrouping,self::$_dynamicTypes)) &&
|
||||
(!in_array($pGrouping,self::$_topTenType))) {
|
||||
public function setGrouping($pGrouping = null)
|
||||
{
|
||||
if (($pGrouping !== null) &&
|
||||
(!in_array($pGrouping, self::$_dateTimeGroups)) &&
|
||||
(!in_array($pGrouping, self::$_dynamicTypes)) &&
|
||||
(!in_array($pGrouping, self::$_topTenType))) {
|
||||
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
|
||||
}
|
||||
|
||||
$this->_grouping = $pGrouping;
|
||||
|
||||
return $this;
|
||||
@ -409,14 +417,16 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = NULL) {
|
||||
public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = null)
|
||||
{
|
||||
$this->setOperator($pOperator);
|
||||
$this->setValue($pValue);
|
||||
// Only set grouping if it's been passed in as a user-supplied argument,
|
||||
// otherwise we're calculating it when we setValue() and don't want to overwrite that
|
||||
// If the user supplies an argumnet for grouping, then on their own head be it
|
||||
if ($pGrouping !== NULL)
|
||||
if ($pGrouping !== null) {
|
||||
$this->setGrouping($pGrouping);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -426,7 +436,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column
|
||||
*/
|
||||
public function getParent() {
|
||||
public function getParent()
|
||||
{
|
||||
return $this->_parent;
|
||||
}
|
||||
|
||||
@ -436,7 +447,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
* @param PHPExcel_Worksheet_AutoFilter_Column
|
||||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
*/
|
||||
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL) {
|
||||
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = null)
|
||||
{
|
||||
$this->_parent = $pParent;
|
||||
|
||||
return $this;
|
||||
@ -445,13 +457,14 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
if ($key == '_parent') {
|
||||
// Detach from autofilter column parent
|
||||
$this->$key = NULL;
|
||||
$this->$key = null;
|
||||
} else {
|
||||
$this->$key = clone $value;
|
||||
}
|
||||
@ -460,5 +473,4 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -154,7 +154,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getImageIndex() {
|
||||
public function getImageIndex()
|
||||
{
|
||||
return $this->_imageIndex;
|
||||
}
|
||||
|
||||
@ -163,7 +164,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
@ -173,7 +175,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setName($pValue = '') {
|
||||
public function setName($pValue = '')
|
||||
{
|
||||
$this->_name = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -183,7 +186,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription() {
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->_description;
|
||||
}
|
||||
|
||||
@ -193,7 +197,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setDescription($pValue = '') {
|
||||
public function setDescription($pValue = '')
|
||||
{
|
||||
$this->_description = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -203,7 +208,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return PHPExcel_Worksheet
|
||||
*/
|
||||
public function getWorksheet() {
|
||||
public function getWorksheet()
|
||||
{
|
||||
return $this->_worksheet;
|
||||
}
|
||||
|
||||
@ -215,7 +221,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) {
|
||||
public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false)
|
||||
{
|
||||
if (is_null($this->_worksheet)) {
|
||||
// Add drawing to PHPExcel_Worksheet
|
||||
$this->_worksheet = $pValue;
|
||||
@ -228,7 +235,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
|
||||
while ($iterator->valid()) {
|
||||
if ($iterator->current()->getHashCode() == $this->getHashCode()) {
|
||||
$this->_worksheet->getDrawingCollection()->offsetUnset( $iterator->key() );
|
||||
$this->_worksheet->getDrawingCollection()->offsetUnset($iterator->key());
|
||||
$this->_worksheet = null;
|
||||
break;
|
||||
}
|
||||
@ -248,7 +255,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCoordinates() {
|
||||
public function getCoordinates()
|
||||
{
|
||||
return $this->_coordinates;
|
||||
}
|
||||
|
||||
@ -258,7 +266,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setCoordinates($pValue = 'A1') {
|
||||
public function setCoordinates($pValue = 'A1')
|
||||
{
|
||||
$this->_coordinates = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -268,7 +277,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOffsetX() {
|
||||
public function getOffsetX()
|
||||
{
|
||||
return $this->_offsetX;
|
||||
}
|
||||
|
||||
@ -278,7 +288,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setOffsetX($pValue = 0) {
|
||||
public function setOffsetX($pValue = 0)
|
||||
{
|
||||
$this->_offsetX = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -288,7 +299,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOffsetY() {
|
||||
public function getOffsetY()
|
||||
{
|
||||
return $this->_offsetY;
|
||||
}
|
||||
|
||||
@ -298,7 +310,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setOffsetY($pValue = 0) {
|
||||
public function setOffsetY($pValue = 0)
|
||||
{
|
||||
$this->_offsetY = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -308,7 +321,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth() {
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
@ -318,7 +332,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setWidth($pValue = 0) {
|
||||
public function setWidth($pValue = 0)
|
||||
{
|
||||
// Resize proportional?
|
||||
if ($this->_resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->_height / ($this->_width != 0 ? $this->_width : 1);
|
||||
@ -336,7 +351,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight() {
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->_height;
|
||||
}
|
||||
|
||||
@ -346,7 +362,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setHeight($pValue = 0) {
|
||||
public function setHeight($pValue = 0)
|
||||
{
|
||||
// Resize proportional?
|
||||
if ($this->_resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->_width / ($this->_height != 0 ? $this->_height : 1);
|
||||
@ -372,7 +389,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param int $height
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setWidthAndHeight($width = 0, $height = 0) {
|
||||
public function setWidthAndHeight($width = 0, $height = 0)
|
||||
{
|
||||
$xratio = $width / ($this->_width != 0 ? $this->_width : 1);
|
||||
$yratio = $height / ($this->_height != 0 ? $this->_height : 1);
|
||||
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
|
||||
@ -396,7 +414,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getResizeProportional() {
|
||||
public function getResizeProportional()
|
||||
{
|
||||
return $this->_resizeProportional;
|
||||
}
|
||||
|
||||
@ -406,7 +425,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setResizeProportional($pValue = true) {
|
||||
public function setResizeProportional($pValue = true)
|
||||
{
|
||||
$this->_resizeProportional = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -416,7 +436,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRotation() {
|
||||
public function getRotation()
|
||||
{
|
||||
return $this->_rotation;
|
||||
}
|
||||
|
||||
@ -426,7 +447,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setRotation($pValue = 0) {
|
||||
public function setRotation($pValue = 0)
|
||||
{
|
||||
$this->_rotation = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -436,7 +458,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return PHPExcel_Worksheet_Drawing_Shadow
|
||||
*/
|
||||
public function getShadow() {
|
||||
public function getShadow()
|
||||
{
|
||||
return $this->_shadow;
|
||||
}
|
||||
|
||||
@ -447,7 +470,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_BaseDrawing
|
||||
*/
|
||||
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) {
|
||||
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null)
|
||||
{
|
||||
$this->_shadow = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -457,26 +481,16 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_name
|
||||
. $this->_description
|
||||
. $this->_worksheet->getHashCode()
|
||||
. $this->_coordinates
|
||||
. $this->_offsetX
|
||||
. $this->_offsetY
|
||||
. $this->_width
|
||||
. $this->_height
|
||||
. $this->_rotation
|
||||
. $this->_shadow->getHashCode()
|
||||
. __CLASS__
|
||||
);
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5($this->_name.$this->_description.$this->_worksheet->getHashCode().$this->_coordinates.$this->_offsetX.$this->_offsetY.$this->_width.$this->_height.$this->_rotation.$this->_shadow->getHashCode().__CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
|
@ -92,11 +92,11 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
// Initialise values
|
||||
$this->_path = '';
|
||||
$this->_name = '';
|
||||
$this->_offsetX = 0;
|
||||
$this->_offsetY = 0;
|
||||
$this->_width = 0;
|
||||
$this->_height = 0;
|
||||
$this->_resizeProportional = true;
|
||||
$this->_offsetX = 0;
|
||||
$this->_offsetY = 0;
|
||||
$this->_width = 0;
|
||||
$this->_height = 0;
|
||||
$this->_resizeProportional = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,7 +104,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
@ -114,7 +115,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setName($pValue = '') {
|
||||
public function setName($pValue = '')
|
||||
{
|
||||
$this->_name = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -124,7 +126,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOffsetX() {
|
||||
public function getOffsetX()
|
||||
{
|
||||
return $this->_offsetX;
|
||||
}
|
||||
|
||||
@ -134,7 +137,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setOffsetX($pValue = 0) {
|
||||
public function setOffsetX($pValue = 0)
|
||||
{
|
||||
$this->_offsetX = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -144,7 +148,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOffsetY() {
|
||||
public function getOffsetY()
|
||||
{
|
||||
return $this->_offsetY;
|
||||
}
|
||||
|
||||
@ -154,7 +159,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setOffsetY($pValue = 0) {
|
||||
public function setOffsetY($pValue = 0)
|
||||
{
|
||||
$this->_offsetY = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -164,7 +170,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth() {
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
@ -174,7 +181,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setWidth($pValue = 0) {
|
||||
public function setWidth($pValue = 0)
|
||||
{
|
||||
// Resize proportional?
|
||||
if ($this->_resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->_width / $this->_height;
|
||||
@ -192,7 +200,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight() {
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->_height;
|
||||
}
|
||||
|
||||
@ -202,7 +211,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param int $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setHeight($pValue = 0) {
|
||||
public function setHeight($pValue = 0)
|
||||
{
|
||||
// Resize proportional?
|
||||
if ($this->_resizeProportional && $pValue != 0) {
|
||||
$ratio = $this->_width / $this->_height;
|
||||
@ -228,7 +238,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param int $height
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setWidthAndHeight($width = 0, $height = 0) {
|
||||
public function setWidthAndHeight($width = 0, $height = 0)
|
||||
{
|
||||
$xratio = $width / $this->_width;
|
||||
$yratio = $height / $this->_height;
|
||||
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
|
||||
@ -248,7 +259,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getResizeProportional() {
|
||||
public function getResizeProportional()
|
||||
{
|
||||
return $this->_resizeProportional;
|
||||
}
|
||||
|
||||
@ -258,7 +270,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setResizeProportional($pValue = true) {
|
||||
public function setResizeProportional($pValue = true)
|
||||
{
|
||||
$this->_resizeProportional = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -268,7 +281,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFilename() {
|
||||
public function getFilename()
|
||||
{
|
||||
return basename($this->_path);
|
||||
}
|
||||
|
||||
@ -277,7 +291,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExtension() {
|
||||
public function getExtension()
|
||||
{
|
||||
$parts = explode(".", basename($this->_path));
|
||||
return end($parts);
|
||||
}
|
||||
@ -287,7 +302,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPath() {
|
||||
public function getPath()
|
||||
{
|
||||
return $this->_path;
|
||||
}
|
||||
|
||||
@ -299,7 +315,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_HeaderFooterDrawing
|
||||
*/
|
||||
public function setPath($pValue = '', $pVerifyFile = true) {
|
||||
public function setPath($pValue = '', $pVerifyFile = true)
|
||||
{
|
||||
if ($pVerifyFile) {
|
||||
if (file_exists($pValue)) {
|
||||
$this->_path = $pValue;
|
||||
@ -322,9 +339,10 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
$this->_path
|
||||
$this->_path
|
||||
. $this->_name
|
||||
. $this->_offsetX
|
||||
. $this->_offsetY
|
||||
@ -337,7 +355,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
|
@ -81,10 +81,10 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_imageResource = null;
|
||||
$this->_renderingFunction = self::RENDERING_DEFAULT;
|
||||
$this->_imageResource = null;
|
||||
$this->_renderingFunction = self::RENDERING_DEFAULT;
|
||||
$this->_mimeType = self::MIMETYPE_DEFAULT;
|
||||
$this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999));
|
||||
$this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999));
|
||||
|
||||
// Initialize parent
|
||||
parent::__construct();
|
||||
@ -95,7 +95,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
public function getImageResource() {
|
||||
public function getImageResource()
|
||||
{
|
||||
return $this->_imageResource;
|
||||
}
|
||||
|
||||
@ -105,7 +106,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
* @param $value resource
|
||||
* @return PHPExcel_Worksheet_MemoryDrawing
|
||||
*/
|
||||
public function setImageResource($value = null) {
|
||||
public function setImageResource($value = null)
|
||||
{
|
||||
$this->_imageResource = $value;
|
||||
|
||||
if (!is_null($this->_imageResource)) {
|
||||
@ -121,7 +123,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRenderingFunction() {
|
||||
public function getRenderingFunction()
|
||||
{
|
||||
return $this->_renderingFunction;
|
||||
}
|
||||
|
||||
@ -131,7 +134,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
* @param string $value
|
||||
* @return PHPExcel_Worksheet_MemoryDrawing
|
||||
*/
|
||||
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) {
|
||||
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT)
|
||||
{
|
||||
$this->_renderingFunction = $value;
|
||||
return $this;
|
||||
}
|
||||
@ -141,7 +145,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMimeType() {
|
||||
public function getMimeType()
|
||||
{
|
||||
return $this->_mimeType;
|
||||
}
|
||||
|
||||
@ -151,7 +156,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
* @param string $value
|
||||
* @return PHPExcel_Worksheet_MemoryDrawing
|
||||
*/
|
||||
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) {
|
||||
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT)
|
||||
{
|
||||
$this->_mimeType = $value;
|
||||
return $this;
|
||||
}
|
||||
@ -161,7 +167,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIndexedFilename() {
|
||||
public function getIndexedFilename()
|
||||
{
|
||||
$extension = strtolower($this->getMimeType());
|
||||
$extension = explode('/', $extension);
|
||||
$extension = $extension[1];
|
||||
@ -174,9 +181,10 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
$this->_renderingFunction
|
||||
$this->_renderingFunction
|
||||
. $this->_mimeType
|
||||
. $this->_uniqueName
|
||||
. parent::getHashCode()
|
||||
|
@ -89,7 +89,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getLeft() {
|
||||
public function getLeft()
|
||||
{
|
||||
return $this->_left;
|
||||
}
|
||||
|
||||
@ -99,7 +100,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setLeft($pValue) {
|
||||
public function setLeft($pValue)
|
||||
{
|
||||
$this->_left = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -109,7 +111,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getRight() {
|
||||
public function getRight()
|
||||
{
|
||||
return $this->_right;
|
||||
}
|
||||
|
||||
@ -119,7 +122,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setRight($pValue) {
|
||||
public function setRight($pValue)
|
||||
{
|
||||
$this->_right = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -129,7 +133,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getTop() {
|
||||
public function getTop()
|
||||
{
|
||||
return $this->_top;
|
||||
}
|
||||
|
||||
@ -139,7 +144,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setTop($pValue) {
|
||||
public function setTop($pValue)
|
||||
{
|
||||
$this->_top = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -149,7 +155,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getBottom() {
|
||||
public function getBottom()
|
||||
{
|
||||
return $this->_bottom;
|
||||
}
|
||||
|
||||
@ -159,7 +166,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setBottom($pValue) {
|
||||
public function setBottom($pValue)
|
||||
{
|
||||
$this->_bottom = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -169,7 +177,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getHeader() {
|
||||
public function getHeader()
|
||||
{
|
||||
return $this->_header;
|
||||
}
|
||||
|
||||
@ -179,7 +188,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setHeader($pValue) {
|
||||
public function setHeader($pValue)
|
||||
{
|
||||
$this->_header = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -189,7 +199,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getFooter() {
|
||||
public function getFooter()
|
||||
{
|
||||
return $this->_footer;
|
||||
}
|
||||
|
||||
@ -199,7 +210,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
* @param double $pValue
|
||||
* @return PHPExcel_Worksheet_PageMargins
|
||||
*/
|
||||
public function setFooter($pValue) {
|
||||
public function setFooter($pValue)
|
||||
{
|
||||
$this->_footer = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -207,7 +219,8 @@ class PHPExcel_Worksheet_PageMargins
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
|
@ -575,7 +575,7 @@ class PHPExcel_Worksheet_PageSetup
|
||||
if ($index == 0) {
|
||||
return $this->_printArea;
|
||||
}
|
||||
$printAreas = explode(',',$this->_printArea);
|
||||
$printAreas = explode(',', $this->_printArea);
|
||||
if (isset($printAreas[$index-1])) {
|
||||
return $printAreas[$index-1];
|
||||
}
|
||||
@ -595,7 +595,7 @@ class PHPExcel_Worksheet_PageSetup
|
||||
if ($index == 0) {
|
||||
return !is_null($this->_printArea);
|
||||
}
|
||||
$printAreas = explode(',',$this->_printArea);
|
||||
$printAreas = explode(',', $this->_printArea);
|
||||
return isset($printAreas[$index-1]);
|
||||
}
|
||||
|
||||
@ -612,10 +612,10 @@ class PHPExcel_Worksheet_PageSetup
|
||||
if ($index == 0) {
|
||||
$this->_printArea = NULL;
|
||||
} else {
|
||||
$printAreas = explode(',',$this->_printArea);
|
||||
$printAreas = explode(',', $this->_printArea);
|
||||
if (isset($printAreas[$index-1])) {
|
||||
unset($printAreas[$index-1]);
|
||||
$this->_printArea = implode(',',$printAreas);
|
||||
$this->_printArea = implode(',', $printAreas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -656,29 +656,29 @@ class PHPExcel_Worksheet_PageSetup
|
||||
if ($index == 0) {
|
||||
$this->_printArea = $value;
|
||||
} else {
|
||||
$printAreas = explode(',',$this->_printArea);
|
||||
if($index < 0) {
|
||||
$printAreas = explode(',', $this->_printArea);
|
||||
if ($index < 0) {
|
||||
$index = count($printAreas) - abs($index) + 1;
|
||||
}
|
||||
if (($index <= 0) || ($index > count($printAreas))) {
|
||||
throw new PHPExcel_Exception('Invalid index for setting print range.');
|
||||
}
|
||||
$printAreas[$index-1] = $value;
|
||||
$this->_printArea = implode(',',$printAreas);
|
||||
$this->_printArea = implode(',', $printAreas);
|
||||
}
|
||||
} elseif($method == self::SETPRINTRANGE_INSERT) {
|
||||
} elseif ($method == self::SETPRINTRANGE_INSERT) {
|
||||
if ($index == 0) {
|
||||
$this->_printArea .= ($this->_printArea == '') ? $value : ','.$value;
|
||||
} else {
|
||||
$printAreas = explode(',',$this->_printArea);
|
||||
if($index < 0) {
|
||||
$printAreas = explode(',', $this->_printArea);
|
||||
if ($index < 0) {
|
||||
$index = abs($index) - 1;
|
||||
}
|
||||
if ($index > count($printAreas)) {
|
||||
throw new PHPExcel_Exception('Invalid index for setting print range.');
|
||||
}
|
||||
$printAreas = array_merge(array_slice($printAreas,0,$index),array($value),array_slice($printAreas,$index));
|
||||
$this->_printArea = implode(',',$printAreas);
|
||||
$printAreas = array_merge(array_slice($printAreas,0, $index),array($value),array_slice($printAreas, $index));
|
||||
$this->_printArea = implode(',', $printAreas);
|
||||
}
|
||||
} else {
|
||||
throw new PHPExcel_Exception('Invalid method for setting print range.');
|
||||
|
@ -86,7 +86,8 @@ class PHPExcel_Worksheet_SheetView
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getZoomScale() {
|
||||
public function getZoomScale()
|
||||
{
|
||||
return $this->_zoomScale;
|
||||
}
|
||||
|
||||
@ -99,7 +100,8 @@ class PHPExcel_Worksheet_SheetView
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_SheetView
|
||||
*/
|
||||
public function setZoomScale($pValue = 100) {
|
||||
public function setZoomScale($pValue = 100)
|
||||
{
|
||||
// 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
|
||||
if (($pValue >= 1) || is_null($pValue)) {
|
||||
@ -115,7 +117,8 @@ class PHPExcel_Worksheet_SheetView
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getZoomScaleNormal() {
|
||||
public function getZoomScaleNormal()
|
||||
{
|
||||
return $this->_zoomScaleNormal;
|
||||
}
|
||||
|
||||
@ -128,7 +131,8 @@ class PHPExcel_Worksheet_SheetView
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_SheetView
|
||||
*/
|
||||
public function setZoomScaleNormal($pValue = 100) {
|
||||
public function setZoomScaleNormal($pValue = 100)
|
||||
{
|
||||
if (($pValue >= 1) || is_null($pValue)) {
|
||||
$this->_zoomScaleNormal = $pValue;
|
||||
} else {
|
||||
@ -142,7 +146,8 @@ class PHPExcel_Worksheet_SheetView
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getView() {
|
||||
public function getView()
|
||||
{
|
||||
return $this->_sheetviewType;
|
||||
}
|
||||
|
||||
@ -158,11 +163,12 @@ class PHPExcel_Worksheet_SheetView
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Worksheet_SheetView
|
||||
*/
|
||||
public function setView($pValue = NULL) {
|
||||
// MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview'
|
||||
// via the user interface
|
||||
if ($pValue === NULL)
|
||||
public function setView($pValue = null)
|
||||
{
|
||||
// MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview' via the user interface
|
||||
if ($pValue === null) {
|
||||
$pValue = self::SHEETVIEW_NORMAL;
|
||||
}
|
||||
if (in_array($pValue, self::$_sheetViewTypes)) {
|
||||
$this->_sheetviewType = $pValue;
|
||||
} else {
|
||||
@ -175,7 +181,8 @@ class PHPExcel_Worksheet_SheetView
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
|
@ -98,7 +98,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
$sheet = $this->_phpExcel->getSheet($this->_sheetIndex);
|
||||
|
||||
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
|
||||
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE);
|
||||
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
|
||||
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
|
||||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
|
||||
|
||||
@ -124,9 +124,9 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
$maxRow = $sheet->getHighestDataRow();
|
||||
|
||||
// Write rows to file
|
||||
for($row = 1; $row <= $maxRow; ++$row) {
|
||||
for ($row = 1; $row <= $maxRow; ++$row) {
|
||||
// Convert the row to an array...
|
||||
$cellsArray = $sheet->rangeToArray('A'.$row.':'.$maxCol.$row,'', $this->_preCalculateFormulas);
|
||||
$cellsArray = $sheet->rangeToArray('A'.$row.':'.$maxCol.$row, '', $this->_preCalculateFormulas);
|
||||
// ... and write to the file
|
||||
$this->_writeLine($fileHandle, $cellsArray[0]);
|
||||
}
|
||||
@ -143,7 +143,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter() {
|
||||
public function getDelimiter()
|
||||
{
|
||||
return $this->_delimiter;
|
||||
}
|
||||
|
||||
@ -153,7 +154,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param string $pValue Delimiter, defaults to ,
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setDelimiter($pValue = ',') {
|
||||
public function setDelimiter($pValue = ',')
|
||||
{
|
||||
$this->_delimiter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -163,7 +165,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEnclosure() {
|
||||
public function getEnclosure()
|
||||
{
|
||||
return $this->_enclosure;
|
||||
}
|
||||
|
||||
@ -173,7 +176,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param string $pValue Enclosure, defaults to "
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setEnclosure($pValue = '"') {
|
||||
public function setEnclosure($pValue = '"')
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = null;
|
||||
}
|
||||
@ -186,7 +190,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLineEnding() {
|
||||
public function getLineEnding()
|
||||
{
|
||||
return $this->_lineEnding;
|
||||
}
|
||||
|
||||
@ -196,7 +201,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setLineEnding($pValue = PHP_EOL) {
|
||||
public function setLineEnding($pValue = PHP_EOL)
|
||||
{
|
||||
$this->_lineEnding = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -206,7 +212,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getUseBOM() {
|
||||
public function getUseBOM()
|
||||
{
|
||||
return $this->_useBOM;
|
||||
}
|
||||
|
||||
@ -216,7 +223,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param boolean $pValue Use UTF-8 byte-order mark? Defaults to false
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setUseBOM($pValue = false) {
|
||||
public function setUseBOM($pValue = false)
|
||||
{
|
||||
$this->_useBOM = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -226,7 +234,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getExcelCompatibility() {
|
||||
public function getExcelCompatibility()
|
||||
{
|
||||
return $this->_excelCompatibility;
|
||||
}
|
||||
|
||||
@ -237,7 +246,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* Note that this overrides other settings such as useBOM, enclosure and delimiter
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setExcelCompatibility($pValue = false) {
|
||||
public function setExcelCompatibility($pValue = false)
|
||||
{
|
||||
$this->_excelCompatibility = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -247,7 +257,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSheetIndex() {
|
||||
public function getSheetIndex()
|
||||
{
|
||||
return $this->_sheetIndex;
|
||||
}
|
||||
|
||||
@ -257,7 +268,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param int $pValue Sheet index
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setSheetIndex($pValue = 0) {
|
||||
public function setSheetIndex($pValue = 0)
|
||||
{
|
||||
$this->_sheetIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -269,7 +281,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param array $pValues Array containing values in a row
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
private function _writeLine($pFileHandle = null, $pValues = null) {
|
||||
private function _writeLine($pFileHandle = null, $pValues = null)
|
||||
{
|
||||
if (is_array($pValues)) {
|
||||
// No leading delimiter
|
||||
$writeDelimiter = false;
|
||||
@ -301,5 +314,4 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -125,18 +125,18 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
// Assign PHPExcel
|
||||
$this->setPHPExcel($pPHPExcel);
|
||||
|
||||
$writerPartsArray = array( 'stringtable' => 'PHPExcel_Writer_Excel2007_StringTable',
|
||||
'contenttypes' => 'PHPExcel_Writer_Excel2007_ContentTypes',
|
||||
'docprops' => 'PHPExcel_Writer_Excel2007_DocProps',
|
||||
'rels' => 'PHPExcel_Writer_Excel2007_Rels',
|
||||
'theme' => 'PHPExcel_Writer_Excel2007_Theme',
|
||||
'style' => 'PHPExcel_Writer_Excel2007_Style',
|
||||
'workbook' => 'PHPExcel_Writer_Excel2007_Workbook',
|
||||
'worksheet' => 'PHPExcel_Writer_Excel2007_Worksheet',
|
||||
'drawing' => 'PHPExcel_Writer_Excel2007_Drawing',
|
||||
'comments' => 'PHPExcel_Writer_Excel2007_Comments',
|
||||
'chart' => 'PHPExcel_Writer_Excel2007_Chart',
|
||||
'relsvba' => 'PHPExcel_Writer_Excel2007_RelsVBA',
|
||||
$writerPartsArray = array( 'stringtable' => 'PHPExcel_Writer_Excel2007_StringTable',
|
||||
'contenttypes' => 'PHPExcel_Writer_Excel2007_ContentTypes',
|
||||
'docprops' => 'PHPExcel_Writer_Excel2007_DocProps',
|
||||
'rels' => 'PHPExcel_Writer_Excel2007_Rels',
|
||||
'theme' => 'PHPExcel_Writer_Excel2007_Theme',
|
||||
'style' => 'PHPExcel_Writer_Excel2007_Style',
|
||||
'workbook' => 'PHPExcel_Writer_Excel2007_Workbook',
|
||||
'worksheet' => 'PHPExcel_Writer_Excel2007_Worksheet',
|
||||
'drawing' => 'PHPExcel_Writer_Excel2007_Drawing',
|
||||
'comments' => 'PHPExcel_Writer_Excel2007_Comments',
|
||||
'chart' => 'PHPExcel_Writer_Excel2007_Chart',
|
||||
'relsvba' => 'PHPExcel_Writer_Excel2007_RelsVBA',
|
||||
'relsribbonobjects' => 'PHPExcel_Writer_Excel2007_RelsRibbon'
|
||||
);
|
||||
|
||||
@ -163,7 +163,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @param string $pPartName Writer part name
|
||||
* @return PHPExcel_Writer_Excel2007_WriterPart
|
||||
*/
|
||||
public function getWriterPart($pPartName = '') {
|
||||
public function getWriterPart($pPartName = '')
|
||||
{
|
||||
if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) {
|
||||
return $this->_writerParts[strtolower($pPartName)];
|
||||
} else {
|
||||
@ -179,7 +180,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*/
|
||||
public function save($pFilename = null)
|
||||
{
|
||||
if ($this->_spreadSheet !== NULL) {
|
||||
if ($this->_spreadSheet !== null) {
|
||||
// garbage collect
|
||||
$this->_spreadSheet->garbageCollect();
|
||||
|
||||
@ -193,7 +194,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
}
|
||||
|
||||
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->getWriteDebugLog();
|
||||
PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog(FALSE);
|
||||
PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog(false);
|
||||
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
|
||||
@ -204,15 +205,15 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
}
|
||||
|
||||
// Create styles dictionaries
|
||||
$this->_styleHashTable->addFromSource( $this->getWriterPart('Style')->allStyles($this->_spreadSheet) );
|
||||
$this->_stylesConditionalHashTable->addFromSource( $this->getWriterPart('Style')->allConditionalStyles($this->_spreadSheet) );
|
||||
$this->_fillHashTable->addFromSource( $this->getWriterPart('Style')->allFills($this->_spreadSheet) );
|
||||
$this->_fontHashTable->addFromSource( $this->getWriterPart('Style')->allFonts($this->_spreadSheet) );
|
||||
$this->_bordersHashTable->addFromSource( $this->getWriterPart('Style')->allBorders($this->_spreadSheet) );
|
||||
$this->_numFmtHashTable->addFromSource( $this->getWriterPart('Style')->allNumberFormats($this->_spreadSheet) );
|
||||
$this->_styleHashTable->addFromSource($this->getWriterPart('Style')->allStyles($this->_spreadSheet));
|
||||
$this->_stylesConditionalHashTable->addFromSource($this->getWriterPart('Style')->allConditionalStyles($this->_spreadSheet));
|
||||
$this->_fillHashTable->addFromSource($this->getWriterPart('Style')->allFills($this->_spreadSheet));
|
||||
$this->_fontHashTable->addFromSource($this->getWriterPart('Style')->allFonts($this->_spreadSheet));
|
||||
$this->_bordersHashTable->addFromSource($this->getWriterPart('Style')->allBorders($this->_spreadSheet));
|
||||
$this->_numFmtHashTable->addFromSource($this->getWriterPart('Style')->allNumberFormats($this->_spreadSheet));
|
||||
|
||||
// Create drawing dictionary
|
||||
$this->_drawingHashTable->addFromSource( $this->getWriterPart('Drawing')->allDrawings($this->_spreadSheet) );
|
||||
$this->_drawingHashTable->addFromSource($this->getWriterPart('Drawing')->allDrawings($this->_spreadSheet));
|
||||
|
||||
// Create new ZIP file and open it for writing
|
||||
$zipClass = PHPExcel_Settings::getZipClass();
|
||||
@ -235,60 +236,58 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
}
|
||||
|
||||
// Add [Content_Types].xml to ZIP file
|
||||
$objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->_spreadSheet, $this->_includeCharts));
|
||||
$objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->_spreadSheet, $this->_includeCharts));
|
||||
|
||||
//if hasMacros, add the vbaProject.bin file, Certificate file(if exists)
|
||||
if($this->_spreadSheet->hasMacros()){
|
||||
if ($this->_spreadSheet->hasMacros()) {
|
||||
$macrosCode=$this->_spreadSheet->getMacrosCode();
|
||||
if(!is_null($macrosCode)){// we have the code ?
|
||||
if (!is_null($macrosCode)) {// we have the code ?
|
||||
$objZip->addFromString('xl/vbaProject.bin', $macrosCode);//allways in 'xl', allways named vbaProject.bin
|
||||
if($this->_spreadSheet->hasMacrosCertificate()){//signed macros ?
|
||||
if ($this->_spreadSheet->hasMacrosCertificate()) {//signed macros ?
|
||||
// Yes : add the certificate file and the related rels file
|
||||
$objZip->addFromString('xl/vbaProjectSignature.bin', $this->_spreadSheet->getMacrosCertificate());
|
||||
$objZip->addFromString('xl/_rels/vbaProject.bin.rels',
|
||||
$this->getWriterPart('RelsVBA')->writeVBARelationships($this->_spreadSheet));
|
||||
$objZip->addFromString('xl/_rels/vbaProject.bin.rels', $this->getWriterPart('RelsVBA')->writeVBARelationships($this->_spreadSheet));
|
||||
}
|
||||
}
|
||||
}
|
||||
//a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels)
|
||||
if($this->_spreadSheet->hasRibbon()){
|
||||
if ($this->_spreadSheet->hasRibbon()) {
|
||||
$tmpRibbonTarget=$this->_spreadSheet->getRibbonXMLData('target');
|
||||
$objZip->addFromString($tmpRibbonTarget, $this->_spreadSheet->getRibbonXMLData('data'));
|
||||
if($this->_spreadSheet->hasRibbonBinObjects()){
|
||||
if ($this->_spreadSheet->hasRibbonBinObjects()) {
|
||||
$tmpRootPath=dirname($tmpRibbonTarget).'/';
|
||||
$ribbonBinObjects=$this->_spreadSheet->getRibbonBinObjects('data');//the files to write
|
||||
foreach($ribbonBinObjects as $aPath=>$aContent){
|
||||
foreach ($ribbonBinObjects as $aPath=>$aContent) {
|
||||
$objZip->addFromString($tmpRootPath.$aPath, $aContent);
|
||||
}
|
||||
//the rels for files
|
||||
$objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels',
|
||||
$this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->_spreadSheet));
|
||||
$objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels', $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->_spreadSheet));
|
||||
}
|
||||
}
|
||||
|
||||
// Add relationships to ZIP file
|
||||
$objZip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->_spreadSheet));
|
||||
$objZip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->_spreadSheet));
|
||||
$objZip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->_spreadSheet));
|
||||
$objZip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->_spreadSheet));
|
||||
|
||||
// Add document properties to ZIP file
|
||||
$objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->_spreadSheet));
|
||||
$objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->_spreadSheet));
|
||||
$objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->_spreadSheet));
|
||||
$objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->_spreadSheet));
|
||||
$customPropertiesPart = $this->getWriterPart('DocProps')->writeDocPropsCustom($this->_spreadSheet);
|
||||
if ($customPropertiesPart !== NULL) {
|
||||
$objZip->addFromString('docProps/custom.xml', $customPropertiesPart);
|
||||
if ($customPropertiesPart !== null) {
|
||||
$objZip->addFromString('docProps/custom.xml', $customPropertiesPart);
|
||||
}
|
||||
|
||||
// Add theme to ZIP file
|
||||
$objZip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->writeTheme($this->_spreadSheet));
|
||||
$objZip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->writeTheme($this->_spreadSheet));
|
||||
|
||||
// Add string table to ZIP file
|
||||
$objZip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->writeStringTable($this->_stringTable));
|
||||
$objZip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->writeStringTable($this->_stringTable));
|
||||
|
||||
// Add styles to ZIP file
|
||||
$objZip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->writeStyles($this->_spreadSheet));
|
||||
$objZip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->writeStyles($this->_spreadSheet));
|
||||
|
||||
// Add workbook to ZIP file
|
||||
$objZip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->writeWorkbook($this->_spreadSheet, $this->_preCalculateFormulas));
|
||||
$objZip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->writeWorkbook($this->_spreadSheet, $this->_preCalculateFormulas));
|
||||
|
||||
$chartCount = 0;
|
||||
// Add worksheets
|
||||
@ -297,7 +296,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
if ($this->_includeCharts) {
|
||||
$charts = $this->_spreadSheet->getSheet($i)->getChartCollection();
|
||||
if (count($charts) > 0) {
|
||||
foreach($charts as $chart) {
|
||||
foreach ($charts as $chart) {
|
||||
$objZip->addFromString('xl/charts/chart' . ($chartCount + 1) . '.xml', $this->getWriterPart('Chart')->writeChart($chart));
|
||||
$chartCount++;
|
||||
}
|
||||
@ -308,9 +307,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
$chartRef1 = $chartRef2 = 0;
|
||||
// Add worksheet relationships (drawings, ...)
|
||||
for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) {
|
||||
|
||||
// Add relationships
|
||||
$objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i), ($i + 1), $this->_includeCharts));
|
||||
$objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i), ($i + 1), $this->_includeCharts));
|
||||
|
||||
$drawings = $this->_spreadSheet->getSheet($i)->getDrawingCollection();
|
||||
$drawingCount = count($drawings);
|
||||
@ -321,10 +319,10 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
// Add drawing and image relationship parts
|
||||
if (($drawingCount > 0) || ($chartCount > 0)) {
|
||||
// Drawing relationships
|
||||
$objZip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->_spreadSheet->getSheet($i),$chartRef1, $this->_includeCharts));
|
||||
$objZip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->_spreadSheet->getSheet($i), $chartRef1, $this->_includeCharts));
|
||||
|
||||
// Drawings
|
||||
$objZip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->_spreadSheet->getSheet($i),$chartRef2,$this->_includeCharts));
|
||||
$objZip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->_spreadSheet->getSheet($i), $chartRef2, $this->_includeCharts));
|
||||
}
|
||||
|
||||
// Add comment relationship parts
|
||||
@ -409,7 +407,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @return PHPExcel
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function getPHPExcel() {
|
||||
public function getPHPExcel()
|
||||
{
|
||||
if ($this->_spreadSheet !== null) {
|
||||
return $this->_spreadSheet;
|
||||
} else {
|
||||
@ -424,7 +423,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
* @return PHPExcel_Writer_Excel2007
|
||||
*/
|
||||
public function setPHPExcel(PHPExcel $pPHPExcel = null) {
|
||||
public function setPHPExcel(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
$this->_spreadSheet = $pPHPExcel;
|
||||
return $this;
|
||||
}
|
||||
@ -434,7 +434,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getStringTable() {
|
||||
public function getStringTable()
|
||||
{
|
||||
return $this->_stringTable;
|
||||
}
|
||||
|
||||
@ -443,7 +444,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getStyleHashTable() {
|
||||
public function getStyleHashTable()
|
||||
{
|
||||
return $this->_styleHashTable;
|
||||
}
|
||||
|
||||
@ -452,7 +454,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getStylesConditionalHashTable() {
|
||||
public function getStylesConditionalHashTable()
|
||||
{
|
||||
return $this->_stylesConditionalHashTable;
|
||||
}
|
||||
|
||||
@ -461,7 +464,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getFillHashTable() {
|
||||
public function getFillHashTable()
|
||||
{
|
||||
return $this->_fillHashTable;
|
||||
}
|
||||
|
||||
@ -470,7 +474,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getFontHashTable() {
|
||||
public function getFontHashTable()
|
||||
{
|
||||
return $this->_fontHashTable;
|
||||
}
|
||||
|
||||
@ -479,7 +484,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getBordersHashTable() {
|
||||
public function getBordersHashTable()
|
||||
{
|
||||
return $this->_bordersHashTable;
|
||||
}
|
||||
|
||||
@ -488,7 +494,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getNumFmtHashTable() {
|
||||
public function getNumFmtHashTable()
|
||||
{
|
||||
return $this->_numFmtHashTable;
|
||||
}
|
||||
|
||||
@ -497,7 +504,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getDrawingHashTable() {
|
||||
public function getDrawingHashTable()
|
||||
{
|
||||
return $this->_drawingHashTable;
|
||||
}
|
||||
|
||||
@ -506,7 +514,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getOffice2003Compatibility() {
|
||||
public function getOffice2003Compatibility()
|
||||
{
|
||||
return $this->_office2003compatibility;
|
||||
}
|
||||
|
||||
@ -516,9 +525,9 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @param boolean $pValue Office2003 compatibility?
|
||||
* @return PHPExcel_Writer_Excel2007
|
||||
*/
|
||||
public function setOffice2003Compatibility($pValue = false) {
|
||||
public function setOffice2003Compatibility($pValue = false)
|
||||
{
|
||||
$this->_office2003compatibility = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -53,7 +53,7 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Comments cache
|
||||
$comments = $pWorksheet->getComments();
|
||||
@ -133,7 +133,7 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Comments cache
|
||||
$comments = $pWorksheet->getComments();
|
||||
|
@ -43,7 +43,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = FALSE)
|
||||
public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = false)
|
||||
{
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
@ -54,87 +54,59 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Types
|
||||
$objWriter->startElement('Types');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
|
||||
|
||||
// Theme
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml');
|
||||
|
||||
// Styles
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml');
|
||||
|
||||
// Rels
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml'
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml');
|
||||
|
||||
// XML
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'xml', 'application/xml'
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, 'xml', 'application/xml');
|
||||
|
||||
// VML
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing');
|
||||
|
||||
// Workbook
|
||||
if($pPHPExcel->hasMacros()){ //Macros in workbook ?
|
||||
if ($pPHPExcel->hasMacros()) { //Macros in workbook ?
|
||||
// Yes : not standard content but "macroEnabled"
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml');
|
||||
//... and define a new type for the VBA project
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'bin', 'application/vnd.ms-office.vbaProject'
|
||||
);
|
||||
if($pPHPExcel->hasMacrosCertificate()){// signed macros ?
|
||||
$this->_writeDefaultContentType($objWriter, 'bin', 'application/vnd.ms-office.vbaProject');
|
||||
if ($pPHPExcel->hasMacrosCertificate()) {// signed macros ?
|
||||
// Yes : add needed information
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature');
|
||||
}
|
||||
}else{// no macros in workbook, so standard type
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'
|
||||
);
|
||||
} else {// no macros in workbook, so standard type
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml');
|
||||
}
|
||||
|
||||
// DocProps
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml');
|
||||
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml');
|
||||
|
||||
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
|
||||
if (!empty($customPropertyList)) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml');
|
||||
}
|
||||
|
||||
// Worksheets
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml');
|
||||
}
|
||||
|
||||
// Shared strings
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml');
|
||||
|
||||
// Add worksheet relationship content types
|
||||
$chart = 1;
|
||||
@ -145,17 +117,13 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
|
||||
// We need a drawing relationship for the worksheet if we have either drawings or charts
|
||||
if (($drawingCount > 0) || ($chartCount > 0)) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml');
|
||||
}
|
||||
|
||||
// If we have charts, then we need a chart relationship for every individual chart
|
||||
if ($chartCount > 0) {
|
||||
for ($c = 0; $c < $chartCount; ++$c) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,9 +131,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
// Comments
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
if (count($pPHPExcel->getSheet($i)->getComments()) > 0) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml'
|
||||
);
|
||||
$this->_writeOverrideContentType($objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml');
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,33 +154,27 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
}
|
||||
|
||||
if (!isset( $aMediaContentTypes[$extension]) ) {
|
||||
$aMediaContentTypes[$extension] = $mimeType;
|
||||
$aMediaContentTypes[$extension] = $mimeType;
|
||||
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, $extension, $mimeType
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, $extension, $mimeType);
|
||||
}
|
||||
}
|
||||
if($pPHPExcel->hasRibbonBinObjects()){//Some additional objects in the ribbon ?
|
||||
if ($pPHPExcel->hasRibbonBinObjects()) {//Some additional objects in the ribbon ?
|
||||
//we need to write "Extension" but not already write for media content
|
||||
$tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes));
|
||||
foreach($tabRibbonTypes as $aRibbonType){
|
||||
foreach ($tabRibbonTypes as $aRibbonType) {
|
||||
$mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, $aRibbonType, $mimeType
|
||||
);
|
||||
}
|
||||
$this->_writeDefaultContentType($objWriter, $aRibbonType, $mimeType);
|
||||
}
|
||||
}
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) {
|
||||
foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) {
|
||||
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())]) ) {
|
||||
$aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType( $image->getPath() );
|
||||
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())])) {
|
||||
$aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType($image->getPath());
|
||||
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -256,8 +216,8 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
if ($pPartname != '' && $pContentType != '') {
|
||||
// Write content type
|
||||
$objWriter->startElement('Default');
|
||||
$objWriter->writeAttribute('Extension', $pPartname);
|
||||
$objWriter->writeAttribute('ContentType', $pContentType);
|
||||
$objWriter->writeAttribute('Extension', $pPartname);
|
||||
$objWriter->writeAttribute('ContentType', $pContentType);
|
||||
$objWriter->endElement();
|
||||
} else {
|
||||
throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
|
||||
@ -277,8 +237,8 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
if ($pPartname != '' && $pContentType != '') {
|
||||
// Write content type
|
||||
$objWriter->startElement('Override');
|
||||
$objWriter->writeAttribute('PartName', $pPartname);
|
||||
$objWriter->writeAttribute('ContentType', $pContentType);
|
||||
$objWriter->writeAttribute('PartName', $pPartname);
|
||||
$objWriter->writeAttribute('ContentType', $pContentType);
|
||||
$objWriter->endElement();
|
||||
} else {
|
||||
throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
|
||||
|
@ -35,7 +35,7 @@
|
||||
*/
|
||||
class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_WriterPart
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* Write docProps/app.xml to XML format
|
||||
*
|
||||
* @param PHPExcel $pPHPExcel
|
||||
@ -53,78 +53,78 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Properties
|
||||
$objWriter->startElement('Properties');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
|
||||
$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
|
||||
$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
||||
|
||||
// Application
|
||||
$objWriter->writeElement('Application', 'Microsoft Excel');
|
||||
// Application
|
||||
$objWriter->writeElement('Application', 'Microsoft Excel');
|
||||
|
||||
// DocSecurity
|
||||
$objWriter->writeElement('DocSecurity', '0');
|
||||
// DocSecurity
|
||||
$objWriter->writeElement('DocSecurity', '0');
|
||||
|
||||
// ScaleCrop
|
||||
$objWriter->writeElement('ScaleCrop', 'false');
|
||||
// ScaleCrop
|
||||
$objWriter->writeElement('ScaleCrop', 'false');
|
||||
|
||||
// HeadingPairs
|
||||
$objWriter->startElement('HeadingPairs');
|
||||
// HeadingPairs
|
||||
$objWriter->startElement('HeadingPairs');
|
||||
|
||||
// Vector
|
||||
$objWriter->startElement('vt:vector');
|
||||
$objWriter->writeAttribute('size', '2');
|
||||
$objWriter->writeAttribute('baseType', 'variant');
|
||||
// Vector
|
||||
$objWriter->startElement('vt:vector');
|
||||
$objWriter->writeAttribute('size', '2');
|
||||
$objWriter->writeAttribute('baseType', 'variant');
|
||||
|
||||
// Variant
|
||||
$objWriter->startElement('vt:variant');
|
||||
$objWriter->writeElement('vt:lpstr', 'Worksheets');
|
||||
$objWriter->endElement();
|
||||
// Variant
|
||||
$objWriter->startElement('vt:variant');
|
||||
$objWriter->writeElement('vt:lpstr', 'Worksheets');
|
||||
$objWriter->endElement();
|
||||
|
||||
// Variant
|
||||
$objWriter->startElement('vt:variant');
|
||||
$objWriter->writeElement('vt:i4', $pPHPExcel->getSheetCount());
|
||||
$objWriter->endElement();
|
||||
// Variant
|
||||
$objWriter->startElement('vt:variant');
|
||||
$objWriter->writeElement('vt:i4', $pPHPExcel->getSheetCount());
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// TitlesOfParts
|
||||
$objWriter->startElement('TitlesOfParts');
|
||||
// TitlesOfParts
|
||||
$objWriter->startElement('TitlesOfParts');
|
||||
|
||||
// Vector
|
||||
$objWriter->startElement('vt:vector');
|
||||
$objWriter->writeAttribute('size', $pPHPExcel->getSheetCount());
|
||||
$objWriter->writeAttribute('baseType', 'lpstr');
|
||||
// Vector
|
||||
$objWriter->startElement('vt:vector');
|
||||
$objWriter->writeAttribute('size', $pPHPExcel->getSheetCount());
|
||||
$objWriter->writeAttribute('baseType', 'lpstr');
|
||||
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
$objWriter->writeElement('vt:lpstr', $pPHPExcel->getSheet($i)->getTitle());
|
||||
}
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
$objWriter->writeElement('vt:lpstr', $pPHPExcel->getSheet($i)->getTitle());
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// Company
|
||||
$objWriter->writeElement('Company', $pPHPExcel->getProperties()->getCompany());
|
||||
// Company
|
||||
$objWriter->writeElement('Company', $pPHPExcel->getProperties()->getCompany());
|
||||
|
||||
// Company
|
||||
$objWriter->writeElement('Manager', $pPHPExcel->getProperties()->getManager());
|
||||
// Company
|
||||
$objWriter->writeElement('Manager', $pPHPExcel->getProperties()->getManager());
|
||||
|
||||
// LinksUpToDate
|
||||
$objWriter->writeElement('LinksUpToDate', 'false');
|
||||
// LinksUpToDate
|
||||
$objWriter->writeElement('LinksUpToDate', 'false');
|
||||
|
||||
// SharedDoc
|
||||
$objWriter->writeElement('SharedDoc', 'false');
|
||||
// SharedDoc
|
||||
$objWriter->writeElement('SharedDoc', 'false');
|
||||
|
||||
// HyperlinksChanged
|
||||
$objWriter->writeElement('HyperlinksChanged', 'false');
|
||||
// HyperlinksChanged
|
||||
$objWriter->writeElement('HyperlinksChanged', 'false');
|
||||
|
||||
// AppVersion
|
||||
$objWriter->writeElement('AppVersion', '12.0000');
|
||||
// AppVersion
|
||||
$objWriter->writeElement('AppVersion', '12.0000');
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -150,48 +150,48 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// cp:coreProperties
|
||||
$objWriter->startElement('cp:coreProperties');
|
||||
$objWriter->writeAttribute('xmlns:cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties');
|
||||
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
|
||||
$objWriter->writeAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/');
|
||||
$objWriter->writeAttribute('xmlns:dcmitype', 'http://purl.org/dc/dcmitype/');
|
||||
$objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
||||
$objWriter->writeAttribute('xmlns:cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties');
|
||||
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
|
||||
$objWriter->writeAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/');
|
||||
$objWriter->writeAttribute('xmlns:dcmitype', 'http://purl.org/dc/dcmitype/');
|
||||
$objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
||||
|
||||
// dc:creator
|
||||
$objWriter->writeElement('dc:creator', $pPHPExcel->getProperties()->getCreator());
|
||||
// dc:creator
|
||||
$objWriter->writeElement('dc:creator', $pPHPExcel->getProperties()->getCreator());
|
||||
|
||||
// cp:lastModifiedBy
|
||||
$objWriter->writeElement('cp:lastModifiedBy', $pPHPExcel->getProperties()->getLastModifiedBy());
|
||||
// cp:lastModifiedBy
|
||||
$objWriter->writeElement('cp:lastModifiedBy', $pPHPExcel->getProperties()->getLastModifiedBy());
|
||||
|
||||
// dcterms:created
|
||||
$objWriter->startElement('dcterms:created');
|
||||
$objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getCreated()));
|
||||
$objWriter->endElement();
|
||||
// dcterms:created
|
||||
$objWriter->startElement('dcterms:created');
|
||||
$objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getCreated()));
|
||||
$objWriter->endElement();
|
||||
|
||||
// dcterms:modified
|
||||
$objWriter->startElement('dcterms:modified');
|
||||
$objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getModified()));
|
||||
$objWriter->endElement();
|
||||
// dcterms:modified
|
||||
$objWriter->startElement('dcterms:modified');
|
||||
$objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getModified()));
|
||||
$objWriter->endElement();
|
||||
|
||||
// dc:title
|
||||
$objWriter->writeElement('dc:title', $pPHPExcel->getProperties()->getTitle());
|
||||
// dc:title
|
||||
$objWriter->writeElement('dc:title', $pPHPExcel->getProperties()->getTitle());
|
||||
|
||||
// dc:description
|
||||
$objWriter->writeElement('dc:description', $pPHPExcel->getProperties()->getDescription());
|
||||
// dc:description
|
||||
$objWriter->writeElement('dc:description', $pPHPExcel->getProperties()->getDescription());
|
||||
|
||||
// dc:subject
|
||||
$objWriter->writeElement('dc:subject', $pPHPExcel->getProperties()->getSubject());
|
||||
// dc:subject
|
||||
$objWriter->writeElement('dc:subject', $pPHPExcel->getProperties()->getSubject());
|
||||
|
||||
// cp:keywords
|
||||
$objWriter->writeElement('cp:keywords', $pPHPExcel->getProperties()->getKeywords());
|
||||
// cp:keywords
|
||||
$objWriter->writeElement('cp:keywords', $pPHPExcel->getProperties()->getKeywords());
|
||||
|
||||
// cp:category
|
||||
$objWriter->writeElement('cp:category', $pPHPExcel->getProperties()->getCategory());
|
||||
// cp:category
|
||||
$objWriter->writeElement('cp:category', $pPHPExcel->getProperties()->getCategory());
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -222,51 +222,50 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// cp:coreProperties
|
||||
$objWriter->startElement('Properties');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties');
|
||||
$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties');
|
||||
$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
||||
|
||||
|
||||
foreach($customPropertyList as $key => $customProperty) {
|
||||
$propertyValue = $pPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
|
||||
$propertyType = $pPHPExcel->getProperties()->getCustomPropertyType($customProperty);
|
||||
foreach ($customPropertyList as $key => $customProperty) {
|
||||
$propertyValue = $pPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
|
||||
$propertyType = $pPHPExcel->getProperties()->getCustomPropertyType($customProperty);
|
||||
|
||||
$objWriter->startElement('property');
|
||||
$objWriter->writeAttribute('fmtid', '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}');
|
||||
$objWriter->writeAttribute('pid', $key+2);
|
||||
$objWriter->writeAttribute('name', $customProperty);
|
||||
$objWriter->startElement('property');
|
||||
$objWriter->writeAttribute('fmtid', '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}');
|
||||
$objWriter->writeAttribute('pid', $key+2);
|
||||
$objWriter->writeAttribute('name', $customProperty);
|
||||
|
||||
switch($propertyType) {
|
||||
case 'i' :
|
||||
$objWriter->writeElement('vt:i4', $propertyValue);
|
||||
break;
|
||||
case 'f' :
|
||||
$objWriter->writeElement('vt:r8', $propertyValue);
|
||||
break;
|
||||
case 'b' :
|
||||
$objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false');
|
||||
break;
|
||||
case 'd' :
|
||||
$objWriter->startElement('vt:filetime');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $propertyValue));
|
||||
$objWriter->endElement();
|
||||
break;
|
||||
default :
|
||||
$objWriter->writeElement('vt:lpwstr', $propertyValue);
|
||||
break;
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
switch ($propertyType) {
|
||||
case 'i' :
|
||||
$objWriter->writeElement('vt:i4', $propertyValue);
|
||||
break;
|
||||
case 'f' :
|
||||
$objWriter->writeElement('vt:r8', $propertyValue);
|
||||
break;
|
||||
case 'b' :
|
||||
$objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false');
|
||||
break;
|
||||
case 'd' :
|
||||
$objWriter->startElement('vt:filetime');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $propertyValue));
|
||||
$objWriter->endElement();
|
||||
break;
|
||||
default :
|
||||
$objWriter->writeElement('vt:lpwstr', $propertyValue);
|
||||
break;
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
// Return
|
||||
return $objWriter->getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// xdr:wsDr
|
||||
$objWriter->startElement('xdr:wsDr');
|
||||
@ -397,7 +397,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Header/footer images
|
||||
$images = $pWorksheet->getHeaderFooter()->getImages();
|
||||
|
@ -53,56 +53,56 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
||||
|
||||
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
|
||||
if (!empty($customPropertyList)) {
|
||||
// Relationship docProps/app.xml
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
4,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties',
|
||||
'docProps/custom.xml'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
|
||||
if (!empty($customPropertyList)) {
|
||||
// Relationship docProps/app.xml
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
3,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
|
||||
'docProps/app.xml'
|
||||
4,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties',
|
||||
'docProps/custom.xml'
|
||||
);
|
||||
|
||||
// Relationship docProps/core.xml
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
2,
|
||||
'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
|
||||
'docProps/core.xml'
|
||||
);
|
||||
}
|
||||
|
||||
// Relationship xl/workbook.xml
|
||||
$this->_writeRelationship(
|
||||
// Relationship docProps/app.xml
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
3,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
|
||||
'docProps/app.xml'
|
||||
);
|
||||
|
||||
// Relationship docProps/core.xml
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
2,
|
||||
'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
|
||||
'docProps/core.xml'
|
||||
);
|
||||
|
||||
// Relationship xl/workbook.xml
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
1,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
|
||||
'xl/workbook.xml'
|
||||
);
|
||||
// a custom UI in workbook ?
|
||||
if ($pPHPExcel->hasRibbon()) {
|
||||
$this->_writeRelationShip(
|
||||
$objWriter,
|
||||
1,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
|
||||
'xl/workbook.xml'
|
||||
5,
|
||||
'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility',
|
||||
$pPHPExcel->getRibbonXMLData('target')
|
||||
);
|
||||
// a custom UI in workbook ?
|
||||
if($pPHPExcel->hasRibbon()){
|
||||
$this->_writeRelationShip(
|
||||
$objWriter,
|
||||
5,
|
||||
'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility',
|
||||
$pPHPExcel->getRibbonXMLData('target')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -128,57 +128,57 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
||||
|
||||
// Relationship styles.xml
|
||||
// Relationship styles.xml
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
1,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
|
||||
'styles.xml'
|
||||
);
|
||||
|
||||
// Relationship theme/theme1.xml
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
2,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
|
||||
'theme/theme1.xml'
|
||||
);
|
||||
|
||||
// Relationship sharedStrings.xml
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
3,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
|
||||
'sharedStrings.xml'
|
||||
);
|
||||
|
||||
// Relationships with sheets
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
1,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
|
||||
'styles.xml'
|
||||
($i + 1 + 3),
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
|
||||
'worksheets/sheet' . ($i + 1) . '.xml'
|
||||
);
|
||||
|
||||
// Relationship theme/theme1.xml
|
||||
$this->_writeRelationship(
|
||||
}
|
||||
// Relationships for vbaProject if needed
|
||||
// id : just after the last sheet
|
||||
if ($pPHPExcel->hasMacros()) {
|
||||
$this->_writeRelationShip(
|
||||
$objWriter,
|
||||
2,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
|
||||
'theme/theme1.xml'
|
||||
($i + 1 + 3),
|
||||
'http://schemas.microsoft.com/office/2006/relationships/vbaProject',
|
||||
'vbaProject.bin'
|
||||
);
|
||||
|
||||
// Relationship sharedStrings.xml
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
3,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
|
||||
'sharedStrings.xml'
|
||||
);
|
||||
|
||||
// Relationships with sheets
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
($i + 1 + 3),
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
|
||||
'worksheets/sheet' . ($i + 1) . '.xml'
|
||||
);
|
||||
}
|
||||
// Relationships for vbaProject if needed
|
||||
// id : just after the last sheet
|
||||
if($pPHPExcel->hasMacros()){
|
||||
$this->_writeRelationShip(
|
||||
$objWriter,
|
||||
($i + 1 + 3),
|
||||
'http://schemas.microsoft.com/office/2006/relationships/vbaProject',
|
||||
'vbaProject.bin'
|
||||
);
|
||||
++$i;//increment i if needed for an another relation
|
||||
}
|
||||
++$i;//increment i if needed for an another relation
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -199,7 +199,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = FALSE)
|
||||
public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = false)
|
||||
{
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
@ -210,35 +210,35 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
||||
|
||||
// Write drawing relationships?
|
||||
$d = 0;
|
||||
if ($includeCharts) {
|
||||
$charts = $pWorksheet->getChartCollection();
|
||||
} else {
|
||||
$charts = array();
|
||||
}
|
||||
if (($pWorksheet->getDrawingCollection()->count() > 0) ||
|
||||
(count($charts) > 0)) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
++$d,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',
|
||||
'../drawings/drawing' . $pWorksheetId . '.xml'
|
||||
);
|
||||
}
|
||||
// Write drawing relationships?
|
||||
$d = 0;
|
||||
if ($includeCharts) {
|
||||
$charts = $pWorksheet->getChartCollection();
|
||||
} else {
|
||||
$charts = array();
|
||||
}
|
||||
if (($pWorksheet->getDrawingCollection()->count() > 0) ||
|
||||
(count($charts) > 0)) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
++$d,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',
|
||||
'../drawings/drawing' . $pWorksheetId . '.xml'
|
||||
);
|
||||
}
|
||||
|
||||
// Write chart relationships?
|
||||
// Write chart relationships?
|
||||
// $chartCount = 0;
|
||||
// $charts = $pWorksheet->getChartCollection();
|
||||
// echo 'Chart Rels: ' , count($charts) , '<br />';
|
||||
// if (count($charts) > 0) {
|
||||
// foreach($charts as $chart) {
|
||||
// foreach ($charts as $chart) {
|
||||
// $this->_writeRelationship(
|
||||
// $objWriter,
|
||||
// ++$d,
|
||||
@ -248,50 +248,50 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Write hyperlink relationships?
|
||||
$i = 1;
|
||||
foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) {
|
||||
if (!$hyperlink->isInternal()) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
'_hyperlink_' . $i,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
|
||||
$hyperlink->getUrl(),
|
||||
'External'
|
||||
);
|
||||
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
|
||||
// Write comments relationship?
|
||||
$i = 1;
|
||||
if (count($pWorksheet->getComments()) > 0) {
|
||||
// Write hyperlink relationships?
|
||||
$i = 1;
|
||||
foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) {
|
||||
if (!$hyperlink->isInternal()) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
'_comments_vml' . $i,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
|
||||
'../drawings/vmlDrawing' . $pWorksheetId . '.vml'
|
||||
'_hyperlink_' . $i,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
|
||||
$hyperlink->getUrl(),
|
||||
'External'
|
||||
);
|
||||
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
'_comments' . $i,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
|
||||
'../comments' . $pWorksheetId . '.xml'
|
||||
);
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
|
||||
// Write header/footer relationship?
|
||||
$i = 1;
|
||||
if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
'_headerfooter_vml' . $i,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
|
||||
'../drawings/vmlDrawingHF' . $pWorksheetId . '.vml'
|
||||
);
|
||||
}
|
||||
// Write comments relationship?
|
||||
$i = 1;
|
||||
if (count($pWorksheet->getComments()) > 0) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
'_comments_vml' . $i,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
|
||||
'../drawings/vmlDrawing' . $pWorksheetId . '.vml'
|
||||
);
|
||||
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
'_comments' . $i,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
|
||||
'../comments' . $pWorksheetId . '.xml'
|
||||
);
|
||||
}
|
||||
|
||||
// Write header/footer relationship?
|
||||
$i = 1;
|
||||
if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
'_headerfooter_vml' . $i,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
|
||||
'../drawings/vmlDrawingHF' . $pWorksheetId . '.vml'
|
||||
);
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -308,7 +308,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE)
|
||||
public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false)
|
||||
{
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
@ -319,45 +319,45 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
||||
|
||||
// Loop through images and write relationships
|
||||
$i = 1;
|
||||
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
|
||||
while ($iterator->valid()) {
|
||||
if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing
|
||||
|| $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) {
|
||||
// Write relationship for image drawing
|
||||
// Loop through images and write relationships
|
||||
$i = 1;
|
||||
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
|
||||
while ($iterator->valid()) {
|
||||
if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing
|
||||
|| $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) {
|
||||
// Write relationship for image drawing
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
$i,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
|
||||
'../media/' . str_replace(' ', '', $iterator->current()->getIndexedFilename())
|
||||
);
|
||||
}
|
||||
|
||||
$iterator->next();
|
||||
++$i;
|
||||
}
|
||||
|
||||
if ($includeCharts) {
|
||||
// Loop through charts and write relationships
|
||||
$chartCount = $pWorksheet->getChartCount();
|
||||
if ($chartCount > 0) {
|
||||
for ($c = 0; $c < $chartCount; ++$c) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
$i,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
|
||||
'../media/' . str_replace(' ', '', $iterator->current()->getIndexedFilename())
|
||||
$i++,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
|
||||
'../charts/chart' . ++$chartRef . '.xml'
|
||||
);
|
||||
}
|
||||
|
||||
$iterator->next();
|
||||
++$i;
|
||||
}
|
||||
|
||||
if ($includeCharts) {
|
||||
// Loop through charts and write relationships
|
||||
$chartCount = $pWorksheet->getChartCount();
|
||||
if ($chartCount > 0) {
|
||||
for ($c = 0; $c < $chartCount; ++$c) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
$i++,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
|
||||
'../charts/chart' . ++$chartRef . '.xml'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -383,22 +383,22 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
||||
|
||||
// Loop through images and write relationships
|
||||
foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) {
|
||||
// Write relationship for image drawing
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
$key,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
|
||||
'../media/' . $value->getIndexedFilename()
|
||||
);
|
||||
}
|
||||
// Loop through images and write relationships
|
||||
foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) {
|
||||
// Write relationship for image drawing
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
$key,
|
||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
|
||||
'../media/' . $value->getIndexedFilename()
|
||||
);
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -421,12 +421,12 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
||||
if ($pType != '' && $pTarget != '') {
|
||||
// Write relationship
|
||||
$objWriter->startElement('Relationship');
|
||||
$objWriter->writeAttribute('Id', 'rId' . $pId);
|
||||
$objWriter->writeAttribute('Type', $pType);
|
||||
$objWriter->writeAttribute('Target', $pTarget);
|
||||
$objWriter->writeAttribute('Id', 'rId' . $pId);
|
||||
$objWriter->writeAttribute('Type', $pType);
|
||||
$objWriter->writeAttribute('Target', $pTarget);
|
||||
|
||||
if ($pTargetMode != '') {
|
||||
$objWriter->writeAttribute('TargetMode', $pTargetMode);
|
||||
$objWriter->writeAttribute('TargetMode', $pTargetMode);
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
@ -42,7 +42,8 @@ class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_Wri
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeRibbonRelationships(PHPExcel $pPHPExcel = null){
|
||||
public function writeRibbonRelationships(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
if ($this->getParentWriter()->getUseDiskCaching()) {
|
||||
@ -52,14 +53,14 @@ class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_Wri
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
||||
$localRels=$pPHPExcel->getRibbonBinObjects('names');
|
||||
if(is_array($localRels)){
|
||||
foreach($localRels as $aId=>$aTarget){
|
||||
$localRels = $pPHPExcel->getRibbonBinObjects('names');
|
||||
if (is_array($localRels)) {
|
||||
foreach ($localRels as $aId => $aTarget) {
|
||||
$objWriter->startElement('Relationship');
|
||||
$objWriter->writeAttribute('Id', $aId);
|
||||
$objWriter->writeAttribute('Type', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image');
|
||||
@ -71,7 +72,5 @@ class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_Wri
|
||||
|
||||
// Return
|
||||
return $objWriter->getData();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,7 +42,8 @@ class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_Writer
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeVBARelationships(PHPExcel $pPHPExcel = null){
|
||||
public function writeVBARelationships(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
if ($this->getParentWriter()->getUseDiskCaching()) {
|
||||
@ -52,7 +53,7 @@ class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_Writer
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Relationships
|
||||
$objWriter->startElement('Relationships');
|
||||
@ -68,5 +69,4 @@ class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_Writer
|
||||
return $objWriter->getData();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -45,14 +45,14 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
*/
|
||||
public function createStringTable($pSheet = null, $pExistingTable = null)
|
||||
{
|
||||
if ($pSheet !== NULL) {
|
||||
if ($pSheet !== null) {
|
||||
// Create string lookup table
|
||||
$aStringTable = array();
|
||||
$cellCollection = null;
|
||||
$aFlippedStringTable = null; // For faster lookup
|
||||
|
||||
// Is an existing table given?
|
||||
if (($pExistingTable !== NULL) && is_array($pExistingTable)) {
|
||||
if (($pExistingTable !== null) && is_array($pExistingTable)) {
|
||||
$aStringTable = $pExistingTable;
|
||||
}
|
||||
|
||||
@ -64,14 +64,14 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
$cell = $pSheet->getCell($cellID);
|
||||
$cellValue = $cell->getValue();
|
||||
if (!is_object($cellValue) &&
|
||||
($cellValue !== NULL) &&
|
||||
($cellValue !== null) &&
|
||||
$cellValue !== '' &&
|
||||
!isset($aFlippedStringTable[$cellValue]) &&
|
||||
($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL)) {
|
||||
$aStringTable[] = $cellValue;
|
||||
$aFlippedStringTable[$cellValue] = true;
|
||||
} elseif ($cellValue instanceof PHPExcel_RichText &&
|
||||
($cellValue !== NULL) &&
|
||||
($cellValue !== null) &&
|
||||
!isset($aFlippedStringTable[$cellValue->getHashCode()])) {
|
||||
$aStringTable[] = $cellValue;
|
||||
$aFlippedStringTable[$cellValue->getHashCode()] = true;
|
||||
@ -94,7 +94,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
*/
|
||||
public function writeStringTable($pStringTable = null)
|
||||
{
|
||||
if ($pStringTable !== NULL) {
|
||||
if ($pStringTable !== null) {
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
if ($this->getParentWriter()->getUseDiskCaching()) {
|
||||
@ -104,32 +104,32 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// String table
|
||||
$objWriter->startElement('sst');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
||||
$objWriter->writeAttribute('uniqueCount', count($pStringTable));
|
||||
|
||||
// Loop through string table
|
||||
foreach ($pStringTable as $textElement) {
|
||||
$objWriter->startElement('si');
|
||||
|
||||
if (! $textElement instanceof PHPExcel_RichText) {
|
||||
$textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $textElement );
|
||||
$objWriter->startElement('t');
|
||||
if ($textToWrite !== trim($textToWrite)) {
|
||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||
}
|
||||
$objWriter->writeRawData($textToWrite);
|
||||
$objWriter->endElement();
|
||||
} else if ($textElement instanceof PHPExcel_RichText) {
|
||||
$this->writeRichText($objWriter, $textElement);
|
||||
}
|
||||
// Loop through string table
|
||||
foreach ($pStringTable as $textElement) {
|
||||
$objWriter->startElement('si');
|
||||
|
||||
if (! $textElement instanceof PHPExcel_RichText) {
|
||||
$textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML($textElement);
|
||||
$objWriter->startElement('t');
|
||||
if ($textToWrite !== trim($textToWrite)) {
|
||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||
}
|
||||
$objWriter->writeRawData($textToWrite);
|
||||
$objWriter->endElement();
|
||||
} else if ($textElement instanceof PHPExcel_RichText) {
|
||||
$this->writeRichText($objWriter, $textElement);
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
// Return
|
||||
@ -147,76 +147,78 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
* @param string $prefix Optional Namespace prefix
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix=NULL)
|
||||
public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix = null)
|
||||
{
|
||||
if ($prefix !== NULL)
|
||||
if ($prefix !== null) {
|
||||
$prefix .= ':';
|
||||
}
|
||||
|
||||
// Loop through rich text elements
|
||||
$elements = $pRichText->getRichTextElements();
|
||||
foreach ($elements as $element) {
|
||||
// r
|
||||
$objWriter->startElement($prefix.'r');
|
||||
|
||||
// rPr
|
||||
if ($element instanceof PHPExcel_RichText_Run) {
|
||||
// rPr
|
||||
if ($element instanceof PHPExcel_RichText_Run) {
|
||||
// rPr
|
||||
$objWriter->startElement($prefix.'rPr');
|
||||
$objWriter->startElement($prefix.'rPr');
|
||||
|
||||
// rFont
|
||||
$objWriter->startElement($prefix.'rFont');
|
||||
$objWriter->writeAttribute('val', $element->getFont()->getName());
|
||||
$objWriter->endElement();
|
||||
// rFont
|
||||
$objWriter->startElement($prefix.'rFont');
|
||||
$objWriter->writeAttribute('val', $element->getFont()->getName());
|
||||
$objWriter->endElement();
|
||||
|
||||
// Bold
|
||||
$objWriter->startElement($prefix.'b');
|
||||
$objWriter->writeAttribute('val', ($element->getFont()->getBold() ? 'true' : 'false'));
|
||||
$objWriter->endElement();
|
||||
// Bold
|
||||
$objWriter->startElement($prefix.'b');
|
||||
$objWriter->writeAttribute('val', ($element->getFont()->getBold() ? 'true' : 'false'));
|
||||
$objWriter->endElement();
|
||||
|
||||
// Italic
|
||||
$objWriter->startElement($prefix.'i');
|
||||
$objWriter->writeAttribute('val', ($element->getFont()->getItalic() ? 'true' : 'false'));
|
||||
$objWriter->endElement();
|
||||
|
||||
// Superscript / subscript
|
||||
if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
|
||||
$objWriter->startElement($prefix.'vertAlign');
|
||||
if ($element->getFont()->getSuperScript()) {
|
||||
$objWriter->writeAttribute('val', 'superscript');
|
||||
} else if ($element->getFont()->getSubScript()) {
|
||||
$objWriter->writeAttribute('val', 'subscript');
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Strikethrough
|
||||
$objWriter->startElement($prefix.'strike');
|
||||
$objWriter->writeAttribute('val', ($element->getFont()->getStrikethrough() ? 'true' : 'false'));
|
||||
$objWriter->endElement();
|
||||
|
||||
// Color
|
||||
$objWriter->startElement($prefix.'color');
|
||||
$objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
|
||||
// Size
|
||||
$objWriter->startElement($prefix.'sz');
|
||||
$objWriter->writeAttribute('val', $element->getFont()->getSize());
|
||||
$objWriter->endElement();
|
||||
|
||||
// Underline
|
||||
$objWriter->startElement($prefix.'u');
|
||||
$objWriter->writeAttribute('val', $element->getFont()->getUnderline());
|
||||
$objWriter->endElement();
|
||||
// Italic
|
||||
$objWriter->startElement($prefix.'i');
|
||||
$objWriter->writeAttribute('val', ($element->getFont()->getItalic() ? 'true' : 'false'));
|
||||
$objWriter->endElement();
|
||||
|
||||
// Superscript / subscript
|
||||
if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
|
||||
$objWriter->startElement($prefix.'vertAlign');
|
||||
if ($element->getFont()->getSuperScript()) {
|
||||
$objWriter->writeAttribute('val', 'superscript');
|
||||
} else if ($element->getFont()->getSubScript()) {
|
||||
$objWriter->writeAttribute('val', 'subscript');
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// t
|
||||
$objWriter->startElement($prefix.'t');
|
||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() ));
|
||||
// Strikethrough
|
||||
$objWriter->startElement($prefix.'strike');
|
||||
$objWriter->writeAttribute('val', ($element->getFont()->getStrikethrough() ? 'true' : 'false'));
|
||||
$objWriter->endElement();
|
||||
|
||||
// Color
|
||||
$objWriter->startElement($prefix.'color');
|
||||
$objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
|
||||
// Size
|
||||
$objWriter->startElement($prefix.'sz');
|
||||
$objWriter->writeAttribute('val', $element->getFont()->getSize());
|
||||
$objWriter->endElement();
|
||||
|
||||
// Underline
|
||||
$objWriter->startElement($prefix.'u');
|
||||
$objWriter->writeAttribute('val', $element->getFont()->getUnderline());
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// t
|
||||
$objWriter->startElement($prefix.'t');
|
||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($element->getText()));
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
@ -229,7 +231,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
* @param string $prefix Optional Namespace prefix
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix=NULL)
|
||||
public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix = null)
|
||||
{
|
||||
if (!$pRichText instanceof PHPExcel_RichText) {
|
||||
$textRun = $pRichText;
|
||||
@ -237,41 +239,43 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
$pRichText->createTextRun($textRun);
|
||||
}
|
||||
|
||||
if ($prefix !== NULL)
|
||||
if ($prefix !== null) {
|
||||
$prefix .= ':';
|
||||
}
|
||||
|
||||
// Loop through rich text elements
|
||||
$elements = $pRichText->getRichTextElements();
|
||||
foreach ($elements as $element) {
|
||||
// r
|
||||
$objWriter->startElement($prefix.'r');
|
||||
|
||||
// rPr
|
||||
$objWriter->startElement($prefix.'rPr');
|
||||
// rPr
|
||||
$objWriter->startElement($prefix.'rPr');
|
||||
|
||||
// Bold
|
||||
$objWriter->writeAttribute('b', ($element->getFont()->getBold() ? 1 : 0));
|
||||
// Italic
|
||||
$objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? 1 : 0));
|
||||
// Underline
|
||||
$underlineType = $element->getFont()->getUnderline();
|
||||
switch($underlineType) {
|
||||
case 'single' :
|
||||
$underlineType = 'sng';
|
||||
break;
|
||||
case 'double' :
|
||||
$underlineType = 'dbl';
|
||||
break;
|
||||
}
|
||||
$objWriter->writeAttribute('u', $underlineType);
|
||||
// Strikethrough
|
||||
$objWriter->writeAttribute('strike', ($element->getFont()->getStrikethrough() ? 'sngStrike' : 'noStrike'));
|
||||
// Bold
|
||||
$objWriter->writeAttribute('b', ($element->getFont()->getBold() ? 1 : 0));
|
||||
// Italic
|
||||
$objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? 1 : 0));
|
||||
// Underline
|
||||
$underlineType = $element->getFont()->getUnderline();
|
||||
switch ($underlineType) {
|
||||
case 'single' :
|
||||
$underlineType = 'sng';
|
||||
break;
|
||||
case 'double' :
|
||||
$underlineType = 'dbl';
|
||||
break;
|
||||
}
|
||||
$objWriter->writeAttribute('u', $underlineType);
|
||||
// Strikethrough
|
||||
$objWriter->writeAttribute('strike', ($element->getFont()->getStrikethrough() ? 'sngStrike' : 'noStrike'));
|
||||
|
||||
// rFont
|
||||
$objWriter->startElement($prefix.'latin');
|
||||
$objWriter->writeAttribute('typeface', $element->getFont()->getName());
|
||||
$objWriter->endElement();
|
||||
// rFont
|
||||
$objWriter->startElement($prefix.'latin');
|
||||
$objWriter->writeAttribute('typeface', $element->getFont()->getName());
|
||||
$objWriter->endElement();
|
||||
|
||||
// Superscript / subscript
|
||||
// Superscript / subscript
|
||||
// if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
|
||||
// $objWriter->startElement($prefix.'vertAlign');
|
||||
// if ($element->getFont()->getSuperScript()) {
|
||||
@ -282,13 +286,13 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
// $objWriter->endElement();
|
||||
// }
|
||||
//
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// t
|
||||
$objWriter->startElement($prefix.'t');
|
||||
// t
|
||||
$objWriter->startElement($prefix.'t');
|
||||
// $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains
|
||||
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() ));
|
||||
$objWriter->endElement();
|
||||
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($element->getText()));
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
@ -53,111 +53,111 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// styleSheet
|
||||
$objWriter->startElement('styleSheet');
|
||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
||||
|
||||
// numFmts
|
||||
$objWriter->startElement('numFmts');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getNumFmtHashTable()->count());
|
||||
// numFmts
|
||||
$objWriter->startElement('numFmts');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getNumFmtHashTable()->count());
|
||||
|
||||
// numFmt
|
||||
for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) {
|
||||
$this->_writeNumFmt($objWriter, $this->getParentWriter()->getNumFmtHashTable()->getByIndex($i), $i);
|
||||
}
|
||||
// numFmt
|
||||
for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) {
|
||||
$this->_writeNumFmt($objWriter, $this->getParentWriter()->getNumFmtHashTable()->getByIndex($i), $i);
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// fonts
|
||||
$objWriter->startElement('fonts');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getFontHashTable()->count());
|
||||
// fonts
|
||||
$objWriter->startElement('fonts');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getFontHashTable()->count());
|
||||
|
||||
// font
|
||||
for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) {
|
||||
$this->_writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i));
|
||||
}
|
||||
// font
|
||||
for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) {
|
||||
$this->_writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i));
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// fills
|
||||
$objWriter->startElement('fills');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getFillHashTable()->count());
|
||||
// fills
|
||||
$objWriter->startElement('fills');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getFillHashTable()->count());
|
||||
|
||||
// fill
|
||||
for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) {
|
||||
$this->_writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i));
|
||||
}
|
||||
// fill
|
||||
for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) {
|
||||
$this->_writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i));
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// borders
|
||||
$objWriter->startElement('borders');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getBordersHashTable()->count());
|
||||
// borders
|
||||
$objWriter->startElement('borders');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getBordersHashTable()->count());
|
||||
|
||||
// border
|
||||
for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) {
|
||||
$this->_writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i));
|
||||
}
|
||||
// border
|
||||
for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) {
|
||||
$this->_writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i));
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// cellStyleXfs
|
||||
$objWriter->startElement('cellStyleXfs');
|
||||
$objWriter->writeAttribute('count', 1);
|
||||
// cellStyleXfs
|
||||
$objWriter->startElement('cellStyleXfs');
|
||||
$objWriter->writeAttribute('count', 1);
|
||||
|
||||
// xf
|
||||
$objWriter->startElement('xf');
|
||||
$objWriter->writeAttribute('numFmtId', 0);
|
||||
$objWriter->writeAttribute('fontId', 0);
|
||||
$objWriter->writeAttribute('fillId', 0);
|
||||
$objWriter->writeAttribute('borderId', 0);
|
||||
$objWriter->endElement();
|
||||
// xf
|
||||
$objWriter->startElement('xf');
|
||||
$objWriter->writeAttribute('numFmtId', 0);
|
||||
$objWriter->writeAttribute('fontId', 0);
|
||||
$objWriter->writeAttribute('fillId', 0);
|
||||
$objWriter->writeAttribute('borderId', 0);
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// cellXfs
|
||||
$objWriter->startElement('cellXfs');
|
||||
$objWriter->writeAttribute('count', count($pPHPExcel->getCellXfCollection()));
|
||||
// cellXfs
|
||||
$objWriter->startElement('cellXfs');
|
||||
$objWriter->writeAttribute('count', count($pPHPExcel->getCellXfCollection()));
|
||||
|
||||
// xf
|
||||
foreach ($pPHPExcel->getCellXfCollection() as $cellXf) {
|
||||
$this->_writeCellStyleXf($objWriter, $cellXf, $pPHPExcel);
|
||||
}
|
||||
// xf
|
||||
foreach ($pPHPExcel->getCellXfCollection() as $cellXf) {
|
||||
$this->_writeCellStyleXf($objWriter, $cellXf, $pPHPExcel);
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// cellStyles
|
||||
$objWriter->startElement('cellStyles');
|
||||
$objWriter->writeAttribute('count', 1);
|
||||
// cellStyles
|
||||
$objWriter->startElement('cellStyles');
|
||||
$objWriter->writeAttribute('count', 1);
|
||||
|
||||
// cellStyle
|
||||
$objWriter->startElement('cellStyle');
|
||||
$objWriter->writeAttribute('name', 'Normal');
|
||||
$objWriter->writeAttribute('xfId', 0);
|
||||
$objWriter->writeAttribute('builtinId', 0);
|
||||
$objWriter->endElement();
|
||||
// cellStyle
|
||||
$objWriter->startElement('cellStyle');
|
||||
$objWriter->writeAttribute('name', 'Normal');
|
||||
$objWriter->writeAttribute('xfId', 0);
|
||||
$objWriter->writeAttribute('builtinId', 0);
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// dxfs
|
||||
$objWriter->startElement('dxfs');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getStylesConditionalHashTable()->count());
|
||||
// dxfs
|
||||
$objWriter->startElement('dxfs');
|
||||
$objWriter->writeAttribute('count', $this->getParentWriter()->getStylesConditionalHashTable()->count());
|
||||
|
||||
// dxf
|
||||
for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) {
|
||||
$this->_writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle());
|
||||
}
|
||||
// dxf
|
||||
for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) {
|
||||
$this->_writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle());
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// tableStyles
|
||||
$objWriter->startElement('tableStyles');
|
||||
$objWriter->writeAttribute('defaultTableStyle', 'TableStyleMedium9');
|
||||
$objWriter->writeAttribute('defaultPivotStyle', 'PivotTableStyle1');
|
||||
$objWriter->endElement();
|
||||
// tableStyles
|
||||
$objWriter->startElement('tableStyles');
|
||||
$objWriter->writeAttribute('defaultTableStyle', 'TableStyleMedium9');
|
||||
$objWriter->writeAttribute('defaultPivotStyle', 'PivotTableStyle1');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -179,7 +179,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) {
|
||||
// Gradient fill
|
||||
$this->_writeGradientFill($objWriter, $pFill);
|
||||
} elseif($pFill->getFillType() !== NULL) {
|
||||
} elseif ($pFill->getFillType() !== null) {
|
||||
// Pattern fill
|
||||
$this->_writePatternFill($objWriter, $pFill);
|
||||
}
|
||||
@ -197,34 +197,34 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
// fill
|
||||
$objWriter->startElement('fill');
|
||||
|
||||
// gradientFill
|
||||
$objWriter->startElement('gradientFill');
|
||||
$objWriter->writeAttribute('type', $pFill->getFillType());
|
||||
$objWriter->writeAttribute('degree', $pFill->getRotation());
|
||||
// gradientFill
|
||||
$objWriter->startElement('gradientFill');
|
||||
$objWriter->writeAttribute('type', $pFill->getFillType());
|
||||
$objWriter->writeAttribute('degree', $pFill->getRotation());
|
||||
|
||||
// stop
|
||||
$objWriter->startElement('stop');
|
||||
$objWriter->writeAttribute('position', '0');
|
||||
// stop
|
||||
$objWriter->startElement('stop');
|
||||
$objWriter->writeAttribute('position', '0');
|
||||
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// stop
|
||||
$objWriter->startElement('stop');
|
||||
$objWriter->writeAttribute('position', '1');
|
||||
// stop
|
||||
$objWriter->startElement('stop');
|
||||
$objWriter->writeAttribute('position', '1');
|
||||
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -241,28 +241,28 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
// fill
|
||||
$objWriter->startElement('fill');
|
||||
|
||||
// patternFill
|
||||
$objWriter->startElement('patternFill');
|
||||
$objWriter->writeAttribute('patternType', $pFill->getFillType());
|
||||
// patternFill
|
||||
$objWriter->startElement('patternFill');
|
||||
$objWriter->writeAttribute('patternType', $pFill->getFillType());
|
||||
|
||||
if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
|
||||
// fgColor
|
||||
if ($pFill->getStartColor()->getARGB()) {
|
||||
$objWriter->startElement('fgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
|
||||
// bgColor
|
||||
if ($pFill->getEndColor()->getARGB()) {
|
||||
$objWriter->startElement('bgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
|
||||
// fgColor
|
||||
if ($pFill->getStartColor()->getARGB()) {
|
||||
$objWriter->startElement('fgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
|
||||
// bgColor
|
||||
if ($pFill->getEndColor()->getARGB()) {
|
||||
$objWriter->startElement('bgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -278,71 +278,71 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
{
|
||||
// font
|
||||
$objWriter->startElement('font');
|
||||
// Weird! The order of these elements actually makes a difference when opening Excel2007
|
||||
// files in Excel2003 with the compatibility pack. It's not documented behaviour,
|
||||
// and makes for a real WTF!
|
||||
// Weird! The order of these elements actually makes a difference when opening Excel2007
|
||||
// files in Excel2003 with the compatibility pack. It's not documented behaviour,
|
||||
// and makes for a real WTF!
|
||||
|
||||
// Bold. We explicitly write this element also when false (like MS Office Excel 2007 does
|
||||
// for conditional formatting). Otherwise it will apparently not be picked up in conditional
|
||||
// formatting style dialog
|
||||
if ($pFont->getBold() !== NULL) {
|
||||
$objWriter->startElement('b');
|
||||
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Bold. We explicitly write this element also when false (like MS Office Excel 2007 does
|
||||
// for conditional formatting). Otherwise it will apparently not be picked up in conditional
|
||||
// formatting style dialog
|
||||
if ($pFont->getBold() !== null) {
|
||||
$objWriter->startElement('b');
|
||||
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Italic
|
||||
if ($pFont->getItalic() !== NULL) {
|
||||
$objWriter->startElement('i');
|
||||
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Italic
|
||||
if ($pFont->getItalic() !== null) {
|
||||
$objWriter->startElement('i');
|
||||
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Strikethrough
|
||||
if ($pFont->getStrikethrough() !== NULL) {
|
||||
$objWriter->startElement('strike');
|
||||
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Strikethrough
|
||||
if ($pFont->getStrikethrough() !== null) {
|
||||
$objWriter->startElement('strike');
|
||||
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Underline
|
||||
if ($pFont->getUnderline() !== NULL) {
|
||||
$objWriter->startElement('u');
|
||||
$objWriter->writeAttribute('val', $pFont->getUnderline());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Underline
|
||||
if ($pFont->getUnderline() !== null) {
|
||||
$objWriter->startElement('u');
|
||||
$objWriter->writeAttribute('val', $pFont->getUnderline());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Superscript / subscript
|
||||
if ($pFont->getSuperScript() === TRUE || $pFont->getSubScript() === TRUE) {
|
||||
$objWriter->startElement('vertAlign');
|
||||
if ($pFont->getSuperScript() === TRUE) {
|
||||
$objWriter->writeAttribute('val', 'superscript');
|
||||
} else if ($pFont->getSubScript() === TRUE) {
|
||||
$objWriter->writeAttribute('val', 'subscript');
|
||||
}
|
||||
$objWriter->endElement();
|
||||
// Superscript / subscript
|
||||
if ($pFont->getSuperScript() === true || $pFont->getSubScript() === true) {
|
||||
$objWriter->startElement('vertAlign');
|
||||
if ($pFont->getSuperScript() === true) {
|
||||
$objWriter->writeAttribute('val', 'superscript');
|
||||
} else if ($pFont->getSubScript() === true) {
|
||||
$objWriter->writeAttribute('val', 'subscript');
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Size
|
||||
if ($pFont->getSize() !== NULL) {
|
||||
$objWriter->startElement('sz');
|
||||
$objWriter->writeAttribute('val', $pFont->getSize());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Size
|
||||
if ($pFont->getSize() !== null) {
|
||||
$objWriter->startElement('sz');
|
||||
$objWriter->writeAttribute('val', $pFont->getSize());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Foreground color
|
||||
if ($pFont->getColor()->getARGB() !== NULL) {
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Foreground color
|
||||
if ($pFont->getColor()->getARGB() !== null) {
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Name
|
||||
if ($pFont->getName() !== NULL) {
|
||||
$objWriter->startElement('name');
|
||||
$objWriter->writeAttribute('val', $pFont->getName());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Name
|
||||
if ($pFont->getName() !== null) {
|
||||
$objWriter->startElement('name');
|
||||
$objWriter->writeAttribute('val', $pFont->getName());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -358,28 +358,28 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
{
|
||||
// Write border
|
||||
$objWriter->startElement('border');
|
||||
// Diagonal?
|
||||
switch ($pBorders->getDiagonalDirection()) {
|
||||
case PHPExcel_Style_Borders::DIAGONAL_UP:
|
||||
$objWriter->writeAttribute('diagonalUp', 'true');
|
||||
$objWriter->writeAttribute('diagonalDown', 'false');
|
||||
break;
|
||||
case PHPExcel_Style_Borders::DIAGONAL_DOWN:
|
||||
$objWriter->writeAttribute('diagonalUp', 'false');
|
||||
$objWriter->writeAttribute('diagonalDown', 'true');
|
||||
break;
|
||||
case PHPExcel_Style_Borders::DIAGONAL_BOTH:
|
||||
$objWriter->writeAttribute('diagonalUp', 'true');
|
||||
$objWriter->writeAttribute('diagonalDown', 'true');
|
||||
break;
|
||||
}
|
||||
// Diagonal?
|
||||
switch ($pBorders->getDiagonalDirection()) {
|
||||
case PHPExcel_Style_Borders::DIAGONAL_UP:
|
||||
$objWriter->writeAttribute('diagonalUp', 'true');
|
||||
$objWriter->writeAttribute('diagonalDown', 'false');
|
||||
break;
|
||||
case PHPExcel_Style_Borders::DIAGONAL_DOWN:
|
||||
$objWriter->writeAttribute('diagonalUp', 'false');
|
||||
$objWriter->writeAttribute('diagonalDown', 'true');
|
||||
break;
|
||||
case PHPExcel_Style_Borders::DIAGONAL_BOTH:
|
||||
$objWriter->writeAttribute('diagonalUp', 'true');
|
||||
$objWriter->writeAttribute('diagonalDown', 'true');
|
||||
break;
|
||||
}
|
||||
|
||||
// BorderPr
|
||||
$this->_writeBorderPr($objWriter, 'left', $pBorders->getLeft());
|
||||
$this->_writeBorderPr($objWriter, 'right', $pBorders->getRight());
|
||||
$this->_writeBorderPr($objWriter, 'top', $pBorders->getTop());
|
||||
$this->_writeBorderPr($objWriter, 'bottom', $pBorders->getBottom());
|
||||
$this->_writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal());
|
||||
// BorderPr
|
||||
$this->_writeBorderPr($objWriter, 'left', $pBorders->getLeft());
|
||||
$this->_writeBorderPr($objWriter, 'right', $pBorders->getRight());
|
||||
$this->_writeBorderPr($objWriter, 'top', $pBorders->getTop());
|
||||
$this->_writeBorderPr($objWriter, 'bottom', $pBorders->getBottom());
|
||||
$this->_writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
@ -395,66 +395,66 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
{
|
||||
// xf
|
||||
$objWriter->startElement('xf');
|
||||
$objWriter->writeAttribute('xfId', 0);
|
||||
$objWriter->writeAttribute('fontId', (int)$this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode()));
|
||||
if ($pStyle->getQuotePrefix()) {
|
||||
$objWriter->writeAttribute('quotePrefix', 1);
|
||||
$objWriter->writeAttribute('xfId', 0);
|
||||
$objWriter->writeAttribute('fontId', (int)$this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode()));
|
||||
if ($pStyle->getQuotePrefix()) {
|
||||
$objWriter->writeAttribute('quotePrefix', 1);
|
||||
}
|
||||
|
||||
if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) {
|
||||
$objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164));
|
||||
} else {
|
||||
$objWriter->writeAttribute('numFmtId', (int)$pStyle->getNumberFormat()->getBuiltInFormatCode());
|
||||
}
|
||||
|
||||
$objWriter->writeAttribute('fillId', (int)$this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode()));
|
||||
$objWriter->writeAttribute('borderId', (int)$this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode()));
|
||||
|
||||
// Apply styles?
|
||||
$objWriter->writeAttribute('applyFont', ($pPHPExcel->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyNumberFormat', ($pPHPExcel->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyFill', ($pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyBorder', ($pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyAlignment', ($pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0');
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('applyProtection', 'true');
|
||||
}
|
||||
|
||||
// alignment
|
||||
$objWriter->startElement('alignment');
|
||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||
|
||||
$textRotation = 0;
|
||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
|
||||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
|
||||
}
|
||||
$objWriter->writeAttribute('textRotation', $textRotation);
|
||||
|
||||
$objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false'));
|
||||
|
||||
if ($pStyle->getAlignment()->getIndent() > 0) {
|
||||
$objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
|
||||
}
|
||||
if ($pStyle->getAlignment()->getReadorder() > 0) {
|
||||
$objWriter->writeAttribute('readingOrder', $pStyle->getAlignment()->getReadorder());
|
||||
}
|
||||
$objWriter->endElement();
|
||||
|
||||
// protection
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->startElement('protection');
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
|
||||
if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) {
|
||||
$objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164) );
|
||||
} else {
|
||||
$objWriter->writeAttribute('numFmtId', (int)$pStyle->getNumberFormat()->getBuiltInFormatCode());
|
||||
if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
|
||||
$objWriter->writeAttribute('fillId', (int)$this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode()));
|
||||
$objWriter->writeAttribute('borderId', (int)$this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode()));
|
||||
|
||||
// Apply styles?
|
||||
$objWriter->writeAttribute('applyFont', ($pPHPExcel->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyNumberFormat', ($pPHPExcel->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyFill', ($pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyBorder', ($pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0');
|
||||
$objWriter->writeAttribute('applyAlignment', ($pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0');
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('applyProtection', 'true');
|
||||
}
|
||||
|
||||
// alignment
|
||||
$objWriter->startElement('alignment');
|
||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||
|
||||
$textRotation = 0;
|
||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
|
||||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
|
||||
}
|
||||
$objWriter->writeAttribute('textRotation', $textRotation);
|
||||
|
||||
$objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false'));
|
||||
|
||||
if ($pStyle->getAlignment()->getIndent() > 0) {
|
||||
$objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
|
||||
}
|
||||
if ($pStyle->getAlignment()->getReadorder() > 0) {
|
||||
$objWriter->writeAttribute('readingOrder', $pStyle->getAlignment()->getReadorder());
|
||||
}
|
||||
$objWriter->endElement();
|
||||
|
||||
// protection
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->startElement('protection');
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -471,55 +471,54 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
// dxf
|
||||
$objWriter->startElement('dxf');
|
||||
|
||||
// font
|
||||
$this->_writeFont($objWriter, $pStyle->getFont());
|
||||
// font
|
||||
$this->_writeFont($objWriter, $pStyle->getFont());
|
||||
|
||||
// numFmt
|
||||
$this->_writeNumFmt($objWriter, $pStyle->getNumberFormat());
|
||||
// numFmt
|
||||
$this->_writeNumFmt($objWriter, $pStyle->getNumberFormat());
|
||||
|
||||
// fill
|
||||
$this->_writeFill($objWriter, $pStyle->getFill());
|
||||
// fill
|
||||
$this->_writeFill($objWriter, $pStyle->getFill());
|
||||
|
||||
// alignment
|
||||
$objWriter->startElement('alignment');
|
||||
if ($pStyle->getAlignment()->getHorizontal() !== NULL) {
|
||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||
}
|
||||
if ($pStyle->getAlignment()->getVertical() !== NULL) {
|
||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||
}
|
||||
// alignment
|
||||
$objWriter->startElement('alignment');
|
||||
if ($pStyle->getAlignment()->getHorizontal() !== null) {
|
||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||
}
|
||||
if ($pStyle->getAlignment()->getVertical() !== null) {
|
||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||
}
|
||||
|
||||
if ($pStyle->getAlignment()->getTextRotation() !== NULL) {
|
||||
$textRotation = 0;
|
||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
|
||||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
|
||||
}
|
||||
$objWriter->writeAttribute('textRotation', $textRotation);
|
||||
}
|
||||
$objWriter->endElement();
|
||||
|
||||
// border
|
||||
$this->_writeBorder($objWriter, $pStyle->getBorders());
|
||||
|
||||
// protection
|
||||
if (($pStyle->getProtection()->getLocked() !== NULL) ||
|
||||
($pStyle->getProtection()->getHidden() !== NULL)) {
|
||||
if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT ||
|
||||
$pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->startElement('protection');
|
||||
if (($pStyle->getProtection()->getLocked() !== NULL) &&
|
||||
($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
if (($pStyle->getProtection()->getHidden() !== NULL) &&
|
||||
($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
if ($pStyle->getAlignment()->getTextRotation() !== null) {
|
||||
$textRotation = 0;
|
||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
|
||||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
|
||||
}
|
||||
$objWriter->writeAttribute('textRotation', $textRotation);
|
||||
}
|
||||
$objWriter->endElement();
|
||||
|
||||
// border
|
||||
$this->_writeBorder($objWriter, $pStyle->getBorders());
|
||||
|
||||
// protection
|
||||
if (($pStyle->getProtection()->getLocked() !== null) || ($pStyle->getProtection()->getHidden() !== null)) {
|
||||
if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT ||
|
||||
$pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->startElement('protection');
|
||||
if (($pStyle->getProtection()->getLocked() !== null) &&
|
||||
($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
if (($pStyle->getProtection()->getHidden() !== null) &&
|
||||
($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -537,12 +536,12 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
// Write BorderPr
|
||||
if ($pBorder->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) {
|
||||
$objWriter->startElement($pName);
|
||||
$objWriter->writeAttribute('style', $pBorder->getBorderStyle());
|
||||
$objWriter->writeAttribute('style', $pBorder->getBorderStyle());
|
||||
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pBorder->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
// color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pBorder->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -562,10 +561,10 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$formatCode = $pNumberFormat->getFormatCode();
|
||||
|
||||
// numFmt
|
||||
if ($formatCode !== NULL) {
|
||||
if ($formatCode !== null) {
|
||||
$objWriter->startElement('numFmt');
|
||||
$objWriter->writeAttribute('numFmtId', ($pId + 164));
|
||||
$objWriter->writeAttribute('formatCode', $formatCode);
|
||||
$objWriter->writeAttribute('numFmtId', ($pId + 164));
|
||||
$objWriter->writeAttribute('formatCode', $formatCode);
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
@ -579,9 +578,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
*/
|
||||
public function allStyles(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
$aStyles = $pPHPExcel->getCellXfCollection();
|
||||
|
||||
return $aStyles;
|
||||
return $pPHPExcel->getCellXfCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -594,7 +591,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
public function allConditionalStyles(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Get an array of all styles
|
||||
$aStyles = array();
|
||||
$aStyles = array();
|
||||
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
@ -618,7 +615,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
public function allFills(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Get an array of unique fills
|
||||
$aFills = array();
|
||||
$aFills = array();
|
||||
|
||||
// Two first fills are predefined
|
||||
$fill0 = new PHPExcel_Style_Fill();
|
||||
@ -629,7 +626,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$fill1->setFillType(PHPExcel_Style_Fill::FILL_PATTERN_GRAY125);
|
||||
$aFills[] = $fill1;
|
||||
// The remaining fills
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
foreach ($aStyles as $style) {
|
||||
if (!array_key_exists($style->getFill()->getHashCode(), $aFills)) {
|
||||
$aFills[ $style->getFill()->getHashCode() ] = $style->getFill();
|
||||
@ -649,8 +646,8 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
public function allFonts(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Get an array of unique fonts
|
||||
$aFonts = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
$aFonts = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
|
||||
foreach ($aStyles as $style) {
|
||||
if (!array_key_exists($style->getFont()->getHashCode(), $aFonts)) {
|
||||
@ -671,8 +668,8 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
public function allBorders(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Get an array of unique borders
|
||||
$aBorders = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
$aBorders = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
|
||||
foreach ($aStyles as $style) {
|
||||
if (!array_key_exists($style->getBorders()->getHashCode(), $aBorders)) {
|
||||
@ -693,8 +690,8 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
public function allNumberFormats(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
// Get an array of unique number formats
|
||||
$aNumFmts = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
$aNumFmts = array();
|
||||
$aStyles = $this->allStyles($pPHPExcel);
|
||||
|
||||
foreach ($aStyles as $style) {
|
||||
if ($style->getNumberFormat()->getBuiltInFormatCode() === false && !array_key_exists($style->getNumberFormat()->getHashCode(), $aNumFmts)) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -43,7 +43,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeWorkbook(PHPExcel $pPHPExcel = null, $recalcRequired = FALSE)
|
||||
public function writeWorkbook(PHPExcel $pPHPExcel = null, $recalcRequired = false)
|
||||
{
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
@ -54,7 +54,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// workbook
|
||||
$objWriter->startElement('workbook');
|
||||
@ -62,28 +62,28 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
||||
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
|
||||
|
||||
// fileVersion
|
||||
$this->_writeFileVersion($objWriter);
|
||||
// fileVersion
|
||||
$this->_writeFileVersion($objWriter);
|
||||
|
||||
// workbookPr
|
||||
$this->_writeWorkbookPr($objWriter);
|
||||
// workbookPr
|
||||
$this->_writeWorkbookPr($objWriter);
|
||||
|
||||
// workbookProtection
|
||||
$this->_writeWorkbookProtection($objWriter, $pPHPExcel);
|
||||
// workbookProtection
|
||||
$this->_writeWorkbookProtection($objWriter, $pPHPExcel);
|
||||
|
||||
// bookViews
|
||||
if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
|
||||
$this->_writeBookViews($objWriter, $pPHPExcel);
|
||||
}
|
||||
// bookViews
|
||||
if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
|
||||
$this->_writeBookViews($objWriter, $pPHPExcel);
|
||||
}
|
||||
|
||||
// sheets
|
||||
$this->_writeSheets($objWriter, $pPHPExcel);
|
||||
// sheets
|
||||
$this->_writeSheets($objWriter, $pPHPExcel);
|
||||
|
||||
// definedNames
|
||||
$this->_writeDefinedNames($objWriter, $pPHPExcel);
|
||||
// definedNames
|
||||
$this->_writeDefinedNames($objWriter, $pPHPExcel);
|
||||
|
||||
// calcPr
|
||||
$this->_writeCalcPr($objWriter,$recalcRequired);
|
||||
// calcPr
|
||||
$this->_writeCalcPr($objWriter, $recalcRequired);
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -138,20 +138,20 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
// bookViews
|
||||
$objWriter->startElement('bookViews');
|
||||
|
||||
// workbookView
|
||||
$objWriter->startElement('workbookView');
|
||||
// workbookView
|
||||
$objWriter->startElement('workbookView');
|
||||
|
||||
$objWriter->writeAttribute('activeTab', $pPHPExcel->getActiveSheetIndex());
|
||||
$objWriter->writeAttribute('autoFilterDateGrouping', '1');
|
||||
$objWriter->writeAttribute('firstSheet', '0');
|
||||
$objWriter->writeAttribute('minimized', '0');
|
||||
$objWriter->writeAttribute('showHorizontalScroll', '1');
|
||||
$objWriter->writeAttribute('showSheetTabs', '1');
|
||||
$objWriter->writeAttribute('showVerticalScroll', '1');
|
||||
$objWriter->writeAttribute('tabRatio', '600');
|
||||
$objWriter->writeAttribute('visibility', 'visible');
|
||||
$objWriter->writeAttribute('activeTab', $pPHPExcel->getActiveSheetIndex());
|
||||
$objWriter->writeAttribute('autoFilterDateGrouping', '1');
|
||||
$objWriter->writeAttribute('firstSheet', '0');
|
||||
$objWriter->writeAttribute('minimized', '0');
|
||||
$objWriter->writeAttribute('showHorizontalScroll', '1');
|
||||
$objWriter->writeAttribute('showSheetTabs', '1');
|
||||
$objWriter->writeAttribute('showVerticalScroll', '1');
|
||||
$objWriter->writeAttribute('tabRatio', '600');
|
||||
$objWriter->writeAttribute('visibility', 'visible');
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -167,16 +167,16 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
{
|
||||
if ($pPHPExcel->getSecurity()->isSecurityEnabled()) {
|
||||
$objWriter->startElement('workbookProtection');
|
||||
$objWriter->writeAttribute('lockRevision', ($pPHPExcel->getSecurity()->getLockRevision() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('lockStructure', ($pPHPExcel->getSecurity()->getLockStructure() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('lockWindows', ($pPHPExcel->getSecurity()->getLockWindows() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('lockRevision', ($pPHPExcel->getSecurity()->getLockRevision() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('lockStructure', ($pPHPExcel->getSecurity()->getLockStructure() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('lockWindows', ($pPHPExcel->getSecurity()->getLockWindows() ? 'true' : 'false'));
|
||||
|
||||
if ($pPHPExcel->getSecurity()->getRevisionsPassword() != '') {
|
||||
$objWriter->writeAttribute('revisionsPassword', $pPHPExcel->getSecurity()->getRevisionsPassword());
|
||||
$objWriter->writeAttribute('revisionsPassword', $pPHPExcel->getSecurity()->getRevisionsPassword());
|
||||
}
|
||||
|
||||
if ($pPHPExcel->getSecurity()->getWorkbookPassword() != '') {
|
||||
$objWriter->writeAttribute('workbookPassword', $pPHPExcel->getSecurity()->getWorkbookPassword());
|
||||
$objWriter->writeAttribute('workbookPassword', $pPHPExcel->getSecurity()->getWorkbookPassword());
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
@ -190,18 +190,18 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
* @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = TRUE)
|
||||
private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = true)
|
||||
{
|
||||
$objWriter->startElement('calcPr');
|
||||
|
||||
// Set the calcid to a higher value than Excel itself will use, otherwise Excel will always recalc
|
||||
// If MS Excel does do a recalc, then users opening a file in MS Excel will be prompted to save on exit
|
||||
// because the file has changed
|
||||
$objWriter->writeAttribute('calcId', '999999');
|
||||
$objWriter->writeAttribute('calcMode', 'auto');
|
||||
$objWriter->writeAttribute('calcId', '999999');
|
||||
$objWriter->writeAttribute('calcMode', 'auto');
|
||||
// fullCalcOnLoad isn't needed if we've recalculating for the save
|
||||
$objWriter->writeAttribute('calcCompleted', ($recalcRequired) ? 1 : 0);
|
||||
$objWriter->writeAttribute('fullCalcOnLoad', ($recalcRequired) ? 0 : 1);
|
||||
$objWriter->writeAttribute('calcCompleted', ($recalcRequired) ? 1 : 0);
|
||||
$objWriter->writeAttribute('fullCalcOnLoad', ($recalcRequired) ? 0 : 1);
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -247,12 +247,12 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
if ($pSheetname != '') {
|
||||
// Write sheet
|
||||
$objWriter->startElement('sheet');
|
||||
$objWriter->writeAttribute('name', $pSheetname);
|
||||
$objWriter->writeAttribute('sheetId', $pSheetId);
|
||||
$objWriter->writeAttribute('name', $pSheetname);
|
||||
$objWriter->writeAttribute('sheetId', $pSheetId);
|
||||
if ($sheetState != 'visible' && $sheetState != '') {
|
||||
$objWriter->writeAttribute('state', $sheetState);
|
||||
}
|
||||
$objWriter->writeAttribute('r:id', 'rId' . $pRelId);
|
||||
$objWriter->writeAttribute('r:id', 'rId' . $pRelId);
|
||||
$objWriter->endElement();
|
||||
} else {
|
||||
throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
|
||||
@ -320,9 +320,9 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
{
|
||||
// definedName for named range
|
||||
$objWriter->startElement('definedName');
|
||||
$objWriter->writeAttribute('name', $pNamedRange->getName());
|
||||
$objWriter->writeAttribute('name', $pNamedRange->getName());
|
||||
if ($pNamedRange->getLocalOnly()) {
|
||||
$objWriter->writeAttribute('localSheetId', $pNamedRange->getScope()->getParent()->getIndex($pNamedRange->getScope()));
|
||||
$objWriter->writeAttribute('localSheetId', $pNamedRange->getScope()->getParent()->getIndex($pNamedRange->getScope()));
|
||||
}
|
||||
|
||||
// Create absolute coordinate and write as raw text
|
||||
@ -354,16 +354,16 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
$autoFilterRange = $pSheet->getAutoFilter()->getRange();
|
||||
if (!empty($autoFilterRange)) {
|
||||
$objWriter->startElement('definedName');
|
||||
$objWriter->writeAttribute('name', '_xlnm._FilterDatabase');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
$objWriter->writeAttribute('hidden', '1');
|
||||
$objWriter->writeAttribute('name', '_xlnm._FilterDatabase');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
$objWriter->writeAttribute('hidden', '1');
|
||||
|
||||
// Create absolute coordinate and write as raw text
|
||||
$range = PHPExcel_Cell::splitRange($autoFilterRange);
|
||||
$range = $range[0];
|
||||
// Strip any worksheet ref so we can make the cell ref absolute
|
||||
if (strpos($range[0],'!') !== false) {
|
||||
list($ws,$range[0]) = explode('!',$range[0]);
|
||||
if (strpos($range[0], '!') !== false) {
|
||||
list($ws, $range[0]) = explode('!', $range[0]);
|
||||
}
|
||||
|
||||
$range[0] = PHPExcel_Cell::absoluteCoordinate($range[0]);
|
||||
@ -389,8 +389,8 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
// definedName for PrintTitles
|
||||
if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
|
||||
$objWriter->startElement('definedName');
|
||||
$objWriter->writeAttribute('name', '_xlnm.Print_Titles');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
$objWriter->writeAttribute('name', '_xlnm.Print_Titles');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
|
||||
// Setting string
|
||||
$settingString = '';
|
||||
@ -432,8 +432,8 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
// definedName for PrintArea
|
||||
if ($pSheet->getPageSetup()->isPrintAreaSet()) {
|
||||
$objWriter->startElement('definedName');
|
||||
$objWriter->writeAttribute('name', '_xlnm.Print_Area');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
$objWriter->writeAttribute('name', '_xlnm.Print_Area');
|
||||
$objWriter->writeAttribute('localSheetId', $pSheetId);
|
||||
|
||||
// Setting string
|
||||
$settingString = '';
|
||||
|
@ -44,7 +44,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeWorksheet($pSheet = null, $pStringTable = null, $includeCharts = FALSE)
|
||||
public function writeWorksheet($pSheet = null, $pStringTable = null, $includeCharts = false)
|
||||
{
|
||||
if (!is_null($pSheet)) {
|
||||
// Create XML writer
|
||||
@ -56,7 +56,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
}
|
||||
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Worksheet
|
||||
$objWriter->startElement('worksheet');
|
||||
@ -148,37 +148,37 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
// sheetPr
|
||||
$objWriter->startElement('sheetPr');
|
||||
//$objWriter->writeAttribute('codeName', $pSheet->getTitle());
|
||||
if($pSheet->getParent()->hasMacros()){//if the workbook have macros, we need to have codeName for the sheet
|
||||
if($pSheet->hasCodeName()==false){
|
||||
if ($pSheet->getParent()->hasMacros()) {//if the workbook have macros, we need to have codeName for the sheet
|
||||
if ($pSheet->hasCodeName()==false) {
|
||||
$pSheet->setCodeName($pSheet->getTitle());
|
||||
}
|
||||
$objWriter->writeAttribute('codeName', $pSheet->getCodeName());
|
||||
$objWriter->writeAttribute('codeName', $pSheet->getCodeName());
|
||||
}
|
||||
$autoFilterRange = $pSheet->getAutoFilter()->getRange();
|
||||
if (!empty($autoFilterRange)) {
|
||||
$objWriter->writeAttribute('filterMode', 1);
|
||||
$pSheet->getAutoFilter()->showHideRows();
|
||||
}
|
||||
$autoFilterRange = $pSheet->getAutoFilter()->getRange();
|
||||
if (!empty($autoFilterRange)) {
|
||||
$objWriter->writeAttribute('filterMode', 1);
|
||||
$pSheet->getAutoFilter()->showHideRows();
|
||||
}
|
||||
|
||||
// tabColor
|
||||
if ($pSheet->isTabColorSet()) {
|
||||
$objWriter->startElement('tabColor');
|
||||
$objWriter->writeAttribute('rgb', $pSheet->getTabColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// outlinePr
|
||||
$objWriter->startElement('outlinePr');
|
||||
$objWriter->writeAttribute('summaryBelow', ($pSheet->getShowSummaryBelow() ? '1' : '0'));
|
||||
$objWriter->writeAttribute('summaryRight', ($pSheet->getShowSummaryRight() ? '1' : '0'));
|
||||
// tabColor
|
||||
if ($pSheet->isTabColorSet()) {
|
||||
$objWriter->startElement('tabColor');
|
||||
$objWriter->writeAttribute('rgb', $pSheet->getTabColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// pageSetUpPr
|
||||
if ($pSheet->getPageSetup()->getFitToPage()) {
|
||||
$objWriter->startElement('pageSetUpPr');
|
||||
$objWriter->writeAttribute('fitToPage', '1');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// outlinePr
|
||||
$objWriter->startElement('outlinePr');
|
||||
$objWriter->writeAttribute('summaryBelow', ($pSheet->getShowSummaryBelow() ? '1' : '0'));
|
||||
$objWriter->writeAttribute('summaryRight', ($pSheet->getShowSummaryRight() ? '1' : '0'));
|
||||
$objWriter->endElement();
|
||||
|
||||
// pageSetUpPr
|
||||
if ($pSheet->getPageSetup()->getFitToPage()) {
|
||||
$objWriter->startElement('pageSetUpPr');
|
||||
$objWriter->writeAttribute('fitToPage', '1');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -205,28 +205,28 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
* @param PHPExcel_Worksheet $pSheet Worksheet
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
private function _writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = NULL, PHPExcel_Worksheet $pSheet = NULL)
|
||||
private function _writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
|
||||
{
|
||||
// sheetViews
|
||||
$objWriter->startElement('sheetViews');
|
||||
|
||||
// Sheet selected?
|
||||
$sheetSelected = false;
|
||||
if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex())
|
||||
if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) {
|
||||
$sheetSelected = true;
|
||||
|
||||
}
|
||||
|
||||
// sheetView
|
||||
$objWriter->startElement('sheetView');
|
||||
$objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0');
|
||||
$objWriter->writeAttribute('workbookViewId', '0');
|
||||
$objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0');
|
||||
$objWriter->writeAttribute('workbookViewId', '0');
|
||||
|
||||
// Zoom scales
|
||||
if ($pSheet->getSheetView()->getZoomScale() != 100) {
|
||||
$objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale());
|
||||
$objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale());
|
||||
}
|
||||
if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) {
|
||||
$objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal());
|
||||
$objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal());
|
||||
}
|
||||
|
||||
// View Layout Type
|
||||
@ -236,9 +236,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
|
||||
// Gridlines
|
||||
if ($pSheet->getShowGridlines()) {
|
||||
$objWriter->writeAttribute('showGridLines', 'true');
|
||||
$objWriter->writeAttribute('showGridLines', 'true');
|
||||
} else {
|
||||
$objWriter->writeAttribute('showGridLines', 'false');
|
||||
$objWriter->writeAttribute('showGridLines', 'false');
|
||||
}
|
||||
|
||||
// Row and column headers
|
||||
@ -250,7 +250,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
|
||||
// Right-to-left
|
||||
if ($pSheet->getRightToLeft()) {
|
||||
$objWriter->writeAttribute('rightToLeft', 'true');
|
||||
$objWriter->writeAttribute('rightToLeft', 'true');
|
||||
}
|
||||
|
||||
$activeCell = $pSheet->getActiveCell();
|
||||
@ -270,20 +270,24 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
$pane = 'topRight';
|
||||
$objWriter->startElement('pane');
|
||||
if ($xSplit > 1)
|
||||
$objWriter->writeAttribute('xSplit', $xSplit - 1);
|
||||
$objWriter->writeAttribute('xSplit', $xSplit - 1);
|
||||
if ($ySplit > 1) {
|
||||
$objWriter->writeAttribute('ySplit', $ySplit - 1);
|
||||
$objWriter->writeAttribute('ySplit', $ySplit - 1);
|
||||
$pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
|
||||
}
|
||||
$objWriter->writeAttribute('topLeftCell', $topLeftCell);
|
||||
$objWriter->writeAttribute('activePane', $pane);
|
||||
$objWriter->writeAttribute('state', 'frozen');
|
||||
$objWriter->writeAttribute('topLeftCell', $topLeftCell);
|
||||
$objWriter->writeAttribute('activePane', $pane);
|
||||
$objWriter->writeAttribute('state', 'frozen');
|
||||
$objWriter->endElement();
|
||||
|
||||
if (($xSplit > 1) && ($ySplit > 1)) {
|
||||
// Write additional selections if more than two panes (ie both an X and a Y split)
|
||||
$objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'topRight'); $objWriter->endElement();
|
||||
$objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'bottomLeft'); $objWriter->endElement();
|
||||
$objWriter->startElement('selection');
|
||||
$objWriter->writeAttribute('pane', 'topRight');
|
||||
$objWriter->endElement();
|
||||
$objWriter->startElement('selection');
|
||||
$objWriter->writeAttribute('pane', 'bottomLeft');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,42 +321,42 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
// sheetFormatPr
|
||||
$objWriter->startElement('sheetFormatPr');
|
||||
|
||||
// Default row height
|
||||
if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
|
||||
$objWriter->writeAttribute('customHeight', 'true');
|
||||
$objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
|
||||
} else {
|
||||
$objWriter->writeAttribute('defaultRowHeight', '14.4');
|
||||
}
|
||||
// Default row height
|
||||
if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
|
||||
$objWriter->writeAttribute('customHeight', 'true');
|
||||
$objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
|
||||
} else {
|
||||
$objWriter->writeAttribute('defaultRowHeight', '14.4');
|
||||
}
|
||||
|
||||
// Set Zero Height row
|
||||
if ((string)$pSheet->getDefaultRowDimension()->getZeroHeight() == '1' ||
|
||||
strtolower((string)$pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true' ) {
|
||||
$objWriter->writeAttribute('zeroHeight', '1');
|
||||
}
|
||||
// Set Zero Height row
|
||||
if ((string)$pSheet->getDefaultRowDimension()->getZeroHeight() == '1' ||
|
||||
strtolower((string)$pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true') {
|
||||
$objWriter->writeAttribute('zeroHeight', '1');
|
||||
}
|
||||
|
||||
// Default column width
|
||||
if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
|
||||
$objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
|
||||
}
|
||||
// Default column width
|
||||
if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
|
||||
$objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
|
||||
}
|
||||
|
||||
// Outline level - row
|
||||
$outlineLevelRow = 0;
|
||||
foreach ($pSheet->getRowDimensions() as $dimension) {
|
||||
if ($dimension->getOutlineLevel() > $outlineLevelRow) {
|
||||
$outlineLevelRow = $dimension->getOutlineLevel();
|
||||
}
|
||||
// Outline level - row
|
||||
$outlineLevelRow = 0;
|
||||
foreach ($pSheet->getRowDimensions() as $dimension) {
|
||||
if ($dimension->getOutlineLevel() > $outlineLevelRow) {
|
||||
$outlineLevelRow = $dimension->getOutlineLevel();
|
||||
}
|
||||
$objWriter->writeAttribute('outlineLevelRow', (int)$outlineLevelRow);
|
||||
}
|
||||
$objWriter->writeAttribute('outlineLevelRow', (int)$outlineLevelRow);
|
||||
|
||||
// Outline level - column
|
||||
$outlineLevelCol = 0;
|
||||
foreach ($pSheet->getColumnDimensions() as $dimension) {
|
||||
if ($dimension->getOutlineLevel() > $outlineLevelCol) {
|
||||
$outlineLevelCol = $dimension->getOutlineLevel();
|
||||
}
|
||||
// Outline level - column
|
||||
$outlineLevelCol = 0;
|
||||
foreach ($pSheet->getColumnDimensions() as $dimension) {
|
||||
if ($dimension->getOutlineLevel() > $outlineLevelCol) {
|
||||
$outlineLevelCol = $dimension->getOutlineLevel();
|
||||
}
|
||||
$objWriter->writeAttribute('outlineLevelCol', (int)$outlineLevelCol);
|
||||
}
|
||||
$objWriter->writeAttribute('outlineLevelCol', (int)$outlineLevelCol);
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -360,8 +364,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
/**
|
||||
* Write Cols
|
||||
*
|
||||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
|
||||
* @param PHPExcel_Worksheet $pSheet Worksheet
|
||||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
|
||||
* @param PHPExcel_Worksheet $pSheet Worksheet
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
|
||||
@ -370,54 +374,54 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
if (count($pSheet->getColumnDimensions()) > 0) {
|
||||
$objWriter->startElement('cols');
|
||||
|
||||
$pSheet->calculateColumnWidths();
|
||||
$pSheet->calculateColumnWidths();
|
||||
|
||||
// Loop through column dimensions
|
||||
foreach ($pSheet->getColumnDimensions() as $colDimension) {
|
||||
// col
|
||||
$objWriter->startElement('col');
|
||||
$objWriter->writeAttribute('min', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
|
||||
$objWriter->writeAttribute('max', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
|
||||
// Loop through column dimensions
|
||||
foreach ($pSheet->getColumnDimensions() as $colDimension) {
|
||||
// col
|
||||
$objWriter->startElement('col');
|
||||
$objWriter->writeAttribute('min', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
|
||||
$objWriter->writeAttribute('max', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
|
||||
|
||||
if ($colDimension->getWidth() < 0) {
|
||||
// No width set, apply default of 10
|
||||
$objWriter->writeAttribute('width', '9.10');
|
||||
} else {
|
||||
// Width set
|
||||
$objWriter->writeAttribute('width', PHPExcel_Shared_String::FormatNumber($colDimension->getWidth()));
|
||||
}
|
||||
|
||||
// Column visibility
|
||||
if ($colDimension->getVisible() == false) {
|
||||
$objWriter->writeAttribute('hidden', 'true');
|
||||
}
|
||||
|
||||
// Auto size?
|
||||
if ($colDimension->getAutoSize()) {
|
||||
$objWriter->writeAttribute('bestFit', 'true');
|
||||
}
|
||||
|
||||
// Custom width?
|
||||
if ($colDimension->getWidth() != $pSheet->getDefaultColumnDimension()->getWidth()) {
|
||||
$objWriter->writeAttribute('customWidth', 'true');
|
||||
}
|
||||
|
||||
// Collapsed
|
||||
if ($colDimension->getCollapsed() == true) {
|
||||
$objWriter->writeAttribute('collapsed', 'true');
|
||||
}
|
||||
|
||||
// Outline level
|
||||
if ($colDimension->getOutlineLevel() > 0) {
|
||||
$objWriter->writeAttribute('outlineLevel', $colDimension->getOutlineLevel());
|
||||
}
|
||||
|
||||
// Style
|
||||
$objWriter->writeAttribute('style', $colDimension->getXfIndex());
|
||||
|
||||
$objWriter->endElement();
|
||||
if ($colDimension->getWidth() < 0) {
|
||||
// No width set, apply default of 10
|
||||
$objWriter->writeAttribute('width', '9.10');
|
||||
} else {
|
||||
// Width set
|
||||
$objWriter->writeAttribute('width', PHPExcel_Shared_String::FormatNumber($colDimension->getWidth()));
|
||||
}
|
||||
|
||||
// Column visibility
|
||||
if ($colDimension->getVisible() == false) {
|
||||
$objWriter->writeAttribute('hidden', 'true');
|
||||
}
|
||||
|
||||
// Auto size?
|
||||
if ($colDimension->getAutoSize()) {
|
||||
$objWriter->writeAttribute('bestFit', 'true');
|
||||
}
|
||||
|
||||
// Custom width?
|
||||
if ($colDimension->getWidth() != $pSheet->getDefaultColumnDimension()->getWidth()) {
|
||||
$objWriter->writeAttribute('customWidth', 'true');
|
||||
}
|
||||
|
||||
// Collapsed
|
||||
if ($colDimension->getCollapsed() == true) {
|
||||
$objWriter->writeAttribute('collapsed', 'true');
|
||||
}
|
||||
|
||||
// Outline level
|
||||
if ($colDimension->getOutlineLevel() > 0) {
|
||||
$objWriter->writeAttribute('outlineLevel', $colDimension->getOutlineLevel());
|
||||
}
|
||||
|
||||
// Style
|
||||
$objWriter->writeAttribute('style', $colDimension->getXfIndex());
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
@ -435,25 +439,25 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
$objWriter->startElement('sheetProtection');
|
||||
|
||||
if ($pSheet->getProtection()->getPassword() != '') {
|
||||
$objWriter->writeAttribute('password', $pSheet->getProtection()->getPassword());
|
||||
$objWriter->writeAttribute('password', $pSheet->getProtection()->getPassword());
|
||||
}
|
||||
|
||||
$objWriter->writeAttribute('sheet', ($pSheet->getProtection()->getSheet() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('objects', ($pSheet->getProtection()->getObjects() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('scenarios', ($pSheet->getProtection()->getScenarios() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('formatCells', ($pSheet->getProtection()->getFormatCells() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('formatColumns', ($pSheet->getProtection()->getFormatColumns() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('formatRows', ($pSheet->getProtection()->getFormatRows() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('insertColumns', ($pSheet->getProtection()->getInsertColumns() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('insertRows', ($pSheet->getProtection()->getInsertRows() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('insertHyperlinks', ($pSheet->getProtection()->getInsertHyperlinks() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('deleteColumns', ($pSheet->getProtection()->getDeleteColumns() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('deleteRows', ($pSheet->getProtection()->getDeleteRows() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('selectLockedCells', ($pSheet->getProtection()->getSelectLockedCells() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('sort', ($pSheet->getProtection()->getSort() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('autoFilter', ($pSheet->getProtection()->getAutoFilter() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('pivotTables', ($pSheet->getProtection()->getPivotTables() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('selectUnlockedCells', ($pSheet->getProtection()->getSelectUnlockedCells() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('sheet', ($pSheet->getProtection()->getSheet() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('objects', ($pSheet->getProtection()->getObjects() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('scenarios', ($pSheet->getProtection()->getScenarios() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('formatCells', ($pSheet->getProtection()->getFormatCells() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('formatColumns', ($pSheet->getProtection()->getFormatColumns() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('formatRows', ($pSheet->getProtection()->getFormatRows() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('insertColumns', ($pSheet->getProtection()->getInsertColumns() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('insertRows', ($pSheet->getProtection()->getInsertRows() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('insertHyperlinks', ($pSheet->getProtection()->getInsertHyperlinks() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('deleteColumns', ($pSheet->getProtection()->getDeleteColumns() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('deleteRows', ($pSheet->getProtection()->getDeleteRows() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('selectLockedCells', ($pSheet->getProtection()->getSelectLockedCells() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('sort', ($pSheet->getProtection()->getSort() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('autoFilter', ($pSheet->getProtection()->getAutoFilter() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('pivotTables', ($pSheet->getProtection()->getPivotTables() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('selectUnlockedCells', ($pSheet->getProtection()->getSelectUnlockedCells() ? 'true' : 'false'));
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
@ -473,54 +477,54 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
foreach ($pSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) {
|
||||
foreach ($conditionalStyles as $conditional) {
|
||||
// WHY was this again?
|
||||
// if ($this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() ) == '') {
|
||||
// if ($this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()) == '') {
|
||||
// continue;
|
||||
// }
|
||||
if ($conditional->getConditionType() != PHPExcel_Style_Conditional::CONDITION_NONE) {
|
||||
// conditionalFormatting
|
||||
$objWriter->startElement('conditionalFormatting');
|
||||
$objWriter->writeAttribute('sqref', $cellCoordinate);
|
||||
$objWriter->writeAttribute('sqref', $cellCoordinate);
|
||||
|
||||
// cfRule
|
||||
$objWriter->startElement('cfRule');
|
||||
$objWriter->writeAttribute('type', $conditional->getConditionType());
|
||||
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() ));
|
||||
$objWriter->writeAttribute('priority', $id++);
|
||||
$objWriter->writeAttribute('type', $conditional->getConditionType());
|
||||
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
|
||||
$objWriter->writeAttribute('priority', $id++);
|
||||
|
||||
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|
||||
||
|
||||
$conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
|
||||
&& $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
|
||||
$objWriter->writeAttribute('operator', $conditional->getOperatorType());
|
||||
$objWriter->writeAttribute('operator', $conditional->getOperatorType());
|
||||
}
|
||||
|
||||
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeAttribute('text', $conditional->getText());
|
||||
$objWriter->writeAttribute('text', $conditional->getText());
|
||||
}
|
||||
|
||||
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
|
||||
$objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
|
||||
$objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
|
||||
$objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
|
||||
$objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|
||||
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
|
||||
foreach ($conditional->getConditions() as $formula) {
|
||||
// Formula
|
||||
$objWriter->writeElement('formula', $formula);
|
||||
$objWriter->writeElement('formula', $formula);
|
||||
}
|
||||
}
|
||||
|
||||
@ -564,10 +568,10 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
$objWriter->writeAttribute('operator', $dv->getOperator());
|
||||
}
|
||||
|
||||
$objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0'));
|
||||
$objWriter->writeAttribute('showDropDown', (!$dv->getShowDropDown() ? '1' : '0'));
|
||||
$objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0'));
|
||||
$objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0'));
|
||||
$objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0'));
|
||||
$objWriter->writeAttribute('showDropDown', (!$dv->getShowDropDown() ? '1' : '0'));
|
||||
$objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0'));
|
||||
$objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0'));
|
||||
|
||||
if ($dv->getErrorTitle() !== '') {
|
||||
$objWriter->writeAttribute('errorTitle', $dv->getErrorTitle());
|
||||
@ -622,10 +626,10 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
|
||||
$objWriter->writeAttribute('ref', $coordinate);
|
||||
if (!$hyperlink->isInternal()) {
|
||||
$objWriter->writeAttribute('r:id', 'rId_hyperlink_' . $relationId);
|
||||
$objWriter->writeAttribute('r:id', 'rId_hyperlink_' . $relationId);
|
||||
++$relationId;
|
||||
} else {
|
||||
$objWriter->writeAttribute('location', str_replace('sheet://', '', $hyperlink->getUrl()));
|
||||
$objWriter->writeAttribute('location', str_replace('sheet://', '', $hyperlink->getUrl()));
|
||||
}
|
||||
|
||||
if ($hyperlink->getTooltip() != '') {
|
||||
@ -656,8 +660,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
foreach ($pSheet->getProtectedCells() as $protectedCell => $passwordHash) {
|
||||
// protectedRange
|
||||
$objWriter->startElement('protectedRange');
|
||||
$objWriter->writeAttribute('name', 'p' . md5($protectedCell));
|
||||
$objWriter->writeAttribute('sqref', $protectedCell);
|
||||
$objWriter->writeAttribute('name', 'p' . md5($protectedCell));
|
||||
$objWriter->writeAttribute('sqref', $protectedCell);
|
||||
if (!empty($passwordHash)) {
|
||||
$objWriter->writeAttribute('password', $passwordHash);
|
||||
}
|
||||
@ -705,8 +709,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
// printOptions
|
||||
$objWriter->startElement('printOptions');
|
||||
|
||||
$objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true': 'false'));
|
||||
$objWriter->writeAttribute('gridLinesSet', 'true');
|
||||
$objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true': 'false'));
|
||||
$objWriter->writeAttribute('gridLinesSet', 'true');
|
||||
|
||||
if ($pSheet->getPageSetup()->getHorizontalCentered()) {
|
||||
$objWriter->writeAttribute('horizontalCentered', 'true');
|
||||
@ -730,12 +734,12 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
{
|
||||
// pageMargins
|
||||
$objWriter->startElement('pageMargins');
|
||||
$objWriter->writeAttribute('left', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()));
|
||||
$objWriter->writeAttribute('right', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()));
|
||||
$objWriter->writeAttribute('top', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()));
|
||||
$objWriter->writeAttribute('bottom', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()));
|
||||
$objWriter->writeAttribute('header', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader()));
|
||||
$objWriter->writeAttribute('footer', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter()));
|
||||
$objWriter->writeAttribute('left', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()));
|
||||
$objWriter->writeAttribute('right', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()));
|
||||
$objWriter->writeAttribute('top', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()));
|
||||
$objWriter->writeAttribute('bottom', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()));
|
||||
$objWriter->writeAttribute('header', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader()));
|
||||
$objWriter->writeAttribute('footer', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter()));
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
@ -758,23 +762,23 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
$range = $range[0];
|
||||
// Strip any worksheet ref
|
||||
if (strpos($range[0],'!') !== false) {
|
||||
list($ws,$range[0]) = explode('!',$range[0]);
|
||||
list($ws, $range[0]) = explode('!', $range[0]);
|
||||
}
|
||||
$range = implode(':', $range);
|
||||
|
||||
$objWriter->writeAttribute('ref', str_replace('$','',$range));
|
||||
$objWriter->writeAttribute('ref', str_replace('$','', $range));
|
||||
|
||||
$columns = $pSheet->getAutoFilter()->getColumns();
|
||||
if (count($columns > 0)) {
|
||||
foreach($columns as $columnID => $column) {
|
||||
foreach ($columns as $columnID => $column) {
|
||||
$rules = $column->getRules();
|
||||
if (count($rules > 0)) {
|
||||
$objWriter->startElement('filterColumn');
|
||||
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
|
||||
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
|
||||
|
||||
$objWriter->startElement( $column->getFilterType());
|
||||
$objWriter->startElement($column->getFilterType());
|
||||
if ($column->getJoin() == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) {
|
||||
$objWriter->writeAttribute('and', 1);
|
||||
$objWriter->writeAttribute('and', 1);
|
||||
}
|
||||
|
||||
foreach ($rules as $rule) {
|
||||
@ -783,37 +787,37 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
($rule->getValue() === '')) {
|
||||
// Filter rule for Blanks
|
||||
$objWriter->writeAttribute('blank', 1);
|
||||
} elseif($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) {
|
||||
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) {
|
||||
// Dynamic Filter Rule
|
||||
$objWriter->writeAttribute('type', $rule->getGrouping());
|
||||
$val = $column->getAttribute('val');
|
||||
if ($val !== NULL) {
|
||||
if ($val !== null) {
|
||||
$objWriter->writeAttribute('val', $val);
|
||||
}
|
||||
$maxVal = $column->getAttribute('maxVal');
|
||||
if ($maxVal !== NULL) {
|
||||
if ($maxVal !== null) {
|
||||
$objWriter->writeAttribute('maxVal', $maxVal);
|
||||
}
|
||||
} elseif($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) {
|
||||
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) {
|
||||
// Top 10 Filter Rule
|
||||
$objWriter->writeAttribute('val', $rule->getValue());
|
||||
$objWriter->writeAttribute('percent', (($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0'));
|
||||
$objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0'));
|
||||
$objWriter->writeAttribute('val', $rule->getValue());
|
||||
$objWriter->writeAttribute('percent', (($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0'));
|
||||
$objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0'));
|
||||
} else {
|
||||
// Filter, DateGroupItem or CustomFilter
|
||||
$objWriter->startElement($rule->getRuleType());
|
||||
|
||||
if ($rule->getOperator() !== PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) {
|
||||
$objWriter->writeAttribute('operator', $rule->getOperator());
|
||||
$objWriter->writeAttribute('operator', $rule->getOperator());
|
||||
}
|
||||
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
|
||||
// Date Group filters
|
||||
foreach($rule->getValue() as $key => $value) {
|
||||
if ($value > '') $objWriter->writeAttribute($key, $value);
|
||||
foreach ($rule->getValue() as $key => $value) {
|
||||
if ($value > '') $objWriter->writeAttribute($key, $value);
|
||||
}
|
||||
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
|
||||
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
|
||||
} else {
|
||||
$objWriter->writeAttribute('val', $rule->getValue());
|
||||
$objWriter->writeAttribute('val', $rule->getValue());
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
@ -842,24 +846,24 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
{
|
||||
// pageSetup
|
||||
$objWriter->startElement('pageSetup');
|
||||
$objWriter->writeAttribute('paperSize', $pSheet->getPageSetup()->getPaperSize());
|
||||
$objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation());
|
||||
$objWriter->writeAttribute('paperSize', $pSheet->getPageSetup()->getPaperSize());
|
||||
$objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation());
|
||||
|
||||
if (!is_null($pSheet->getPageSetup()->getScale())) {
|
||||
$objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale());
|
||||
$objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale());
|
||||
}
|
||||
if (!is_null($pSheet->getPageSetup()->getFitToHeight())) {
|
||||
$objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight());
|
||||
$objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight());
|
||||
} else {
|
||||
$objWriter->writeAttribute('fitToHeight', '0');
|
||||
$objWriter->writeAttribute('fitToHeight', '0');
|
||||
}
|
||||
if (!is_null($pSheet->getPageSetup()->getFitToWidth())) {
|
||||
$objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth());
|
||||
$objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth());
|
||||
} else {
|
||||
$objWriter->writeAttribute('fitToWidth', '0');
|
||||
$objWriter->writeAttribute('fitToWidth', '0');
|
||||
}
|
||||
if (!is_null($pSheet->getPageSetup()->getFirstPageNumber())) {
|
||||
$objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber());
|
||||
$objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber());
|
||||
$objWriter->writeAttribute('useFirstPageNumber', '1');
|
||||
}
|
||||
|
||||
@ -877,17 +881,17 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
{
|
||||
// headerFooter
|
||||
$objWriter->startElement('headerFooter');
|
||||
$objWriter->writeAttribute('differentOddEven', ($pSheet->getHeaderFooter()->getDifferentOddEven() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('differentFirst', ($pSheet->getHeaderFooter()->getDifferentFirst() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('scaleWithDoc', ($pSheet->getHeaderFooter()->getScaleWithDocument() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('alignWithMargins', ($pSheet->getHeaderFooter()->getAlignWithMargins() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('differentOddEven', ($pSheet->getHeaderFooter()->getDifferentOddEven() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('differentFirst', ($pSheet->getHeaderFooter()->getDifferentFirst() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('scaleWithDoc', ($pSheet->getHeaderFooter()->getScaleWithDocument() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('alignWithMargins', ($pSheet->getHeaderFooter()->getAlignWithMargins() ? 'true' : 'false'));
|
||||
|
||||
$objWriter->writeElement('oddHeader', $pSheet->getHeaderFooter()->getOddHeader());
|
||||
$objWriter->writeElement('oddFooter', $pSheet->getHeaderFooter()->getOddFooter());
|
||||
$objWriter->writeElement('evenHeader', $pSheet->getHeaderFooter()->getEvenHeader());
|
||||
$objWriter->writeElement('evenFooter', $pSheet->getHeaderFooter()->getEvenFooter());
|
||||
$objWriter->writeElement('firstHeader', $pSheet->getHeaderFooter()->getFirstHeader());
|
||||
$objWriter->writeElement('firstFooter', $pSheet->getHeaderFooter()->getFirstFooter());
|
||||
$objWriter->writeElement('oddHeader', $pSheet->getHeaderFooter()->getOddHeader());
|
||||
$objWriter->writeElement('oddFooter', $pSheet->getHeaderFooter()->getOddFooter());
|
||||
$objWriter->writeElement('evenHeader', $pSheet->getHeaderFooter()->getEvenHeader());
|
||||
$objWriter->writeElement('evenFooter', $pSheet->getHeaderFooter()->getEvenFooter());
|
||||
$objWriter->writeElement('firstHeader', $pSheet->getHeaderFooter()->getFirstHeader());
|
||||
$objWriter->writeElement('firstFooter', $pSheet->getHeaderFooter()->getFirstFooter());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
@ -914,15 +918,15 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
// rowBreaks
|
||||
if (!empty($aRowBreaks)) {
|
||||
$objWriter->startElement('rowBreaks');
|
||||
$objWriter->writeAttribute('count', count($aRowBreaks));
|
||||
$objWriter->writeAttribute('manualBreakCount', count($aRowBreaks));
|
||||
$objWriter->writeAttribute('count', count($aRowBreaks));
|
||||
$objWriter->writeAttribute('manualBreakCount', count($aRowBreaks));
|
||||
|
||||
foreach ($aRowBreaks as $cell) {
|
||||
$coords = PHPExcel_Cell::coordinateFromString($cell);
|
||||
|
||||
$objWriter->startElement('brk');
|
||||
$objWriter->writeAttribute('id', $coords[1]);
|
||||
$objWriter->writeAttribute('man', '1');
|
||||
$objWriter->writeAttribute('id', $coords[1]);
|
||||
$objWriter->writeAttribute('man', '1');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
@ -932,15 +936,15 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
// Second, write column breaks
|
||||
if (!empty($aColumnBreaks)) {
|
||||
$objWriter->startElement('colBreaks');
|
||||
$objWriter->writeAttribute('count', count($aColumnBreaks));
|
||||
$objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks));
|
||||
$objWriter->writeAttribute('count', count($aColumnBreaks));
|
||||
$objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks));
|
||||
|
||||
foreach ($aColumnBreaks as $cell) {
|
||||
$coords = PHPExcel_Cell::coordinateFromString($cell);
|
||||
|
||||
$objWriter->startElement('brk');
|
||||
$objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1);
|
||||
$objWriter->writeAttribute('man', '1');
|
||||
$objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1);
|
||||
$objWriter->writeAttribute('man', '1');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
@ -965,77 +969,72 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
// sheetData
|
||||
$objWriter->startElement('sheetData');
|
||||
|
||||
// Get column count
|
||||
$colCount = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn());
|
||||
// Get column count
|
||||
$colCount = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn());
|
||||
|
||||
// Highest row number
|
||||
$highestRow = $pSheet->getHighestRow();
|
||||
// Highest row number
|
||||
$highestRow = $pSheet->getHighestRow();
|
||||
|
||||
// Loop through cells
|
||||
$cellsByRow = array();
|
||||
foreach ($pSheet->getCellCollection() as $cellID) {
|
||||
$cellAddress = PHPExcel_Cell::coordinateFromString($cellID);
|
||||
$cellsByRow[$cellAddress[1]][] = $cellID;
|
||||
}
|
||||
// Loop through cells
|
||||
$cellsByRow = array();
|
||||
foreach ($pSheet->getCellCollection() as $cellID) {
|
||||
$cellAddress = PHPExcel_Cell::coordinateFromString($cellID);
|
||||
$cellsByRow[$cellAddress[1]][] = $cellID;
|
||||
}
|
||||
|
||||
$currentRow = 0;
|
||||
while($currentRow++ < $highestRow) {
|
||||
// Get row dimension
|
||||
$rowDimension = $pSheet->getRowDimension($currentRow);
|
||||
$currentRow = 0;
|
||||
while ($currentRow++ < $highestRow) {
|
||||
// Get row dimension
|
||||
$rowDimension = $pSheet->getRowDimension($currentRow);
|
||||
|
||||
// Write current row?
|
||||
$writeCurrentRow = isset($cellsByRow[$currentRow]) ||
|
||||
$rowDimension->getRowHeight() >= 0 ||
|
||||
$rowDimension->getVisible() == false ||
|
||||
$rowDimension->getCollapsed() == true ||
|
||||
$rowDimension->getOutlineLevel() > 0 ||
|
||||
$rowDimension->getXfIndex() !== null;
|
||||
// Write current row?
|
||||
$writeCurrentRow = isset($cellsByRow[$currentRow]) || $rowDimension->getRowHeight() >= 0 || $rowDimension->getVisible() == false || $rowDimension->getCollapsed() == true || $rowDimension->getOutlineLevel() > 0 || $rowDimension->getXfIndex() !== null;
|
||||
|
||||
if ($writeCurrentRow) {
|
||||
// Start a new row
|
||||
$objWriter->startElement('row');
|
||||
$objWriter->writeAttribute('r', $currentRow);
|
||||
$objWriter->writeAttribute('spans', '1:' . $colCount);
|
||||
if ($writeCurrentRow) {
|
||||
// Start a new row
|
||||
$objWriter->startElement('row');
|
||||
$objWriter->writeAttribute('r', $currentRow);
|
||||
$objWriter->writeAttribute('spans', '1:' . $colCount);
|
||||
|
||||
// Row dimensions
|
||||
if ($rowDimension->getRowHeight() >= 0) {
|
||||
$objWriter->writeAttribute('customHeight', '1');
|
||||
$objWriter->writeAttribute('ht', PHPExcel_Shared_String::FormatNumber($rowDimension->getRowHeight()));
|
||||
}
|
||||
|
||||
// Row visibility
|
||||
if ($rowDimension->getVisible() == false) {
|
||||
$objWriter->writeAttribute('hidden', 'true');
|
||||
}
|
||||
|
||||
// Collapsed
|
||||
if ($rowDimension->getCollapsed() == true) {
|
||||
$objWriter->writeAttribute('collapsed', 'true');
|
||||
}
|
||||
|
||||
// Outline level
|
||||
if ($rowDimension->getOutlineLevel() > 0) {
|
||||
$objWriter->writeAttribute('outlineLevel', $rowDimension->getOutlineLevel());
|
||||
}
|
||||
|
||||
// Style
|
||||
if ($rowDimension->getXfIndex() !== null) {
|
||||
$objWriter->writeAttribute('s', $rowDimension->getXfIndex());
|
||||
$objWriter->writeAttribute('customFormat', '1');
|
||||
}
|
||||
|
||||
// Write cells
|
||||
if (isset($cellsByRow[$currentRow])) {
|
||||
foreach($cellsByRow[$currentRow] as $cellAddress) {
|
||||
// Write cell
|
||||
$this->_writeCell($objWriter, $pSheet, $cellAddress, $pStringTable, $aFlippedStringTable);
|
||||
}
|
||||
}
|
||||
|
||||
// End row
|
||||
$objWriter->endElement();
|
||||
// Row dimensions
|
||||
if ($rowDimension->getRowHeight() >= 0) {
|
||||
$objWriter->writeAttribute('customHeight', '1');
|
||||
$objWriter->writeAttribute('ht', PHPExcel_Shared_String::FormatNumber($rowDimension->getRowHeight()));
|
||||
}
|
||||
|
||||
// Row visibility
|
||||
if ($rowDimension->getVisible() == false) {
|
||||
$objWriter->writeAttribute('hidden', 'true');
|
||||
}
|
||||
|
||||
// Collapsed
|
||||
if ($rowDimension->getCollapsed() == true) {
|
||||
$objWriter->writeAttribute('collapsed', 'true');
|
||||
}
|
||||
|
||||
// Outline level
|
||||
if ($rowDimension->getOutlineLevel() > 0) {
|
||||
$objWriter->writeAttribute('outlineLevel', $rowDimension->getOutlineLevel());
|
||||
}
|
||||
|
||||
// Style
|
||||
if ($rowDimension->getXfIndex() !== null) {
|
||||
$objWriter->writeAttribute('s', $rowDimension->getXfIndex());
|
||||
$objWriter->writeAttribute('customFormat', '1');
|
||||
}
|
||||
|
||||
// Write cells
|
||||
if (isset($cellsByRow[$currentRow])) {
|
||||
foreach ($cellsByRow[$currentRow] as $cellAddress) {
|
||||
// Write cell
|
||||
$this->_writeCell($objWriter, $pSheet, $cellAddress, $pStringTable, $aFlippedStringTable);
|
||||
}
|
||||
}
|
||||
|
||||
// End row
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
} else {
|
||||
@ -1095,7 +1094,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
switch (strtolower($mappedType)) {
|
||||
case 'inlinestr': // Inline string
|
||||
if (! $cellValue instanceof PHPExcel_RichText) {
|
||||
$objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML( htmlspecialchars($cellValue) ) );
|
||||
$objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue)));
|
||||
} else if ($cellValue instanceof PHPExcel_RichText) {
|
||||
$objWriter->startElement('is');
|
||||
$this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue);
|
||||
@ -1115,7 +1114,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
break;
|
||||
case 'f': // Formula
|
||||
$attributes = $pCell->getFormulaAttributes();
|
||||
if($attributes['t'] == 'array') {
|
||||
if ($attributes['t'] == 'array') {
|
||||
$objWriter->startElement('f');
|
||||
$objWriter->writeAttribute('t', 'array');
|
||||
$objWriter->writeAttribute('ref', $pCellAddress);
|
||||
@ -1172,7 +1171,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
* @param boolean $includeCharts Flag indicating if we should include drawing details for charts
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
private function _writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = FALSE)
|
||||
private function _writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = false)
|
||||
{
|
||||
$chartCount = ($includeCharts) ? $pSheet->getChartCollection()->count() : 0;
|
||||
// If sheet contains drawings, add the relationships
|
||||
|
@ -333,7 +333,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$iNumColEnd = $rangeBounds[1][0];
|
||||
|
||||
$iInc = $iNumColStart;
|
||||
while($iInc <= $iNumColEnd) {
|
||||
while ($iInc <= $iNumColEnd) {
|
||||
++$countShapes[$sheetIndex];
|
||||
|
||||
// create an Drawing Object for the dropdown
|
||||
@ -467,7 +467,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
case 1: // GIF, not supported by BIFF8, we convert to PNG
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||
ob_start();
|
||||
imagepng(imagecreatefromgif ($filename));
|
||||
imagepng(imagecreatefromgif($filename));
|
||||
$blipData = ob_get_contents();
|
||||
ob_end_clean();
|
||||
break;
|
||||
@ -679,21 +679,18 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
} elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
|
||||
} elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
|
||||
if ($dataProp['data']['data'] == false) {
|
||||
$dataSection_Content .= pack('V', 0x0000);
|
||||
} else {
|
||||
$dataSection_Content .= pack('V', 0x0001);
|
||||
}
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
} elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
// Null-terminated string
|
||||
$dataProp['data']['data'] .= chr(0);
|
||||
$dataProp['data']['length'] += 1;
|
||||
@ -705,13 +702,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
} elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 8;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Data Type Not Used at the moment
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
@ -867,13 +862,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
} elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
} elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
// Null-terminated string
|
||||
$dataProp['data']['data'] .= chr(0);
|
||||
$dataProp['data']['length'] += 1;
|
||||
@ -885,13 +878,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
} elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 8;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Data Type Not Used at the moment
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,8 @@ class PHPExcel_Writer_Excel5_Escher
|
||||
|
||||
// dgg data
|
||||
$dggData =
|
||||
pack('VVVV',
|
||||
pack(
|
||||
'VVVV',
|
||||
$this->_object->getSpIdMax(), // maximum shape identifier increased by one
|
||||
$this->_object->getCDgSaved() + 1, // number of file identifier clusters increased by one
|
||||
$this->_object->getCSpSaved(),
|
||||
@ -187,7 +188,7 @@ class PHPExcel_Writer_Excel5_Escher
|
||||
$btMacOS = $this->_object->getBlipType();
|
||||
$data .= pack('CC', $btWin32, $btMacOS);
|
||||
|
||||
$rgbUid = pack('VVVV', 0,0,0,0); // todo
|
||||
$rgbUid = pack('VVVV', 0, 0, 0, 0); // todo
|
||||
$data .= $rgbUid;
|
||||
|
||||
$tag = 0;
|
||||
@ -226,7 +227,7 @@ class PHPExcel_Writer_Excel5_Escher
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
|
||||
$rgbUid1 = pack('VVVV', 0, 0, 0, 0); // todo
|
||||
$innerData .= $rgbUid1;
|
||||
|
||||
$tag = 0xFF; // todo
|
||||
@ -253,7 +254,7 @@ class PHPExcel_Writer_Excel5_Escher
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
|
||||
$rgbUid1 = pack('VVVV', 0, 0, 0, 0); // todo
|
||||
$innerData .= $rgbUid1;
|
||||
|
||||
$tag = 0xFF; // todo
|
||||
@ -387,7 +388,7 @@ class PHPExcel_Writer_Excel5_Escher
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$data .= $header . pack('VVVV', 0,0,0,0);
|
||||
$data .= $header . pack('VVVV', 0, 0, 0, 0);
|
||||
}
|
||||
$this->_spTypes[] = ($this->_object->getSpType());
|
||||
|
||||
|
@ -1097,7 +1097,7 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
*/
|
||||
private function _match($token)
|
||||
{
|
||||
switch($token) {
|
||||
switch ($token) {
|
||||
case "+":
|
||||
case "-":
|
||||
case "*":
|
||||
@ -1130,60 +1130,39 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
break;
|
||||
default:
|
||||
// if it's a reference A1 or $A$1 or $A1 or A$1
|
||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and
|
||||
!preg_match("/[0-9]/", $this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.') and
|
||||
($this->_lookahead != '!')) {
|
||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.') and ($this->_lookahead != '!')) {
|
||||
return $token;
|
||||
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
||||
return $token;
|
||||
}
|
||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
|
||||
!preg_match("/[0-9]/", $this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
||||
return $token;
|
||||
}
|
||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
|
||||
!preg_match("/[0-9]/", $this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
||||
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->_lookahead)) {
|
||||
// if it's a range A1:A2 or $A$1:$A$2
|
||||
return $token;
|
||||
}
|
||||
// if it's a range A1:A2 or $A$1:$A$2
|
||||
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) and
|
||||
!preg_match("/[0-9]/", $this->_lookahead)) {
|
||||
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead)) {
|
||||
// If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
|
||||
return $token;
|
||||
}
|
||||
// If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
|
||||
!preg_match("/[0-9]/", $this->_lookahead)) {
|
||||
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead)) {
|
||||
// If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
|
||||
return $token;
|
||||
}
|
||||
// If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
|
||||
!preg_match("/[0-9]/", $this->_lookahead)) {
|
||||
} elseif (is_numeric($token) and (!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and ($this->_lookahead != '!') and ($this->_lookahead != ':')) {
|
||||
// If it's a number (check that it's not a sheet name or range)
|
||||
return $token;
|
||||
}
|
||||
// If it's a number (check that it's not a sheet name or range)
|
||||
elseif (is_numeric($token) and
|
||||
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
|
||||
($this->_lookahead != '!') and ($this->_lookahead != ':')) {
|
||||
} elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
|
||||
// If it's a string (of maximum 255 characters)
|
||||
return $token;
|
||||
}
|
||||
// If it's a string (of maximum 255 characters)
|
||||
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
|
||||
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
|
||||
// If it's an error code
|
||||
return $token;
|
||||
}
|
||||
// If it's an error code
|
||||
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
|
||||
} elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
|
||||
// if it's a function call
|
||||
return $token;
|
||||
}
|
||||
// if it's a function call
|
||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
|
||||
return $token;
|
||||
}
|
||||
// It's an argument of some description (e.g. a named range),
|
||||
// precise nature yet to be determined
|
||||
elseif(substr($token,-1) == ')') {
|
||||
} elseif (substr($token, -1) == ')') {
|
||||
// It's an argument of some description (e.g. a named range),
|
||||
// precise nature yet to be determined
|
||||
return $token;
|
||||
}
|
||||
return '';
|
||||
@ -1266,7 +1245,10 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
// If it's a string return a string node
|
||||
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) {
|
||||
$tmp = str_replace('""', '"', $this->_current_token);
|
||||
if (($tmp == '"') || ($tmp == '')) $tmp = '""'; // Trap for "" that has been used for an empty string
|
||||
if (($tmp == '"') || ($tmp == '')) {
|
||||
// Trap for "" that has been used for an empty string
|
||||
$tmp = '""';
|
||||
}
|
||||
$result = $this->_createTree($tmp, '', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
@ -1375,38 +1357,33 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
return $result;
|
||||
}
|
||||
// if it's a reference
|
||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->_current_token))
|
||||
{
|
||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->_current_token)) {
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
}
|
||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
|
||||
{
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
}
|
||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
|
||||
{
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
}
|
||||
// if it's a range A1:B2 or $A$1:$B$2
|
||||
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
|
||||
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token))
|
||||
{
|
||||
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token)) {
|
||||
// must be an error?
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
}
|
||||
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
|
||||
{
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
|
||||
// must be an error?
|
||||
//$result = $this->_current_token;
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
@ -1414,8 +1391,7 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
return $result;
|
||||
}
|
||||
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
|
||||
{
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
|
||||
// must be an error?
|
||||
//$result = $this->_current_token;
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
@ -1423,9 +1399,8 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
return $result;
|
||||
}
|
||||
// If it's a number or a percent
|
||||
elseif (is_numeric($this->_current_token))
|
||||
{
|
||||
if($this->_lookahead == '%'){
|
||||
elseif (is_numeric($this->_current_token)) {
|
||||
if ($this->_lookahead == '%') {
|
||||
$result = $this->_createTree('ptgPercent', $this->_current_token, '');
|
||||
$this->_advance(); // Skip the percentage operator once we've pre-built that tree
|
||||
} else {
|
||||
@ -1435,8 +1410,7 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
return $result;
|
||||
}
|
||||
// if it's a function call
|
||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token))
|
||||
{
|
||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token)) {
|
||||
$result = $this->_func();
|
||||
return $result;
|
||||
}
|
||||
@ -1462,13 +1436,10 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
while ($this->_current_token != ')') {
|
||||
/**/
|
||||
if ($num_args > 0) {
|
||||
if ($this->_current_token == "," or
|
||||
$this->_current_token == ";")
|
||||
{
|
||||
if ($this->_current_token == "," || $this->_current_token == ";") {
|
||||
$this->_advance(); // eat the "," or ";"
|
||||
} else {
|
||||
throw new PHPExcel_Writer_Exception("Syntax error: comma expected in ".
|
||||
"function $function, arg #{$num_args}");
|
||||
throw new PHPExcel_Writer_Exception("Syntax error: comma expected in function $function, arg #{$num_args}");
|
||||
}
|
||||
$result2 = $this->_condition();
|
||||
$result = $this->_createTree('arg', $result, $result2);
|
||||
@ -1560,8 +1531,7 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
!preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and
|
||||
!preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/", $tree['value']) and
|
||||
!is_numeric($tree['value']) and
|
||||
!isset($this->ptg[$tree['value']]))
|
||||
{
|
||||
!isset($this->ptg[$tree['value']])) {
|
||||
// left subtree for a function is always an array.
|
||||
if ($tree['left'] != '') {
|
||||
$left_tree = $this->toReversePolish($tree['left']);
|
||||
|
@ -845,7 +845,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
||||
// option flags
|
||||
$options = ($isHidden ? 0x21 : 0x00);
|
||||
|
||||
$extra = pack('Cvvvvv',
|
||||
$extra = pack(
|
||||
'Cvvvvv',
|
||||
0x3B,
|
||||
$sheetIndex - 1,
|
||||
$rangeBounds[0][1] - 1,
|
||||
@ -906,7 +907,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
||||
$itabFirst = 0; // 1st displayed worksheet
|
||||
$itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio);
|
||||
$this->_append($header . $data);
|
||||
}
|
||||
@ -1275,7 +1276,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
||||
// Pack the RGB data
|
||||
foreach ($aref as $color) {
|
||||
foreach ($color as $byte) {
|
||||
$data .= pack("C",$byte);
|
||||
$data .= pack("C", $byte);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1590,7 +1590,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
||||
|
||||
// record data
|
||||
$recordData = pack(
|
||||
'vVVCVVvv',
|
||||
'vVVCVVvv',
|
||||
0x0867, // repeated record identifier
|
||||
0x0000, // not used
|
||||
0x0000, // not used
|
||||
@ -2736,7 +2736,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
||||
if ($spTypes[$i] == 0x00C9) {
|
||||
// Add ftCmo (common object data) subobject
|
||||
$objData .=
|
||||
pack('vvvvvVVV',
|
||||
pack(
|
||||
'vvvvvVVV',
|
||||
0x0015, // 0x0015 = ftCmo
|
||||
0x0012, // length of ftCmo data
|
||||
0x0014, // object type, 0x0014 = filter
|
||||
@ -2756,7 +2757,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
||||
} else {
|
||||
// Add ftCmo (common object data) subobject
|
||||
$objData .=
|
||||
pack('vvvvvVVV',
|
||||
pack(
|
||||
'vvvvvVVV',
|
||||
0x0015, // 0x0015 = ftCmo
|
||||
0x0012, // length of ftCmo data
|
||||
0x0008, // object type, 0x0008 = picture
|
||||
@ -2770,7 +2772,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
||||
|
||||
// ftEnd
|
||||
$objData .=
|
||||
pack('vv',
|
||||
pack(
|
||||
'vv',
|
||||
0x0000, // 0x0000 = ftEnd
|
||||
0x0000 // length of ftEnd data
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user