Conflicts:
	Classes/PHPExcel/Calculation.php
	Classes/PHPExcel/Cell.php
This commit is contained in:
MarkBaker 2015-05-13 17:02:34 +01:00
commit 7d9f45c176
74 changed files with 4170 additions and 4237 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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

View File

@ -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;
@ -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);
}

View File

@ -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;

View File

@ -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 />';

View File

@ -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

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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 ) );

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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 {

View File

@ -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;
}

View File

@ -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++;

View File

@ -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]);

View File

@ -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;

View File

@ -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];

View File

@ -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':

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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];

View File

@ -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;

View File

@ -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 (

View File

@ -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') {

View File

@ -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');

View File

@ -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);
}

View File

@ -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')) {

View File

@ -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

View File

@ -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) {

View File

@ -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()

View File

@ -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) {

View File

@ -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()

View File

@ -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) {

View File

@ -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 {

View File

@ -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));
}
}

View File

@ -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']

View File

@ -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;
}

View File

@ -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
}
}
}
}

View File

@ -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)) {

View File

@ -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,7 +339,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
$this->_path
. $this->_name
@ -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)) {

View File

@ -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,7 +181,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
$this->_renderingFunction
. $this->_mimeType

View File

@ -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)) {

View File

@ -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.');

View File

@ -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)) {

View File

@ -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.");
}
}
}

View File

@ -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();
@ -238,31 +239,29 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
$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));
}
}
@ -274,7 +273,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
$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) {
if ($customPropertiesPart !== null) {
$objZip->addFromString('docProps/custom.xml', $customPropertiesPart);
}
@ -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,7 +307,6 @@ 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));
@ -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;
}
}

View File

@ -32,9 +32,7 @@
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_Chart extends
PHPExcel_Writer_Excel2007_WriterPart {
class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart {
/**
* Write charts to XML format
*
@ -43,14 +41,11 @@ class PHPExcel_Writer_Excel2007_Chart extends
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeChart(PHPExcel_Chart $pChart = NULL) {
public function writeChart(PHPExcel_Chart $pChart = null) {
// Create XML writer
$objWriter = NULL;
if ($this->getParentWriter()
->getUseDiskCaching()
) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()
->getDiskCachingDirectory());
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
}
@ -86,17 +81,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->writeAttribute('val', 0);
$objWriter->endElement();
$this->_writePlotArea(
$pChart->getPlotArea(),
$pChart->getXAxisLabel(),
$pChart->getYAxisLabel(),
$objWriter,
$pChart->getWorksheet(),
$pChart->getChartAxisX(),
$pChart->getChartAxisY(),
$pChart->getMajorGridlines(),
$pChart->getMinorGridlines()
);
$this->_writePlotArea($pChart->getPlotArea(), $pChart->getXAxisLabel(), $pChart->getYAxisLabel(), $objWriter, $pChart->getWorksheet(), $pChart->getChartAxisX(), $pChart->getChartAxisY(), $pChart->getMajorGridlines(), $pChart->getMinorGridlines());
$this->_writeLegend($pChart->getLegend(), $objWriter);
@ -130,7 +115,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeTitle(PHPExcel_Chart_Title $title = NULL, $objWriter) {
private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) {
if (is_null($title)) {
return;
}
@ -151,16 +136,13 @@ class PHPExcel_Writer_Excel2007_Chart extends
if ((is_array($caption)) && (count($caption) > 0)) {
$caption = $caption[0];
}
$this->getParentWriter()
->getWriterPart('stringtable')
->writeRichTextForCharts($objWriter, $caption, 'a');
$this->getParentWriter()->getWriterPart('stringtable')->writeRichTextForCharts($objWriter, $caption, 'a');
$objWriter->endElement();
$objWriter->endElement();
$objWriter->endElement();
$layout = $title->getLayout();
$this->_writeLayout($layout, $objWriter);
$this->_writeLayout($title->getLayout(), $objWriter);
$objWriter->startElement('c:overlay');
$objWriter->writeAttribute('val', 0);
@ -177,7 +159,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeLegend(PHPExcel_Chart_Legend $legend = NULL, $objWriter) {
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) {
if (is_null($legend)) {
return;
}
@ -188,8 +170,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->writeAttribute('val', $legend->getPosition());
$objWriter->endElement();
$layout = $legend->getLayout();
$this->_writeLayout($layout, $objWriter);
$this->_writeLayout($legend->getLayout(), $objWriter);
$objWriter->startElement('c:overlay');
$objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0');
@ -232,16 +213,8 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea,
PHPExcel_Chart_Title $xAxisLabel = NULL,
PHPExcel_Chart_Title $yAxisLabel = NULL,
$objWriter,
PHPExcel_Worksheet $pSheet,
PHPExcel_Chart_Axis $xAxis,
PHPExcel_Chart_Axis $yAxis,
PHPExcel_Chart_GridLines $majorGridlines,
PHPExcel_Chart_GridLines $minorGridlines
) {
private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines )
{
if (is_null($plotArea)) {
return;
}
@ -255,7 +228,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$this->_writeLayout($layout, $objWriter);
$chartTypes = self::_getChartType($plotArea);
$catIsMultiLevelSeries = $valIsMultiLevelSeries = FALSE;
$catIsMultiLevelSeries = $valIsMultiLevelSeries = false;
$plotGroupingType = '';
foreach ($chartTypes as $chartType) {
$objWriter->startElement('c:' . $chartType);
@ -265,7 +238,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$plotGroup = $plotArea->getPlotGroupByIndex($i);
$groupType = $plotGroup->getPlotType();
if ($groupType == $chartType) {
$plotStyle = $plotGroup->getPlotStyle();
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_RADARCHART) {
$objWriter->startElement('c:radarStyle');
@ -289,24 +261,17 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->startElement('c:smooth');
$objWriter->writeAttribute('val', (integer) $plotGroup->getSmoothLine());
$objWriter->endElement();
} elseif (($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||
($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)
) {
} elseif (($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) {
$objWriter->startElement('c:gapWidth');
$objWriter->writeAttribute('val', 150);
$objWriter->endElement();
if ($plotGroupingType == 'percentStacked' ||
$plotGroupingType == 'stacked'
) {
if ($plotGroupingType == 'percentStacked' || $plotGroupingType == 'stacked') {
$objWriter->startElement('c:overlap');
$objWriter->writeAttribute('val', 100);
$objWriter->endElement();
}
} elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$objWriter->startElement('c:bubbleScale');
$objWriter->writeAttribute('val', 25);
$objWriter->endElement();
@ -315,7 +280,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->writeAttribute('val', 0);
$objWriter->endElement();
} elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) {
$objWriter->startElement('c:hiLowLines');
$objWriter->endElement();
@ -342,11 +306,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$id1 = '75091328';
$id2 = '75089408';
if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) &&
($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) &&
($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
) {
if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
$objWriter->startElement('c:axId');
$objWriter->writeAttribute('val', $id1);
$objWriter->endElement();
@ -359,7 +319,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->endElement();
if ($chartType === PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) {
$objWriter->startElement('c:holeSize');
$objWriter->writeAttribute('val', 50);
$objWriter->endElement();
@ -369,11 +328,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->endElement();
}
if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) &&
($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) &&
($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
) {
if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
if ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$this->_writeValAx($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines);
} else {
@ -507,7 +462,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->endElement();
$objWriter->endElement();
}
$objWriter->startElement('c:numFmt');
@ -820,7 +774,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
if (!is_null($yAxisLabel)) {
$objWriter->startElement('c:title');
$objWriter->startElement('c:tx');
$objWriter->startElement('c:rich');
@ -1030,7 +983,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('minor_unit'));
$objWriter->endElement();
}
}
if ($isMultiLevelSeries) {
@ -1042,7 +994,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
$objWriter->endElement();
}
/**
@ -1053,20 +1004,15 @@ class PHPExcel_Writer_Excel2007_Chart extends
* @return string|array
* @throws PHPExcel_Writer_Exception
*/
private
static function _getChartType($plotArea) {
private static function _getChartType($plotArea) {
$groupCount = $plotArea->getPlotGroupCount();
if ($groupCount == 1) {
$chartType = array(
$plotArea->getPlotGroupByIndex(0)
->getPlotType()
);
$chartType = array($plotArea->getPlotGroupByIndex(0)->getPlotType());
} else {
$chartTypes = array();
for ($i = 0; $i < $groupCount; ++$i) {
$chartTypes[] = $plotArea->getPlotGroupByIndex($i)
->getPlotType();
$chartTypes[] = $plotArea->getPlotGroupByIndex($i)->getPlotType();
}
$chartType = array_unique($chartTypes);
if (count($chartTypes) == 0) {
@ -1090,21 +1036,12 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotGroup($plotGroup,
$groupType,
$objWriter,
&$catIsMultiLevelSeries,
&$valIsMultiLevelSeries,
&$plotGroupingType,
PHPExcel_Worksheet $pSheet
) {
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet ) {
if (is_null($plotGroup)) {
return;
}
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)
) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) {
$objWriter->startElement('c:barDir');
$objWriter->writeAttribute('val', $plotGroup->getPlotDirection());
$objWriter->endElement();
@ -1121,16 +1058,9 @@ class PHPExcel_Writer_Excel2007_Chart extends
$plotSeriesOrder = $plotGroup->getPlotOrder();
$plotSeriesCount = count($plotSeriesOrder);
if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_RADARCHART) &&
($groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)
) {
if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_RADARCHART) && ($groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) {
if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) ||
($plotSeriesCount > 1)
) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) || ($plotSeriesCount > 1)) {
$objWriter->startElement('c:varyColors');
$objWriter->writeAttribute('val', 1);
$objWriter->endElement();
@ -1153,11 +1083,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef);
$objWriter->endElement();
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
$objWriter->startElement('c:dPt');
$objWriter->startElement('c:idx');
$objWriter->writeAttribute('val', 3);
@ -1188,9 +1114,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
// Formatting for the points
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)
) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) {
$objWriter->startElement('c:spPr');
$objWriter->startElement('a:ln');
$objWriter->writeAttribute('w', 12700);
@ -1221,11 +1145,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
}
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||
($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) ||
($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART)
) {
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART)) {
$objWriter->startElement('c:invertIfNegative');
$objWriter->writeAttribute('val', 0);
$objWriter->endElement();
@ -1236,11 +1156,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
if ($plotSeriesCategory && ($plotSeriesCategory->getPointCount() > 0)) {
$catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory->isMultiLevelSeries();
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) ||
($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
) {
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
if (!is_null($plotGroup->getPlotStyle())) {
$plotStyle = $plotGroup->getPlotStyle();
if ($plotStyle) {
@ -1251,9 +1167,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
}
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) ||
($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)
) {
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
$objWriter->startElement('c:xVal');
} else {
$objWriter->startElement('c:cat');
@ -1267,9 +1181,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
if ($plotSeriesValues) {
$valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries();
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) ||
($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)
) {
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
$objWriter->startElement('c:yVal');
} else {
$objWriter->startElement('c:val');
@ -1284,7 +1196,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
}
$objWriter->endElement();
}
$this->_seriesIndex += $plotSeriesIdx + 1;
@ -1322,7 +1233,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->endElement();
}
$objWriter->endElement();
}
/**
@ -1336,12 +1246,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotSeriesValues($plotSeriesValues,
$objWriter,
$groupType,
$dataType = 'str',
PHPExcel_Worksheet $pSheet
) {
private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet) {
if (is_null($plotSeriesValues)) {
return;
}
@ -1391,14 +1296,8 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->startElement('c:' . $dataType . 'Cache');
if (($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART) &&
($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) &&
($groupType != PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
) {
if (($plotSeriesValues->getFormatCode() !== NULL) &&
($plotSeriesValues->getFormatCode() !== '')
) {
if (($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
if (($plotSeriesValues->getFormatCode() !== null) && ($plotSeriesValues->getFormatCode() !== '')) {
$objWriter->startElement('c:formatCode');
$objWriter->writeRawData($plotSeriesValues->getFormatCode());
$objWriter->endElement();
@ -1484,7 +1383,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeLayout(PHPExcel_Chart_Layout $layout = NULL, $objWriter) {
private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter) {
$objWriter->startElement('c:layout');
if (!is_null($layout)) {
@ -1602,5 +1501,4 @@ class PHPExcel_Writer_Excel2007_Chart extends
$objWriter->endElement();
}
}

View File

@ -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();

View File

@ -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');
}
}
@ -190,31 +156,25 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
if (!isset( $aMediaContentTypes[$extension]) ) {
$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())]);
}
}
}

View File

@ -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,7 +53,7 @@ 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');
@ -150,7 +150,7 @@ 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');
@ -222,7 +222,7 @@ 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');
@ -230,7 +230,7 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
foreach($customPropertyList as $key => $customProperty) {
foreach ($customPropertyList as $key => $customProperty) {
$propertyValue = $pPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
$propertyType = $pPHPExcel->getProperties()->getCustomPropertyType($customProperty);
@ -239,7 +239,7 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
$objWriter->writeAttribute('pid', $key+2);
$objWriter->writeAttribute('name', $customProperty);
switch($propertyType) {
switch ($propertyType) {
case 'i' :
$objWriter->writeElement('vt:i4', $propertyValue);
break;
@ -268,5 +268,4 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
// Return
return $objWriter->getData();
}
}

View File

@ -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();

View File

@ -53,7 +53,7 @@ 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');
@ -95,7 +95,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
'xl/workbook.xml'
);
// a custom UI in workbook ?
if($pPHPExcel->hasRibbon()){
if ($pPHPExcel->hasRibbon()) {
$this->_writeRelationShip(
$objWriter,
5,
@ -128,7 +128,7 @@ 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');
@ -170,7 +170,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
}
// Relationships for vbaProject if needed
// id : just after the last sheet
if($pPHPExcel->hasMacros()){
if ($pPHPExcel->hasMacros()) {
$this->_writeRelationShip(
$objWriter,
($i + 1 + 3),
@ -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,7 +210,7 @@ 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');
@ -238,7 +238,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
// $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,
@ -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,7 +319,7 @@ 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');
@ -383,7 +383,7 @@ 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');

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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,7 +104,7 @@ 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');
@ -116,7 +116,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
$objWriter->startElement('si');
if (! $textElement instanceof PHPExcel_RichText) {
$textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $textElement );
$textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML($textElement);
$objWriter->startElement('t');
if ($textToWrite !== trim($textToWrite)) {
$objWriter->writeAttribute('xml:space', 'preserve');
@ -147,10 +147,12 @@ 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) {
@ -214,7 +216,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
// t
$objWriter->startElement($prefix.'t');
$objWriter->writeAttribute('xml:space', 'preserve');
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() ));
$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,8 +239,10 @@ 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) {
@ -254,7 +258,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
$objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? 1 : 0));
// Underline
$underlineType = $element->getFont()->getUnderline();
switch($underlineType) {
switch ($underlineType) {
case 'single' :
$underlineType = 'sng';
break;
@ -287,7 +291,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
// t
$objWriter->startElement($prefix.'t');
// $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() ));
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($element->getText()));
$objWriter->endElement();
$objWriter->endElement();

View File

@ -53,7 +53,7 @@ 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');
@ -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);
}
@ -285,60 +285,60 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
// 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) {
if ($pFont->getBold() !== null) {
$objWriter->startElement('b');
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
$objWriter->endElement();
}
// Italic
if ($pFont->getItalic() !== NULL) {
if ($pFont->getItalic() !== null) {
$objWriter->startElement('i');
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
$objWriter->endElement();
}
// Strikethrough
if ($pFont->getStrikethrough() !== NULL) {
if ($pFont->getStrikethrough() !== null) {
$objWriter->startElement('strike');
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
$objWriter->endElement();
}
// Underline
if ($pFont->getUnderline() !== NULL) {
if ($pFont->getUnderline() !== null) {
$objWriter->startElement('u');
$objWriter->writeAttribute('val', $pFont->getUnderline());
$objWriter->endElement();
}
// Superscript / subscript
if ($pFont->getSuperScript() === TRUE || $pFont->getSubScript() === TRUE) {
if ($pFont->getSuperScript() === true || $pFont->getSubScript() === true) {
$objWriter->startElement('vertAlign');
if ($pFont->getSuperScript() === TRUE) {
if ($pFont->getSuperScript() === true) {
$objWriter->writeAttribute('val', 'superscript');
} else if ($pFont->getSubScript() === TRUE) {
} else if ($pFont->getSubScript() === true) {
$objWriter->writeAttribute('val', 'subscript');
}
$objWriter->endElement();
}
// Size
if ($pFont->getSize() !== NULL) {
if ($pFont->getSize() !== null) {
$objWriter->startElement('sz');
$objWriter->writeAttribute('val', $pFont->getSize());
$objWriter->endElement();
}
// Foreground color
if ($pFont->getColor()->getARGB() !== NULL) {
if ($pFont->getColor()->getARGB() !== null) {
$objWriter->startElement('color');
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
$objWriter->endElement();
}
// Name
if ($pFont->getName() !== NULL) {
if ($pFont->getName() !== null) {
$objWriter->startElement('name');
$objWriter->writeAttribute('val', $pFont->getName());
$objWriter->endElement();
@ -402,7 +402,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
}
if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) {
$objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164) );
$objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164));
} else {
$objWriter->writeAttribute('numFmtId', (int)$pStyle->getNumberFormat()->getBuiltInFormatCode());
}
@ -482,14 +482,14 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
// alignment
$objWriter->startElement('alignment');
if ($pStyle->getAlignment()->getHorizontal() !== NULL) {
if ($pStyle->getAlignment()->getHorizontal() !== null) {
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
}
if ($pStyle->getAlignment()->getVertical() !== NULL) {
if ($pStyle->getAlignment()->getVertical() !== null) {
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
}
if ($pStyle->getAlignment()->getTextRotation() !== NULL) {
if ($pStyle->getAlignment()->getTextRotation() !== null) {
$textRotation = 0;
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
$textRotation = $pStyle->getAlignment()->getTextRotation();
@ -504,16 +504,15 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
$this->_writeBorder($objWriter, $pStyle->getBorders());
// protection
if (($pStyle->getProtection()->getLocked() !== NULL) ||
($pStyle->getProtection()->getHidden() !== NULL)) {
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) &&
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) &&
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'));
}
@ -562,7 +561,7 @@ 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);
@ -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();
}
/**

View File

@ -147,7 +147,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
}
// XML header
$objWriter->startDocument('1.0','UTF-8','yes');
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
// a:theme
$objWriter->startElement('a:theme');
@ -839,13 +839,12 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->writeAttribute('typeface', '');
$objWriter->endElement();
foreach($fontSet as $fontScript => $typeface) {
foreach ($fontSet as $fontScript => $typeface) {
$objWriter->startElement('a:font');
$objWriter->writeAttribute('script', $fontScript);
$objWriter->writeAttribute('typeface', $typeface);
$objWriter->endElement();
}
}
/**
@ -857,7 +856,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
*/
private function _writeColourScheme($objWriter)
{
foreach(self::$_colourScheme as $colourName => $colourValue) {
foreach (self::$_colourScheme as $colourName => $colourValue) {
$objWriter->startElement('a:'.$colourName);
$objWriter->startElement('a:srgbClr');
@ -866,6 +865,5 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->endElement();
}
}
}

View File

@ -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');
@ -83,7 +83,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
$this->_writeDefinedNames($objWriter, $pPHPExcel);
// calcPr
$this->_writeCalcPr($objWriter,$recalcRequired);
$this->_writeCalcPr($objWriter, $recalcRequired);
$objWriter->endElement();
@ -190,7 +190,7 @@ 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');
@ -362,8 +362,8 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
$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]);

View File

@ -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,8 +148,8 @@ 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());
@ -205,16 +205,16 @@ 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');
@ -282,8 +282,12 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
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();
}
}
@ -327,7 +331,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// Set Zero Height row
if ((string)$pSheet->getDefaultRowDimension()->getZeroHeight() == '1' ||
strtolower((string)$pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true' ) {
strtolower((string)$pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true') {
$objWriter->writeAttribute('zeroHeight', '1');
}
@ -473,7 +477,7 @@ 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) {
@ -484,7 +488,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// cfRule
$objWriter->startElement('cfRule');
$objWriter->writeAttribute('type', $conditional->getConditionType());
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() ));
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
$objWriter->writeAttribute('priority', $id++);
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
@ -758,21 +762,21 @@ 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->startElement( $column->getFilterType());
$objWriter->startElement($column->getFilterType());
if ($column->getJoin() == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) {
$objWriter->writeAttribute('and', 1);
}
@ -783,18 +787,18 @@ 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'));
@ -808,7 +812,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
}
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
// Date Group filters
foreach($rule->getValue() as $key => $value) {
foreach ($rule->getValue() as $key => $value) {
if ($value > '') $objWriter->writeAttribute($key, $value);
}
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
@ -979,17 +983,12 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
}
$currentRow = 0;
while($currentRow++ < $highestRow) {
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;
$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
@ -1026,7 +1025,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// Write cells
if (isset($cellsByRow[$currentRow])) {
foreach($cellsByRow[$currentRow] as $cellAddress) {
foreach ($cellsByRow[$currentRow] as $cellAddress) {
// Write cell
$this->_writeCell($objWriter, $pSheet, $cellAddress, $pStringTable, $aFlippedStringTable);
}
@ -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

View File

@ -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
}
}

View File

@ -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());

View File

@ -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)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
return $token;
}
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)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
return $token;
}
} 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
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)) {
return $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", $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
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead)) {
return $token;
}
} 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
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead)) {
return $token;
}
} 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)
elseif (is_numeric($token) and
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
($this->_lookahead != '!') and ($this->_lookahead != ':')) {
return $token;
}
} elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
// If it's a string (of maximum 255 characters)
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
return $token;
}
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
// If it's an error code
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
return $token;
}
} elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
// if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
return $token;
}
} elseif (substr($token, -1) == ')') {
// It's an argument of some description (e.g. a named range),
// precise nature yet to be determined
elseif(substr($token,-1) == ')') {
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']);

View File

@ -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,
@ -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);
}
}

View File

@ -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
);