@@ -80,6 +80,8 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Create a new PHPExcel_Chart_DataSeriesValues object |
| 83 | + * @param string $dataType |
|
| 84 | + * @param string $dataSource |
|
| 83 | 85 | */ |
| 84 | 86 | public function __construct($dataType = null, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null) |
| 85 | 87 | { |
@@ -191,7 +193,7 @@ discard block |
||
| 191 | 193 | /** |
| 192 | 194 | * Identify if the Data Series is a multi-level or a simple series |
| 193 | 195 | * |
| 194 | - * @return boolean |
|
| 196 | + * @return boolean|null |
|
| 195 | 197 | */ |
| 196 | 198 | public function isMultiLevelSeries() { |
| 197 | 199 | if (count($this->_dataValues) > 0) { |
@@ -203,7 +205,7 @@ discard block |
||
| 203 | 205 | /** |
| 204 | 206 | * Return the level count of a multi-level Data Series |
| 205 | 207 | * |
| 206 | - * @return boolean |
|
| 208 | + * @return integer |
|
| 207 | 209 | */ |
| 208 | 210 | public function multiLevelCount() { |
| 209 | 211 | $levelCount = 0; |
@@ -258,12 +258,12 @@ |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | public function refresh(PHPExcel_Worksheet $worksheet) { |
| 261 | - if ($this->_dataSource !== NULL) { |
|
| 262 | - $calcEngine = PHPExcel_Calculation::getInstance(); |
|
| 261 | + if ($this->_dataSource !== NULL) { |
|
| 262 | + $calcEngine = PHPExcel_Calculation::getInstance(); |
|
| 263 | 263 | $this->_dataValues = PHPExcel_Calculation::_unwrapResult( |
| 264 | - $calcEngine->_calculateFormulaValue( |
|
| 265 | - $this->_dataSource |
|
| 266 | - ) |
|
| 264 | + $calcEngine->_calculateFormulaValue( |
|
| 265 | + $this->_dataSource |
|
| 266 | + ) |
|
| 267 | 267 | ); |
| 268 | 268 | } |
| 269 | 269 | } |
@@ -207,8 +207,8 @@ |
||
| 207 | 207 | */ |
| 208 | 208 | public function multiLevelCount() { |
| 209 | 209 | $levelCount = 0; |
| 210 | - foreach($this->_dataValues as $dataValueSet) { |
|
| 211 | - $levelCount = max($levelCount,count($dataValueSet)); |
|
| 210 | + foreach ($this->_dataValues as $dataValueSet) { |
|
| 211 | + $levelCount = max($levelCount, count($dataValueSet)); |
|
| 212 | 212 | } |
| 213 | 213 | return $levelCount; |
| 214 | 214 | } |
@@ -71,6 +71,9 @@ discard block |
||
| 71 | 71 | private static $_plotMark = 0; |
| 72 | 72 | |
| 73 | 73 | |
| 74 | + /** |
|
| 75 | + * @param string $markerID |
|
| 76 | + */ |
|
| 74 | 77 | private function _formatPointMarker($seriesPlot,$markerID) { |
| 75 | 78 | $plotMarkKeys = array_keys(self::$_markSet); |
| 76 | 79 | if (is_null($markerID)) { |
@@ -132,6 +135,9 @@ discard block |
||
| 132 | 135 | } // function _formatDataSetLabels() |
| 133 | 136 | |
| 134 | 137 | |
| 138 | + /** |
|
| 139 | + * @param integer $seriesCount |
|
| 140 | + */ |
|
| 135 | 141 | private function _percentageSumCalculation($groupID,$seriesCount) { |
| 136 | 142 | // Adjust our values to a percentage value across all series in the group |
| 137 | 143 | for($i = 0; $i < $seriesCount; ++$i) { |
@@ -162,6 +168,9 @@ discard block |
||
| 162 | 168 | } // function _percentageAdjustValues() |
| 163 | 169 | |
| 164 | 170 | |
| 171 | + /** |
|
| 172 | + * @param PHPExcel_Chart_Title $captionElement |
|
| 173 | + */ |
|
| 165 | 174 | private function _getCaption($captionElement) { |
| 166 | 175 | // Read any caption |
| 167 | 176 | $caption = (!is_null($captionElement)) ? $captionElement->getCaption() : NULL; |
@@ -263,6 +272,9 @@ discard block |
||
| 263 | 272 | } // function _renderRadarPlotArea() |
| 264 | 273 | |
| 265 | 274 | |
| 275 | + /** |
|
| 276 | + * @param integer $groupID |
|
| 277 | + */ |
|
| 266 | 278 | private function _renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d') { |
| 267 | 279 | $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); |
| 268 | 280 | |
@@ -325,6 +337,9 @@ discard block |
||
| 325 | 337 | } // function _renderPlotLine() |
| 326 | 338 | |
| 327 | 339 | |
| 340 | + /** |
|
| 341 | + * @param integer $groupID |
|
| 342 | + */ |
|
| 328 | 343 | private function _renderPlotBar($groupID, $dimensions = '2d') { |
| 329 | 344 | $rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection(); |
| 330 | 345 | // Rotate for bar rather than column chart |
@@ -409,6 +424,10 @@ discard block |
||
| 409 | 424 | } // function _renderPlotBar() |
| 410 | 425 | |
| 411 | 426 | |
| 427 | + /** |
|
| 428 | + * @param integer $groupID |
|
| 429 | + * @param boolean $bubble |
|
| 430 | + */ |
|
| 412 | 431 | private function _renderPlotScatter($groupID,$bubble) { |
| 413 | 432 | $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); |
| 414 | 433 | $scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); |
@@ -454,6 +473,9 @@ discard block |
||
| 454 | 473 | } // function _renderPlotScatter() |
| 455 | 474 | |
| 456 | 475 | |
| 476 | + /** |
|
| 477 | + * @param integer $groupID |
|
| 478 | + */ |
|
| 457 | 479 | private function _renderPlotRadar($groupID) { |
| 458 | 480 | $radarStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); |
| 459 | 481 | |
@@ -492,6 +514,9 @@ discard block |
||
| 492 | 514 | } // function _renderPlotRadar() |
| 493 | 515 | |
| 494 | 516 | |
| 517 | + /** |
|
| 518 | + * @param integer $groupID |
|
| 519 | + */ |
|
| 495 | 520 | private function _renderPlotContour($groupID) { |
| 496 | 521 | $contourStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); |
| 497 | 522 | |
@@ -512,6 +537,9 @@ discard block |
||
| 512 | 537 | } // function _renderPlotContour() |
| 513 | 538 | |
| 514 | 539 | |
| 540 | + /** |
|
| 541 | + * @param integer $groupID |
|
| 542 | + */ |
|
| 515 | 543 | private function _renderPlotStock($groupID) { |
| 516 | 544 | $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); |
| 517 | 545 | $plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder(); |
@@ -533,6 +561,9 @@ discard block |
||
| 533 | 561 | } // function _renderPlotStock() |
| 534 | 562 | |
| 535 | 563 | |
| 564 | + /** |
|
| 565 | + * @param integer $groupCount |
|
| 566 | + */ |
|
| 536 | 567 | private function _renderAreaChart($groupCount, $dimensions = '2d') { |
| 537 | 568 | require_once('jpgraph_line.php'); |
| 538 | 569 | |
@@ -544,6 +575,9 @@ discard block |
||
| 544 | 575 | } // function _renderAreaChart() |
| 545 | 576 | |
| 546 | 577 | |
| 578 | + /** |
|
| 579 | + * @param integer $groupCount |
|
| 580 | + */ |
|
| 547 | 581 | private function _renderLineChart($groupCount, $dimensions = '2d') { |
| 548 | 582 | require_once('jpgraph_line.php'); |
| 549 | 583 | |
@@ -555,6 +589,9 @@ discard block |
||
| 555 | 589 | } // function _renderLineChart() |
| 556 | 590 | |
| 557 | 591 | |
| 592 | + /** |
|
| 593 | + * @param integer $groupCount |
|
| 594 | + */ |
|
| 558 | 595 | private function _renderBarChart($groupCount, $dimensions = '2d') { |
| 559 | 596 | require_once('jpgraph_bar.php'); |
| 560 | 597 | |
@@ -566,6 +603,9 @@ discard block |
||
| 566 | 603 | } // function _renderBarChart() |
| 567 | 604 | |
| 568 | 605 | |
| 606 | + /** |
|
| 607 | + * @param integer $groupCount |
|
| 608 | + */ |
|
| 569 | 609 | private function _renderScatterChart($groupCount) { |
| 570 | 610 | require_once('jpgraph_scatter.php'); |
| 571 | 611 | require_once('jpgraph_regstat.php'); |
@@ -579,6 +619,9 @@ discard block |
||
| 579 | 619 | } // function _renderScatterChart() |
| 580 | 620 | |
| 581 | 621 | |
| 622 | + /** |
|
| 623 | + * @param integer $groupCount |
|
| 624 | + */ |
|
| 582 | 625 | private function _renderBubbleChart($groupCount) { |
| 583 | 626 | require_once('jpgraph_scatter.php'); |
| 584 | 627 | |
@@ -590,6 +633,9 @@ discard block |
||
| 590 | 633 | } // function _renderBubbleChart() |
| 591 | 634 | |
| 592 | 635 | |
| 636 | + /** |
|
| 637 | + * @param integer $groupCount |
|
| 638 | + */ |
|
| 593 | 639 | private function _renderPieChart($groupCount, $dimensions = '2d', $doughnut = False, $multiplePlots = False) { |
| 594 | 640 | require_once('jpgraph_pie.php'); |
| 595 | 641 | if ($dimensions == '3d') { |
@@ -663,6 +709,9 @@ discard block |
||
| 663 | 709 | } // function _renderPieChart() |
| 664 | 710 | |
| 665 | 711 | |
| 712 | + /** |
|
| 713 | + * @param integer $groupCount |
|
| 714 | + */ |
|
| 666 | 715 | private function _renderRadarChart($groupCount) { |
| 667 | 716 | require_once('jpgraph_radar.php'); |
| 668 | 717 | |
@@ -674,6 +723,9 @@ discard block |
||
| 674 | 723 | } // function _renderRadarChart() |
| 675 | 724 | |
| 676 | 725 | |
| 726 | + /** |
|
| 727 | + * @param integer $groupCount |
|
| 728 | + */ |
|
| 677 | 729 | private function _renderStockChart($groupCount) { |
| 678 | 730 | require_once('jpgraph_stock.php'); |
| 679 | 731 | |
@@ -685,6 +737,10 @@ discard block |
||
| 685 | 737 | } // function _renderStockChart() |
| 686 | 738 | |
| 687 | 739 | |
| 740 | + /** |
|
| 741 | + * @param integer $groupCount |
|
| 742 | + * @param string|null $dimensions |
|
| 743 | + */ |
|
| 688 | 744 | private function _renderContourChart($groupCount,$dimensions) { |
| 689 | 745 | require_once('jpgraph_contour.php'); |
| 690 | 746 | |
@@ -696,6 +752,9 @@ discard block |
||
| 696 | 752 | } // function _renderContourChart() |
| 697 | 753 | |
| 698 | 754 | |
| 755 | + /** |
|
| 756 | + * @param integer $groupCount |
|
| 757 | + */ |
|
| 699 | 758 | private function _renderCombinationChart($groupCount,$dimensions,$outputDestination) { |
| 700 | 759 | require_once('jpgraph_line.php'); |
| 701 | 760 | require_once('jpgraph_bar.php'); |
@@ -39,18 +39,18 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | class PHPExcel_Chart_Renderer_jpgraph |
| 41 | 41 | { |
| 42 | - private static $_width = 640; |
|
| 42 | + private static $_width = 640; |
|
| 43 | 43 | |
| 44 | - private static $_height = 480; |
|
| 44 | + private static $_height = 480; |
|
| 45 | 45 | |
| 46 | - private static $_colourSet = array( 'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1', |
|
| 47 | - 'darkmagenta', 'coral', 'dodgerblue3', 'eggplant', |
|
| 48 | - 'mediumblue', 'magenta', 'sandybrown', 'cyan', |
|
| 49 | - 'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen', |
|
| 46 | + private static $_colourSet = array('mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1', |
|
| 47 | + 'darkmagenta', 'coral', 'dodgerblue3', 'eggplant', |
|
| 48 | + 'mediumblue', 'magenta', 'sandybrown', 'cyan', |
|
| 49 | + 'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen', |
|
| 50 | 50 | 'goldenrod2' |
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | - private static $_markSet = array( 'diamond' => MARK_DIAMOND, |
|
| 53 | + private static $_markSet = array('diamond' => MARK_DIAMOND, |
|
| 54 | 54 | 'square' => MARK_SQUARE, |
| 55 | 55 | 'triangle' => MARK_UTRIANGLE, |
| 56 | 56 | 'x' => MARK_X, |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | private $_graph = null; |
| 68 | 68 | |
| 69 | - private static $_plotColour = 0; |
|
| 69 | + private static $_plotColour = 0; |
|
| 70 | 70 | |
| 71 | - private static $_plotMark = 0; |
|
| 71 | + private static $_plotMark = 0; |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | - private function _formatPointMarker($seriesPlot,$markerID) { |
|
| 74 | + private function _formatPointMarker($seriesPlot, $markerID) { |
|
| 75 | 75 | $plotMarkKeys = array_keys(self::$_markSet); |
| 76 | 76 | if (is_null($markerID)) { |
| 77 | 77 | // Use default plot marker (next marker in the series) |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | } // function _formatPointMarker() |
| 99 | 99 | |
| 100 | 100 | |
| 101 | - private function _formatDataSetLabels($groupID,$datasetLabels,$rotation = '') { |
|
| 101 | + private function _formatDataSetLabels($groupID, $datasetLabels, $rotation = '') { |
|
| 102 | 102 | $datasetLabelFormatCode = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode(); |
| 103 | - if (!is_null($datasetLabelFormatCode)) { |
|
| 103 | + if ( ! is_null($datasetLabelFormatCode)) { |
|
| 104 | 104 | // Retrieve any label formatting code |
| 105 | 105 | $datasetLabelFormatCode = stripslashes($datasetLabelFormatCode); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $testCurrentIndex = 0; |
| 109 | - foreach($datasetLabels as $i => $datasetLabel) { |
|
| 109 | + foreach ($datasetLabels as $i => $datasetLabel) { |
|
| 110 | 110 | // Fill in any missing values in the $datasetLabels array |
| 111 | 111 | while ($i != $testCurrentIndex) { |
| 112 | 112 | $datasetLabels[$testCurrentIndex] = ''; |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | if (is_array($datasetLabel)) { |
| 116 | 116 | if ($rotation == 'bar') { |
| 117 | 117 | $datasetLabel = array_reverse($datasetLabel); |
| 118 | - $datasetLabels[$i] = implode(" ",$datasetLabel); |
|
| 118 | + $datasetLabels[$i] = implode(" ", $datasetLabel); |
|
| 119 | 119 | } else { |
| 120 | - $datasetLabels[$i] = implode("\n",$datasetLabel); |
|
| 120 | + $datasetLabels[$i] = implode("\n", $datasetLabel); |
|
| 121 | 121 | } |
| 122 | 122 | } else { |
| 123 | 123 | // Format labels according to any formatting code |
| 124 | - if (!is_null($datasetLabelFormatCode)) { |
|
| 125 | - $datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel,$datasetLabelFormatCode); |
|
| 124 | + if ( ! is_null($datasetLabelFormatCode)) { |
|
| 125 | + $datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel, $datasetLabelFormatCode); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | ++$testCurrentIndex; |
@@ -132,14 +132,14 @@ discard block |
||
| 132 | 132 | } // function _formatDataSetLabels() |
| 133 | 133 | |
| 134 | 134 | |
| 135 | - private function _percentageSumCalculation($groupID,$seriesCount) { |
|
| 135 | + private function _percentageSumCalculation($groupID, $seriesCount) { |
|
| 136 | 136 | // Adjust our values to a percentage value across all series in the group |
| 137 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 137 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 138 | 138 | if ($i == 0) { |
| 139 | 139 | $sumValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 140 | 140 | } else { |
| 141 | 141 | $nextValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 142 | - foreach($nextValues as $k => $value) { |
|
| 142 | + foreach ($nextValues as $k => $value) { |
|
| 143 | 143 | if (isset($sumValues[$k])) { |
| 144 | 144 | $sumValues[$k] += $value; |
| 145 | 145 | } else { |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | } // function _percentageSumCalculation() |
| 154 | 154 | |
| 155 | 155 | |
| 156 | - private function _percentageAdjustValues($dataValues,$sumValues) { |
|
| 157 | - foreach($dataValues as $k => $dataValue) { |
|
| 156 | + private function _percentageAdjustValues($dataValues, $sumValues) { |
|
| 157 | + foreach ($dataValues as $k => $dataValue) { |
|
| 158 | 158 | $dataValues[$k] = $dataValue / $sumValues[$k] * 100; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | private function _getCaption($captionElement) { |
| 166 | 166 | // Read any caption |
| 167 | - $caption = (!is_null($captionElement)) ? $captionElement->getCaption() : NULL; |
|
| 167 | + $caption = ( ! is_null($captionElement)) ? $captionElement->getCaption() : NULL; |
|
| 168 | 168 | // Test if we have a title caption to display |
| 169 | - if (!is_null($caption)) { |
|
| 169 | + if ( ! is_null($caption)) { |
|
| 170 | 170 | // If we do, it could be a plain string or an array |
| 171 | 171 | if (is_array($caption)) { |
| 172 | 172 | // Implode an array to a plain string |
| 173 | - $caption = implode('',$caption); |
|
| 173 | + $caption = implode('', $caption); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | return $caption; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | private function _renderTitle() { |
| 181 | 181 | $title = $this->_getCaption($this->_chart->getTitle()); |
| 182 | - if (!is_null($title)) { |
|
| 182 | + if ( ! is_null($title)) { |
|
| 183 | 183 | $this->_graph->title->Set($title); |
| 184 | 184 | } |
| 185 | 185 | } // function _renderTitle() |
@@ -187,32 +187,32 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | private function _renderLegend() { |
| 189 | 189 | $legend = $this->_chart->getLegend(); |
| 190 | - if (!is_null($legend)) { |
|
| 190 | + if ( ! is_null($legend)) { |
|
| 191 | 191 | $legendPosition = $legend->getPosition(); |
| 192 | 192 | $legendOverlay = $legend->getOverlay(); |
| 193 | 193 | switch ($legendPosition) { |
| 194 | 194 | case 'r' : |
| 195 | - $this->_graph->legend->SetPos(0.01,0.5,'right','center'); // right |
|
| 195 | + $this->_graph->legend->SetPos(0.01, 0.5, 'right', 'center'); // right |
|
| 196 | 196 | break; |
| 197 | 197 | case 'l' : |
| 198 | - $this->_graph->legend->SetPos(0.01,0.5,'left','center'); // left |
|
| 198 | + $this->_graph->legend->SetPos(0.01, 0.5, 'left', 'center'); // left |
|
| 199 | 199 | break; |
| 200 | 200 | case 't' : |
| 201 | - $this->_graph->legend->SetPos(0.5,0.01,'center','top'); // top |
|
| 201 | + $this->_graph->legend->SetPos(0.5, 0.01, 'center', 'top'); // top |
|
| 202 | 202 | break; |
| 203 | 203 | case 'b' : |
| 204 | - $this->_graph->legend->SetPos(0.5,0.99,'center','bottom'); // bottom |
|
| 204 | + $this->_graph->legend->SetPos(0.5, 0.99, 'center', 'bottom'); // bottom |
|
| 205 | 205 | break; |
| 206 | 206 | default : |
| 207 | - $this->_graph->legend->SetPos(0.01,0.01,'right','top'); // top-right |
|
| 207 | + $this->_graph->legend->SetPos(0.01, 0.01, 'right', 'top'); // top-right |
|
| 208 | 208 | break; |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | } // function _renderLegend() |
| 212 | 212 | |
| 213 | 213 | |
| 214 | - private function _renderCartesianPlotArea($type='textlin') { |
|
| 215 | - $this->_graph = new Graph(self::$_width,self::$_height); |
|
| 214 | + private function _renderCartesianPlotArea($type = 'textlin') { |
|
| 215 | + $this->_graph = new Graph(self::$_width, self::$_height); |
|
| 216 | 216 | $this->_graph->SetScale($type); |
| 217 | 217 | |
| 218 | 218 | $this->_renderTitle(); |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | $reverse = ($rotation == 'bar') ? true : false; |
| 223 | 223 | |
| 224 | 224 | $xAxisLabel = $this->_chart->getXAxisLabel(); |
| 225 | - if (!is_null($xAxisLabel)) { |
|
| 225 | + if ( ! is_null($xAxisLabel)) { |
|
| 226 | 226 | $title = $this->_getCaption($xAxisLabel); |
| 227 | - if (!is_null($title)) { |
|
| 228 | - $this->_graph->xaxis->SetTitle($title,'center'); |
|
| 227 | + if ( ! is_null($title)) { |
|
| 228 | + $this->_graph->xaxis->SetTitle($title, 'center'); |
|
| 229 | 229 | $this->_graph->xaxis->title->SetMargin(35); |
| 230 | 230 | if ($reverse) { |
| 231 | 231 | $this->_graph->xaxis->title->SetAngle(90); |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $yAxisLabel = $this->_chart->getYAxisLabel(); |
| 238 | - if (!is_null($yAxisLabel)) { |
|
| 238 | + if ( ! is_null($yAxisLabel)) { |
|
| 239 | 239 | $title = $this->_getCaption($yAxisLabel); |
| 240 | - if (!is_null($title)) { |
|
| 241 | - $this->_graph->yaxis->SetTitle($title,'center'); |
|
| 240 | + if ( ! is_null($title)) { |
|
| 241 | + $this->_graph->yaxis->SetTitle($title, 'center'); |
|
| 242 | 242 | if ($reverse) { |
| 243 | 243 | $this->_graph->yaxis->title->SetAngle(0); |
| 244 | 244 | $this->_graph->yaxis->title->SetMargin(-55); |
@@ -249,14 +249,14 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | |
| 251 | 251 | private function _renderPiePlotArea($doughnut = False) { |
| 252 | - $this->_graph = new PieGraph(self::$_width,self::$_height); |
|
| 252 | + $this->_graph = new PieGraph(self::$_width, self::$_height); |
|
| 253 | 253 | |
| 254 | 254 | $this->_renderTitle(); |
| 255 | 255 | } // function _renderPiePlotArea() |
| 256 | 256 | |
| 257 | 257 | |
| 258 | 258 | private function _renderRadarPlotArea() { |
| 259 | - $this->_graph = new RadarGraph(self::$_width,self::$_height); |
|
| 259 | + $this->_graph = new RadarGraph(self::$_width, self::$_height); |
|
| 260 | 260 | $this->_graph->SetScale('lin'); |
| 261 | 261 | |
| 262 | 262 | $this->_renderTitle(); |
@@ -268,29 +268,29 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); |
| 270 | 270 | if (count($datasetLabels) > 0) { |
| 271 | - $datasetLabels = $this->_formatDataSetLabels($groupID,$datasetLabels); |
|
| 271 | + $datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels); |
|
| 272 | 272 | $this->_graph->xaxis->SetTickLabels($datasetLabels); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); |
| 276 | 276 | $seriesPlots = array(); |
| 277 | 277 | if ($grouping == 'percentStacked') { |
| 278 | - $sumValues = $this->_percentageSumCalculation($groupID,$seriesCount); |
|
| 278 | + $sumValues = $this->_percentageSumCalculation($groupID, $seriesCount); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Loop through each data series in turn |
| 282 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 282 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 283 | 283 | $dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 284 | 284 | $marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); |
| 285 | 285 | |
| 286 | 286 | if ($grouping == 'percentStacked') { |
| 287 | - $dataValues = $this->_percentageAdjustValues($dataValues,$sumValues); |
|
| 287 | + $dataValues = $this->_percentageAdjustValues($dataValues, $sumValues); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // Fill in any missing values in the $dataValues array |
| 291 | 291 | $testCurrentIndex = 0; |
| 292 | - foreach($dataValues as $k => $dataValue) { |
|
| 293 | - while($k != $testCurrentIndex) { |
|
| 292 | + foreach ($dataValues as $k => $dataValue) { |
|
| 293 | + while ($k != $testCurrentIndex) { |
|
| 294 | 294 | $dataValues[$testCurrentIndex] = null; |
| 295 | 295 | ++$testCurrentIndex; |
| 296 | 296 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | $seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]); |
| 309 | 309 | } else { |
| 310 | 310 | // Set the appropriate plot marker |
| 311 | - $this->_formatPointMarker($seriesPlot,$marker); |
|
| 311 | + $this->_formatPointMarker($seriesPlot, $marker); |
|
| 312 | 312 | } |
| 313 | 313 | $dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue(); |
| 314 | 314 | $seriesPlot->SetLegend($dataLabel); |
@@ -335,12 +335,12 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); |
| 337 | 337 | if (count($datasetLabels) > 0) { |
| 338 | - $datasetLabels = $this->_formatDataSetLabels($groupID,$datasetLabels,$rotation); |
|
| 338 | + $datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $rotation); |
|
| 339 | 339 | // Rotate for bar rather than column chart |
| 340 | 340 | if ($rotation == 'bar') { |
| 341 | 341 | $datasetLabels = array_reverse($datasetLabels); |
| 342 | 342 | $this->_graph->yaxis->SetPos('max'); |
| 343 | - $this->_graph->yaxis->SetLabelAlign('center','top'); |
|
| 343 | + $this->_graph->yaxis->SetLabelAlign('center', 'top'); |
|
| 344 | 344 | $this->_graph->yaxis->SetLabelSide(SIDE_RIGHT); |
| 345 | 345 | } |
| 346 | 346 | $this->_graph->xaxis->SetTickLabels($datasetLabels); |
@@ -350,20 +350,20 @@ discard block |
||
| 350 | 350 | $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); |
| 351 | 351 | $seriesPlots = array(); |
| 352 | 352 | if ($grouping == 'percentStacked') { |
| 353 | - $sumValues = $this->_percentageSumCalculation($groupID,$seriesCount); |
|
| 353 | + $sumValues = $this->_percentageSumCalculation($groupID, $seriesCount); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | // Loop through each data series in turn |
| 357 | - for($j = 0; $j < $seriesCount; ++$j) { |
|
| 357 | + for ($j = 0; $j < $seriesCount; ++$j) { |
|
| 358 | 358 | $dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues(); |
| 359 | 359 | if ($grouping == 'percentStacked') { |
| 360 | - $dataValues = $this->_percentageAdjustValues($dataValues,$sumValues); |
|
| 360 | + $dataValues = $this->_percentageAdjustValues($dataValues, $sumValues); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | // Fill in any missing values in the $dataValues array |
| 364 | 364 | $testCurrentIndex = 0; |
| 365 | - foreach($dataValues as $k => $dataValue) { |
|
| 366 | - while($k != $testCurrentIndex) { |
|
| 365 | + foreach ($dataValues as $k => $dataValue) { |
|
| 366 | + while ($k != $testCurrentIndex) { |
|
| 367 | 367 | $dataValues[$testCurrentIndex] = null; |
| 368 | 368 | ++$testCurrentIndex; |
| 369 | 369 | } |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | if ($dimensions == '3d') { |
| 381 | 381 | $seriesPlot->SetShadow(); |
| 382 | 382 | } |
| 383 | - if (!$this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) { |
|
| 383 | + if ( ! $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) { |
|
| 384 | 384 | $dataLabel = ''; |
| 385 | 385 | } else { |
| 386 | 386 | $dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue(); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | $seriesPlots[] = $seriesPlot; |
| 391 | 391 | } |
| 392 | 392 | // Reverse the plot order for bar rather than column chart |
| 393 | - if (($rotation == 'bar') && (!($grouping == 'percentStacked'))) { |
|
| 393 | + if (($rotation == 'bar') && ( ! ($grouping == 'percentStacked'))) { |
|
| 394 | 394 | $seriesPlots = array_reverse($seriesPlots); |
| 395 | 395 | } |
| 396 | 396 | |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | } // function _renderPlotBar() |
| 410 | 410 | |
| 411 | 411 | |
| 412 | - private function _renderPlotScatter($groupID,$bubble) { |
|
| 412 | + private function _renderPlotScatter($groupID, $bubble) { |
|
| 413 | 413 | $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); |
| 414 | 414 | $scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); |
| 415 | 415 | |
@@ -417,34 +417,34 @@ discard block |
||
| 417 | 417 | $seriesPlots = array(); |
| 418 | 418 | |
| 419 | 419 | // Loop through each data series in turn |
| 420 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 420 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 421 | 421 | $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); |
| 422 | 422 | $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 423 | 423 | |
| 424 | - foreach($dataValuesY as $k => $dataValueY) { |
|
| 424 | + foreach ($dataValuesY as $k => $dataValueY) { |
|
| 425 | 425 | $dataValuesY[$k] = $k; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - $seriesPlot = new ScatterPlot($dataValuesX,$dataValuesY); |
|
| 428 | + $seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY); |
|
| 429 | 429 | if ($scatterStyle == 'lineMarker') { |
| 430 | 430 | $seriesPlot->SetLinkPoints(); |
| 431 | 431 | $seriesPlot->link->SetColor(self::$_colourSet[self::$_plotColour]); |
| 432 | 432 | } elseif ($scatterStyle == 'smoothMarker') { |
| 433 | - $spline = new Spline($dataValuesY,$dataValuesX); |
|
| 434 | - list($splineDataY,$splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20); |
|
| 435 | - $lplot = new LinePlot($splineDataX,$splineDataY); |
|
| 433 | + $spline = new Spline($dataValuesY, $dataValuesX); |
|
| 434 | + list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20); |
|
| 435 | + $lplot = new LinePlot($splineDataX, $splineDataY); |
|
| 436 | 436 | $lplot->SetColor(self::$_colourSet[self::$_plotColour]); |
| 437 | 437 | |
| 438 | 438 | $this->_graph->Add($lplot); |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | if ($bubble) { |
| 442 | - $this->_formatPointMarker($seriesPlot,'dot'); |
|
| 442 | + $this->_formatPointMarker($seriesPlot, 'dot'); |
|
| 443 | 443 | $seriesPlot->mark->SetColor('black'); |
| 444 | 444 | $seriesPlot->mark->SetSize($bubbleSize); |
| 445 | 445 | } else { |
| 446 | 446 | $marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); |
| 447 | - $this->_formatPointMarker($seriesPlot,$marker); |
|
| 447 | + $this->_formatPointMarker($seriesPlot, $marker); |
|
| 448 | 448 | } |
| 449 | 449 | $dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue(); |
| 450 | 450 | $seriesPlot->SetLegend($dataLabel); |
@@ -461,14 +461,14 @@ discard block |
||
| 461 | 461 | $seriesPlots = array(); |
| 462 | 462 | |
| 463 | 463 | // Loop through each data series in turn |
| 464 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 464 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 465 | 465 | $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); |
| 466 | 466 | $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 467 | 467 | $marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); |
| 468 | 468 | |
| 469 | 469 | $dataValues = array(); |
| 470 | - foreach($dataValuesY as $k => $dataValueY) { |
|
| 471 | - $dataValues[$k] = implode(' ',array_reverse($dataValueY)); |
|
| 470 | + foreach ($dataValuesY as $k => $dataValueY) { |
|
| 471 | + $dataValues[$k] = implode(' ', array_reverse($dataValueY)); |
|
| 472 | 472 | } |
| 473 | 473 | $tmp = array_shift($dataValues); |
| 474 | 474 | $dataValues[] = $tmp; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | if ($radarStyle == 'filled') { |
| 485 | 485 | $seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour]); |
| 486 | 486 | } |
| 487 | - $this->_formatPointMarker($seriesPlot,$marker); |
|
| 487 | + $this->_formatPointMarker($seriesPlot, $marker); |
|
| 488 | 488 | $seriesPlot->SetLegend($dataLabel); |
| 489 | 489 | |
| 490 | 490 | $this->_graph->Add($seriesPlot); |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | |
| 501 | 501 | $dataValues = array(); |
| 502 | 502 | // Loop through each data series in turn |
| 503 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 503 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 504 | 504 | $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); |
| 505 | 505 | $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 506 | 506 | |
@@ -519,11 +519,11 @@ discard block |
||
| 519 | 519 | |
| 520 | 520 | $dataValues = array(); |
| 521 | 521 | // Loop through each data series in turn |
| 522 | - for($i = 0; $i < $seriesCount; ++$i) { |
|
| 522 | + for ($i = 0; $i < $seriesCount; ++$i) { |
|
| 523 | 523 | $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); |
| 524 | 524 | $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 525 | 525 | |
| 526 | - foreach($dataValuesX as $j => $dataValueX) |
|
| 526 | + foreach ($dataValuesX as $j => $dataValueX) |
|
| 527 | 527 | $dataValues[$j][$plotOrder[$i]] = $dataValueX; |
| 528 | 528 | } |
| 529 | 529 | |
@@ -538,8 +538,8 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | $this->_renderCartesianPlotArea(); |
| 540 | 540 | |
| 541 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 542 | - $this->_renderPlotLine($i,True,False,$dimensions); |
|
| 541 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 542 | + $this->_renderPlotLine($i, True, False, $dimensions); |
|
| 543 | 543 | } |
| 544 | 544 | } // function _renderAreaChart() |
| 545 | 545 | |
@@ -549,8 +549,8 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | $this->_renderCartesianPlotArea(); |
| 551 | 551 | |
| 552 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 553 | - $this->_renderPlotLine($i,False,False,$dimensions); |
|
| 552 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 553 | + $this->_renderPlotLine($i, False, False, $dimensions); |
|
| 554 | 554 | } |
| 555 | 555 | } // function _renderLineChart() |
| 556 | 556 | |
@@ -560,8 +560,8 @@ discard block |
||
| 560 | 560 | |
| 561 | 561 | $this->_renderCartesianPlotArea(); |
| 562 | 562 | |
| 563 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 564 | - $this->_renderPlotBar($i,$dimensions); |
|
| 563 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 564 | + $this->_renderPlotBar($i, $dimensions); |
|
| 565 | 565 | } |
| 566 | 566 | } // function _renderBarChart() |
| 567 | 567 | |
@@ -573,8 +573,8 @@ discard block |
||
| 573 | 573 | |
| 574 | 574 | $this->_renderCartesianPlotArea('linlin'); |
| 575 | 575 | |
| 576 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 577 | - $this->_renderPlotScatter($i,false); |
|
| 576 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 577 | + $this->_renderPlotScatter($i, false); |
|
| 578 | 578 | } |
| 579 | 579 | } // function _renderScatterChart() |
| 580 | 580 | |
@@ -584,8 +584,8 @@ discard block |
||
| 584 | 584 | |
| 585 | 585 | $this->_renderCartesianPlotArea('linlin'); |
| 586 | 586 | |
| 587 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 588 | - $this->_renderPlotScatter($i,true); |
|
| 587 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 588 | + $this->_renderPlotScatter($i, true); |
|
| 589 | 589 | } |
| 590 | 590 | } // function _renderBubbleChart() |
| 591 | 591 | |
@@ -599,13 +599,13 @@ discard block |
||
| 599 | 599 | $this->_renderPiePlotArea($doughnut); |
| 600 | 600 | |
| 601 | 601 | $iLimit = ($multiplePlots) ? $groupCount : 1; |
| 602 | - for($i = 0; $i < $iLimit; ++$i) { |
|
| 602 | + for ($i = 0; $i < $iLimit; ++$i) { |
|
| 603 | 603 | $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotGrouping(); |
| 604 | 604 | $exploded = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotStyle(); |
| 605 | 605 | if ($i == 0) { |
| 606 | 606 | $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotCategoryByIndex(0)->getDataValues(); |
| 607 | 607 | if (count($datasetLabels) > 0) { |
| 608 | - $datasetLabels = $this->_formatDataSetLabels($i,$datasetLabels); |
|
| 608 | + $datasetLabels = $this->_formatDataSetLabels($i, $datasetLabels); |
|
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | |
@@ -614,13 +614,13 @@ discard block |
||
| 614 | 614 | // For pie charts, we only display the first series: doughnut charts generally display all series |
| 615 | 615 | $jLimit = ($multiplePlots) ? $seriesCount : 1; |
| 616 | 616 | // Loop through each data series in turn |
| 617 | - for($j = 0; $j < $jLimit; ++$j) { |
|
| 617 | + for ($j = 0; $j < $jLimit; ++$j) { |
|
| 618 | 618 | $dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotValuesByIndex($j)->getDataValues(); |
| 619 | 619 | |
| 620 | 620 | // Fill in any missing values in the $dataValues array |
| 621 | 621 | $testCurrentIndex = 0; |
| 622 | - foreach($dataValues as $k => $dataValue) { |
|
| 623 | - while($k != $testCurrentIndex) { |
|
| 622 | + foreach ($dataValues as $k => $dataValue) { |
|
| 623 | + while ($k != $testCurrentIndex) { |
|
| 624 | 624 | $dataValues[$testCurrentIndex] = null; |
| 625 | 625 | ++$testCurrentIndex; |
| 626 | 626 | } |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | if ($multiplePlots) { |
| 641 | - $seriesPlot->SetSize(($jLimit-$j) / ($jLimit * 4)); |
|
| 641 | + $seriesPlot->SetSize(($jLimit - $j) / ($jLimit * 4)); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | if ($doughnut) { |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | $seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]); |
| 649 | - $seriesPlot->SetLabels(array_fill(0,count($datasetLabels),'')); |
|
| 649 | + $seriesPlot->SetLabels(array_fill(0, count($datasetLabels), '')); |
|
| 650 | 650 | if ($dimensions != '3d') { |
| 651 | 651 | $seriesPlot->SetGuideLines(false); |
| 652 | 652 | } |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | |
| 669 | 669 | $this->_renderRadarPlotArea(); |
| 670 | 670 | |
| 671 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 671 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 672 | 672 | $this->_renderPlotRadar($i); |
| 673 | 673 | } |
| 674 | 674 | } // function _renderRadarChart() |
@@ -679,24 +679,24 @@ discard block |
||
| 679 | 679 | |
| 680 | 680 | $this->_renderCartesianPlotArea(); |
| 681 | 681 | |
| 682 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 682 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 683 | 683 | $this->_renderPlotStock($i); |
| 684 | 684 | } |
| 685 | 685 | } // function _renderStockChart() |
| 686 | 686 | |
| 687 | 687 | |
| 688 | - private function _renderContourChart($groupCount,$dimensions) { |
|
| 688 | + private function _renderContourChart($groupCount, $dimensions) { |
|
| 689 | 689 | require_once('jpgraph_contour.php'); |
| 690 | 690 | |
| 691 | 691 | $this->_renderCartesianPlotArea('intint'); |
| 692 | 692 | |
| 693 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 693 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 694 | 694 | $this->_renderPlotContour($i); |
| 695 | 695 | } |
| 696 | 696 | } // function _renderContourChart() |
| 697 | 697 | |
| 698 | 698 | |
| 699 | - private function _renderCombinationChart($groupCount,$dimensions,$outputDestination) { |
|
| 699 | + private function _renderCombinationChart($groupCount, $dimensions, $outputDestination) { |
|
| 700 | 700 | require_once('jpgraph_line.php'); |
| 701 | 701 | require_once('jpgraph_bar.php'); |
| 702 | 702 | require_once('jpgraph_scatter.php'); |
@@ -705,30 +705,30 @@ discard block |
||
| 705 | 705 | |
| 706 | 706 | $this->_renderCartesianPlotArea(); |
| 707 | 707 | |
| 708 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 708 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 709 | 709 | $dimensions = null; |
| 710 | 710 | $chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); |
| 711 | 711 | switch ($chartType) { |
| 712 | 712 | case 'area3DChart' : |
| 713 | 713 | $dimensions = '3d'; |
| 714 | 714 | case 'areaChart' : |
| 715 | - $this->_renderPlotLine($i,True,True,$dimensions); |
|
| 715 | + $this->_renderPlotLine($i, True, True, $dimensions); |
|
| 716 | 716 | break; |
| 717 | 717 | case 'bar3DChart' : |
| 718 | 718 | $dimensions = '3d'; |
| 719 | 719 | case 'barChart' : |
| 720 | - $this->_renderPlotBar($i,$dimensions); |
|
| 720 | + $this->_renderPlotBar($i, $dimensions); |
|
| 721 | 721 | break; |
| 722 | 722 | case 'line3DChart' : |
| 723 | 723 | $dimensions = '3d'; |
| 724 | 724 | case 'lineChart' : |
| 725 | - $this->_renderPlotLine($i,False,True,$dimensions); |
|
| 725 | + $this->_renderPlotLine($i, False, True, $dimensions); |
|
| 726 | 726 | break; |
| 727 | 727 | case 'scatterChart' : |
| 728 | - $this->_renderPlotScatter($i,false); |
|
| 728 | + $this->_renderPlotScatter($i, false); |
|
| 729 | 729 | break; |
| 730 | 730 | case 'bubbleChart' : |
| 731 | - $this->_renderPlotScatter($i,true); |
|
| 731 | + $this->_renderPlotScatter($i, true); |
|
| 732 | 732 | break; |
| 733 | 733 | default : |
| 734 | 734 | $this->_graph = null; |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | $chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); |
| 752 | 752 | } else { |
| 753 | 753 | $chartTypes = array(); |
| 754 | - for($i = 0; $i < $groupCount; ++$i) { |
|
| 754 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 755 | 755 | $chartTypes[] = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); |
| 756 | 756 | } |
| 757 | 757 | $chartTypes = array_unique($chartTypes); |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | echo 'Chart is not yet implemented<br />'; |
| 762 | 762 | return false; |
| 763 | 763 | } else { |
| 764 | - return $this->_renderCombinationChart($groupCount,$dimensions,$outputDestination); |
|
| 764 | + return $this->_renderCombinationChart($groupCount, $dimensions, $outputDestination); |
|
| 765 | 765 | } |
| 766 | 766 | } |
| 767 | 767 | |
@@ -769,27 +769,27 @@ discard block |
||
| 769 | 769 | case 'area3DChart' : |
| 770 | 770 | $dimensions = '3d'; |
| 771 | 771 | case 'areaChart' : |
| 772 | - $this->_renderAreaChart($groupCount,$dimensions); |
|
| 772 | + $this->_renderAreaChart($groupCount, $dimensions); |
|
| 773 | 773 | break; |
| 774 | 774 | case 'bar3DChart' : |
| 775 | 775 | $dimensions = '3d'; |
| 776 | 776 | case 'barChart' : |
| 777 | - $this->_renderBarChart($groupCount,$dimensions); |
|
| 777 | + $this->_renderBarChart($groupCount, $dimensions); |
|
| 778 | 778 | break; |
| 779 | 779 | case 'line3DChart' : |
| 780 | 780 | $dimensions = '3d'; |
| 781 | 781 | case 'lineChart' : |
| 782 | - $this->_renderLineChart($groupCount,$dimensions); |
|
| 782 | + $this->_renderLineChart($groupCount, $dimensions); |
|
| 783 | 783 | break; |
| 784 | 784 | case 'pie3DChart' : |
| 785 | 785 | $dimensions = '3d'; |
| 786 | 786 | case 'pieChart' : |
| 787 | - $this->_renderPieChart($groupCount,$dimensions,False,False); |
|
| 787 | + $this->_renderPieChart($groupCount, $dimensions, False, False); |
|
| 788 | 788 | break; |
| 789 | 789 | case 'doughnut3DChart' : |
| 790 | 790 | $dimensions = '3d'; |
| 791 | 791 | case 'doughnutChart' : |
| 792 | - $this->_renderPieChart($groupCount,$dimensions,True,True); |
|
| 792 | + $this->_renderPieChart($groupCount, $dimensions, True, True); |
|
| 793 | 793 | break; |
| 794 | 794 | case 'scatterChart' : |
| 795 | 795 | $this->_renderScatterChart($groupCount); |
@@ -803,10 +803,10 @@ discard block |
||
| 803 | 803 | case 'surface3DChart' : |
| 804 | 804 | $dimensions = '3d'; |
| 805 | 805 | case 'surfaceChart' : |
| 806 | - $this->_renderContourChart($groupCount,$dimensions); |
|
| 806 | + $this->_renderContourChart($groupCount, $dimensions); |
|
| 807 | 807 | break; |
| 808 | 808 | case 'stockChart' : |
| 809 | - $this->_renderStockChart($groupCount,$dimensions); |
|
| 809 | + $this->_renderStockChart($groupCount, $dimensions); |
|
| 810 | 810 | break; |
| 811 | 811 | default : |
| 812 | 812 | echo $chartType.' is not yet implemented<br />'; |
@@ -523,8 +523,9 @@ |
||
| 523 | 523 | $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); |
| 524 | 524 | $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); |
| 525 | 525 | |
| 526 | - foreach($dataValuesX as $j => $dataValueX) |
|
| 527 | - $dataValues[$j][$plotOrder[$i]] = $dataValueX; |
|
| 526 | + foreach($dataValuesX as $j => $dataValueX) { |
|
| 527 | + $dataValues[$j][$plotOrder[$i]] = $dataValueX; |
|
| 528 | + } |
|
| 528 | 529 | } |
| 529 | 530 | |
| 530 | 531 | $seriesPlot = new StockPlot($dataValues); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * |
| 185 | 185 | * @static |
| 186 | 186 | * @access public |
| 187 | - * @param string $pFileName |
|
| 187 | + * @param string $pFilename |
|
| 188 | 188 | * @return PHPExcel |
| 189 | 189 | * @throws Exception |
| 190 | 190 | */ |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * |
| 199 | 199 | * @static |
| 200 | 200 | * @access public |
| 201 | - * @param string $pFileName |
|
| 201 | + * @param string $pFilename |
|
| 202 | 202 | * @return string |
| 203 | 203 | * @throws Exception |
| 204 | 204 | */ |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * |
| 216 | 216 | * @static |
| 217 | 217 | * @access public |
| 218 | - * @param string $pFileName |
|
| 218 | + * @param string $pFilename |
|
| 219 | 219 | * @return PHPExcel_Reader_IReader |
| 220 | 220 | * @throws Exception |
| 221 | 221 | */ |
@@ -73,18 +73,18 @@ |
||
| 73 | 73 | 'CSV', |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Private constructor for PHPExcel_IOFactory |
|
| 78 | - */ |
|
| 79 | - private function __construct() { } |
|
| 76 | + /** |
|
| 77 | + * Private constructor for PHPExcel_IOFactory |
|
| 78 | + */ |
|
| 79 | + private function __construct() { } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Get search locations |
|
| 83 | - * |
|
| 81 | + /** |
|
| 82 | + * Get search locations |
|
| 83 | + * |
|
| 84 | 84 | * @static |
| 85 | 85 | * @access public |
| 86 | - * @return array |
|
| 87 | - */ |
|
| 86 | + * @return array |
|
| 87 | + */ |
|
| 88 | 88 | public static function getSearchLocations() { |
| 89 | 89 | return self::$_searchLocations; |
| 90 | 90 | } // function getSearchLocations() |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | /** PHPExcel root directory */ |
| 30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
| 30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
| 31 | 31 | /** |
| 32 | 32 | * @ignore |
| 33 | 33 | */ |
| 34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); |
|
| 35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
| 34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../'); |
|
| 35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | * @static |
| 53 | 53 | */ |
| 54 | 54 | private static $_searchLocations = array( |
| 55 | - array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ), |
|
| 56 | - array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' ) |
|
| 55 | + array('type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}'), |
|
| 56 | + array('type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}') |
|
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param string $classname Example: PHPExcel_Writer_{0} |
| 116 | 116 | */ |
| 117 | 117 | public static function addSearchLocation($type = '', $location = '', $classname = '') { |
| 118 | - self::$_searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname ); |
|
| 118 | + self::$_searchLocations[] = array('type' => $type, 'path' => $location, 'class' => $classname); |
|
| 119 | 119 | } // function addSearchLocation() |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | public static function identify($pFilename) { |
| 206 | 206 | $reader = self::createReaderForFile($pFilename); |
| 207 | 207 | $className = get_class($reader); |
| 208 | - $classType = explode('_',$className); |
|
| 208 | + $classType = explode('_', $className); |
|
| 209 | 209 | unset($reader); |
| 210 | 210 | return array_pop($classType); |
| 211 | 211 | } // function identify() |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * Can the current PHPExcel_Reader_IReader read the file? |
| 123 | 123 | * |
| 124 | 124 | * @access public |
| 125 | - * @param string $pFileName |
|
| 125 | + * @param string $pFilename |
|
| 126 | 126 | * @return boolean |
| 127 | 127 | * @throws Exception |
| 128 | 128 | */ |
@@ -479,7 +479,6 @@ discard block |
||
| 479 | 479 | * Set Contiguous |
| 480 | 480 | * |
| 481 | 481 | * @access public |
| 482 | - * @param string $pValue Input encoding |
|
| 483 | 482 | */ |
| 484 | 483 | public function setContiguous($contiguous = false) |
| 485 | 484 | { |
@@ -496,7 +495,7 @@ discard block |
||
| 496 | 495 | * Get Contiguous |
| 497 | 496 | * |
| 498 | 497 | * @access public |
| 499 | - * @return boolean |
|
| 498 | + * @return integer |
|
| 500 | 499 | */ |
| 501 | 500 | public function getContiguous() { |
| 502 | 501 | return $this->_contiguous; |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | /** PHPExcel root directory */ |
| 30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
| 30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
| 31 | 31 | /** |
| 32 | 32 | * @ignore |
| 33 | 33 | */ |
| 34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
| 35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
| 34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
| 35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @access private |
| 51 | 51 | * @var string |
| 52 | 52 | */ |
| 53 | - private $_inputEncoding = 'UTF-8'; |
|
| 53 | + private $_inputEncoding = 'UTF-8'; |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * Delimiter |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * @access private |
| 59 | 59 | * @var string |
| 60 | 60 | */ |
| 61 | - private $_delimiter = ','; |
|
| 61 | + private $_delimiter = ','; |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * Enclosure |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @access private |
| 67 | 67 | * @var string |
| 68 | 68 | */ |
| 69 | - private $_enclosure = '"'; |
|
| 69 | + private $_enclosure = '"'; |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Line ending |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @access private |
| 75 | 75 | * @var string |
| 76 | 76 | */ |
| 77 | - private $_lineEnding = PHP_EOL; |
|
| 77 | + private $_lineEnding = PHP_EOL; |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Sheet index to read |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @access private |
| 83 | 83 | * @var int |
| 84 | 84 | */ |
| 85 | - private $_sheetIndex = 0; |
|
| 85 | + private $_sheetIndex = 0; |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * Load rows contiguously |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @access private |
| 91 | 91 | * @var int |
| 92 | 92 | */ |
| 93 | - private $_contiguous = false; |
|
| 93 | + private $_contiguous = false; |
|
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @access private |
| 100 | 100 | * @var int |
| 101 | 101 | */ |
| 102 | - private $_contiguousRow = -1; |
|
| 102 | + private $_contiguousRow = -1; |
|
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * PHPExcel_Reader_IReadFilter instance |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * Create a new PHPExcel_Reader_CSV |
| 115 | 115 | */ |
| 116 | 116 | public function __construct() { |
| 117 | - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
| 117 | + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
| 118 | 118 | } // function __construct() |
| 119 | 119 | |
| 120 | 120 | |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | public function canRead($pFilename) |
| 130 | 130 | { |
| 131 | 131 | // Check if file exists |
| 132 | - if (!file_exists($pFilename)) { |
|
| 133 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 132 | + if ( ! file_exists($pFilename)) { |
|
| 133 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | return true; |
@@ -195,14 +195,14 @@ discard block |
||
| 195 | 195 | public function listWorksheetInfo($pFilename) |
| 196 | 196 | { |
| 197 | 197 | // Check if file exists |
| 198 | - if (!file_exists($pFilename)) { |
|
| 199 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 198 | + if ( ! file_exists($pFilename)) { |
|
| 199 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | // Open file |
| 203 | 203 | $fileHandle = fopen($pFilename, 'r'); |
| 204 | 204 | if ($fileHandle === false) { |
| 205 | - throw new Exception("Could not open file " . $pFilename . " for reading."); |
|
| 205 | + throw new Exception("Could not open file ".$pFilename." for reading."); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // Skip BOM, if any |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | break; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - $escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure ); |
|
| 234 | + $escapeEnclosures = array("\\".$this->_enclosure, $this->_enclosure.$this->_enclosure); |
|
| 235 | 235 | |
| 236 | 236 | $worksheetInfo = array(); |
| 237 | 237 | $worksheetInfo[0]['worksheetName'] = 'Worksheet'; |
@@ -286,15 +286,15 @@ discard block |
||
| 286 | 286 | public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) |
| 287 | 287 | { |
| 288 | 288 | // Check if file exists |
| 289 | - if (!file_exists($pFilename)) { |
|
| 290 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 289 | + if ( ! file_exists($pFilename)) { |
|
| 290 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // Create new PHPExcel |
| 294 | 294 | while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { |
| 295 | 295 | $objPHPExcel->createSheet(); |
| 296 | 296 | } |
| 297 | - $sheet = $objPHPExcel->setActiveSheetIndex( $this->_sheetIndex ); |
|
| 297 | + $sheet = $objPHPExcel->setActiveSheetIndex($this->_sheetIndex); |
|
| 298 | 298 | |
| 299 | 299 | $lineEnding = ini_get('auto_detect_line_endings'); |
| 300 | 300 | ini_set('auto_detect_line_endings', true); |
@@ -331,20 +331,20 @@ discard block |
||
| 331 | 331 | break; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - $escapeEnclosures = array( "\\" . $this->_enclosure, |
|
| 335 | - $this->_enclosure . $this->_enclosure |
|
| 334 | + $escapeEnclosures = array("\\".$this->_enclosure, |
|
| 335 | + $this->_enclosure.$this->_enclosure |
|
| 336 | 336 | ); |
| 337 | 337 | |
| 338 | 338 | // Set our starting row based on whether we're in contiguous mode or not |
| 339 | 339 | $currentRow = 1; |
| 340 | 340 | if ($this->_contiguous) { |
| 341 | - $currentRow = ($this->_contiguousRow == -1) ? $sheet->getHighestRow(): $this->_contiguousRow; |
|
| 341 | + $currentRow = ($this->_contiguousRow == -1) ? $sheet->getHighestRow() : $this->_contiguousRow; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | // Loop through each line of the file in turn |
| 345 | 345 | while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) { |
| 346 | 346 | $columnLetter = 'A'; |
| 347 | - foreach($rowData as $rowDatum) { |
|
| 347 | + foreach ($rowData as $rowDatum) { |
|
| 348 | 348 | if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) { |
| 349 | 349 | // Unescape enclosures |
| 350 | 350 | $rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum); |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | // Set cell value |
| 358 | - $sheet->getCell($columnLetter . $currentRow)->setValue($rowDatum); |
|
| 358 | + $sheet->getCell($columnLetter.$currentRow)->setValue($rowDatum); |
|
| 359 | 359 | } |
| 360 | 360 | ++$columnLetter; |
| 361 | 361 | } |
@@ -483,9 +483,9 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | public function setContiguous($contiguous = false) |
| 485 | 485 | { |
| 486 | - $this->_contiguous = (bool)$contiguous; |
|
| 487 | - if (!$contiguous) { |
|
| 488 | - $this->_contiguousRow = -1; |
|
| 486 | + $this->_contiguous = (bool) $contiguous; |
|
| 487 | + if ( ! $contiguous) { |
|
| 488 | + $this->_contiguousRow = -1; |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | return $this; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | /** |
| 173 | 173 | * Can the current PHPExcel_Reader_IReader read the file? |
| 174 | 174 | * |
| 175 | - * @param string $pFileName |
|
| 175 | + * @param string $pFilename |
|
| 176 | 176 | * @return boolean |
| 177 | 177 | * @throws Exception |
| 178 | 178 | */ |
@@ -342,6 +342,9 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | |
| 345 | + /** |
|
| 346 | + * @param string $styleAttributeValue |
|
| 347 | + */ |
|
| 345 | 348 | private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) { |
| 346 | 349 | $styleAttributeValue = strtolower($styleAttributeValue); |
| 347 | 350 | foreach($styleList as $style) { |
@@ -887,6 +890,9 @@ discard block |
||
| 887 | 890 | } |
| 888 | 891 | |
| 889 | 892 | |
| 893 | + /** |
|
| 894 | + * @param string $charset |
|
| 895 | + */ |
|
| 890 | 896 | private static function _convertStringEncoding($string,$charset) { |
| 891 | 897 | if ($charset != 'UTF-8') { |
| 892 | 898 | return PHPExcel_Shared_String::ConvertEncoding($string,'UTF-8',$charset); |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | /** PHPExcel root directory */ |
| 30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
| 30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
| 31 | 31 | /** |
| 32 | 32 | * @ignore |
| 33 | 33 | */ |
| 34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
| 35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
| 34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
| 35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * Create a new PHPExcel_Reader_Excel2003XML |
| 85 | 85 | */ |
| 86 | 86 | public function __construct() { |
| 87 | - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
| 87 | + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | 197 | // Check if file exists |
| 198 | - if (!file_exists($pFilename)) { |
|
| 199 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 198 | + if ( ! file_exists($pFilename)) { |
|
| 199 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | // Read sample data (first 2 KB will do) |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | fclose($fh); |
| 206 | 206 | |
| 207 | 207 | $valid = true; |
| 208 | - foreach($signature as $match) { |
|
| 208 | + foreach ($signature as $match) { |
|
| 209 | 209 | // every part of the signature must be present |
| 210 | 210 | if (strpos($data, $match) === false) { |
| 211 | 211 | $valid = false; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | // Retrieve charset encoding |
| 217 | - if(preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um',$data,$matches)) { |
|
| 217 | + if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) { |
|
| 218 | 218 | $this->_charSet = strtoupper($matches[1]); |
| 219 | 219 | } |
| 220 | 220 | // echo 'Character Set is ',$this->_charSet,'<br />'; |
@@ -232,11 +232,11 @@ discard block |
||
| 232 | 232 | public function listWorksheetNames($pFilename) |
| 233 | 233 | { |
| 234 | 234 | // Check if file exists |
| 235 | - if (!file_exists($pFilename)) { |
|
| 236 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 235 | + if ( ! file_exists($pFilename)) { |
|
| 236 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 237 | 237 | } |
| 238 | - if (!$this->canRead($pFilename)) { |
|
| 239 | - throw new Exception($pFilename . " is an Invalid Spreadsheet file."); |
|
| 238 | + if ( ! $this->canRead($pFilename)) { |
|
| 239 | + throw new Exception($pFilename." is an Invalid Spreadsheet file."); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $worksheetNames = array(); |
@@ -245,9 +245,9 @@ discard block |
||
| 245 | 245 | $namespaces = $xml->getNamespaces(true); |
| 246 | 246 | |
| 247 | 247 | $xml_ss = $xml->children($namespaces['ss']); |
| 248 | - foreach($xml_ss->Worksheet as $worksheet) { |
|
| 248 | + foreach ($xml_ss->Worksheet as $worksheet) { |
|
| 249 | 249 | $worksheet_ss = $worksheet->attributes($namespaces['ss']); |
| 250 | - $worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'],$this->_charSet); |
|
| 250 | + $worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | return $worksheetNames; |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | public function listWorksheetInfo($pFilename) |
| 264 | 264 | { |
| 265 | 265 | // Check if file exists |
| 266 | - if (!file_exists($pFilename)) { |
|
| 267 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 266 | + if ( ! file_exists($pFilename)) { |
|
| 267 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | $worksheetInfo = array(); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | $worksheetID = 1; |
| 276 | 276 | $xml_ss = $xml->children($namespaces['ss']); |
| 277 | - foreach($xml_ss->Worksheet as $worksheet) { |
|
| 277 | + foreach ($xml_ss->Worksheet as $worksheet) { |
|
| 278 | 278 | $worksheet_ss = $worksheet->attributes($namespaces['ss']); |
| 279 | 279 | |
| 280 | 280 | $tmpInfo = array(); |
@@ -293,11 +293,11 @@ discard block |
||
| 293 | 293 | if (isset($worksheet->Table->Row)) { |
| 294 | 294 | $rowIndex = 0; |
| 295 | 295 | |
| 296 | - foreach($worksheet->Table->Row as $rowData) { |
|
| 296 | + foreach ($worksheet->Table->Row as $rowData) { |
|
| 297 | 297 | $columnIndex = 0; |
| 298 | 298 | $rowHasData = false; |
| 299 | 299 | |
| 300 | - foreach($rowData->Cell as $cell) { |
|
| 300 | + foreach ($rowData->Cell as $cell) { |
|
| 301 | 301 | if (isset($cell->Data)) { |
| 302 | 302 | $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex); |
| 303 | 303 | $rowHasData = true; |
@@ -342,9 +342,9 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | |
| 345 | - private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) { |
|
| 345 | + private static function identifyFixedStyleValue($styleList, &$styleAttributeValue) { |
|
| 346 | 346 | $styleAttributeValue = strtolower($styleAttributeValue); |
| 347 | - foreach($styleList as $style) { |
|
| 347 | + foreach ($styleList as $style) { |
|
| 348 | 348 | if ($styleAttributeValue == strtolower($style)) { |
| 349 | 349 | $styleAttributeValue = $style; |
| 350 | 350 | return true; |
@@ -396,23 +396,23 @@ discard block |
||
| 396 | 396 | */ |
| 397 | 397 | public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) |
| 398 | 398 | { |
| 399 | - $fromFormats = array('\-', '\ '); |
|
| 400 | - $toFormats = array('-', ' '); |
|
| 399 | + $fromFormats = array('\-', '\ '); |
|
| 400 | + $toFormats = array('-', ' '); |
|
| 401 | 401 | |
| 402 | - $underlineStyles = array ( |
|
| 402 | + $underlineStyles = array( |
|
| 403 | 403 | PHPExcel_Style_Font::UNDERLINE_NONE, |
| 404 | 404 | PHPExcel_Style_Font::UNDERLINE_DOUBLE, |
| 405 | 405 | PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING, |
| 406 | 406 | PHPExcel_Style_Font::UNDERLINE_SINGLE, |
| 407 | 407 | PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING |
| 408 | 408 | ); |
| 409 | - $verticalAlignmentStyles = array ( |
|
| 409 | + $verticalAlignmentStyles = array( |
|
| 410 | 410 | PHPExcel_Style_Alignment::VERTICAL_BOTTOM, |
| 411 | 411 | PHPExcel_Style_Alignment::VERTICAL_TOP, |
| 412 | 412 | PHPExcel_Style_Alignment::VERTICAL_CENTER, |
| 413 | 413 | PHPExcel_Style_Alignment::VERTICAL_JUSTIFY |
| 414 | 414 | ); |
| 415 | - $horizontalAlignmentStyles = array ( |
|
| 415 | + $horizontalAlignmentStyles = array( |
|
| 416 | 416 | PHPExcel_Style_Alignment::HORIZONTAL_GENERAL, |
| 417 | 417 | PHPExcel_Style_Alignment::HORIZONTAL_LEFT, |
| 418 | 418 | PHPExcel_Style_Alignment::HORIZONTAL_RIGHT, |
@@ -426,12 +426,12 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | |
| 428 | 428 | // Check if file exists |
| 429 | - if (!file_exists($pFilename)) { |
|
| 430 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 429 | + if ( ! file_exists($pFilename)) { |
|
| 430 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - if (!$this->canRead($pFilename)) { |
|
| 434 | - throw new Exception($pFilename . " is an Invalid Spreadsheet file."); |
|
| 433 | + if ( ! $this->canRead($pFilename)) { |
|
| 434 | + throw new Exception($pFilename." is an Invalid Spreadsheet file."); |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | $xml = simplexml_load_file($pFilename); |
@@ -439,52 +439,52 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | $docProps = $objPHPExcel->getProperties(); |
| 441 | 441 | if (isset($xml->DocumentProperties[0])) { |
| 442 | - foreach($xml->DocumentProperties[0] as $propertyName => $propertyValue) { |
|
| 442 | + foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) { |
|
| 443 | 443 | switch ($propertyName) { |
| 444 | 444 | case 'Title' : |
| 445 | - $docProps->setTitle(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 445 | + $docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 446 | 446 | break; |
| 447 | 447 | case 'Subject' : |
| 448 | - $docProps->setSubject(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 448 | + $docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 449 | 449 | break; |
| 450 | 450 | case 'Author' : |
| 451 | - $docProps->setCreator(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 451 | + $docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 452 | 452 | break; |
| 453 | 453 | case 'Created' : |
| 454 | 454 | $creationDate = strtotime($propertyValue); |
| 455 | 455 | $docProps->setCreated($creationDate); |
| 456 | 456 | break; |
| 457 | 457 | case 'LastAuthor' : |
| 458 | - $docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 458 | + $docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 459 | 459 | break; |
| 460 | 460 | case 'LastSaved' : |
| 461 | 461 | $lastSaveDate = strtotime($propertyValue); |
| 462 | 462 | $docProps->setModified($lastSaveDate); |
| 463 | 463 | break; |
| 464 | 464 | case 'Company' : |
| 465 | - $docProps->setCompany(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 465 | + $docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 466 | 466 | break; |
| 467 | 467 | case 'Category' : |
| 468 | - $docProps->setCategory(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 468 | + $docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 469 | 469 | break; |
| 470 | 470 | case 'Manager' : |
| 471 | - $docProps->setManager(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 471 | + $docProps->setManager(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 472 | 472 | break; |
| 473 | 473 | case 'Keywords' : |
| 474 | - $docProps->setKeywords(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 474 | + $docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 475 | 475 | break; |
| 476 | 476 | case 'Description' : |
| 477 | - $docProps->setDescription(self::_convertStringEncoding($propertyValue,$this->_charSet)); |
|
| 477 | + $docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->_charSet)); |
|
| 478 | 478 | break; |
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | if (isset($xml->CustomDocumentProperties)) { |
| 483 | - foreach($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) { |
|
| 483 | + foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) { |
|
| 484 | 484 | $propertyAttributes = $propertyValue->attributes($namespaces['dt']); |
| 485 | - $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/','PHPExcel_Reader_Excel2003XML::_hex2str',$propertyName); |
|
| 485 | + $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', 'PHPExcel_Reader_Excel2003XML::_hex2str', $propertyName); |
|
| 486 | 486 | $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN; |
| 487 | - switch((string) $propertyAttributes) { |
|
| 487 | + switch ((string) $propertyAttributes) { |
|
| 488 | 488 | case 'string' : |
| 489 | 489 | $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; |
| 490 | 490 | $propertyValue = trim($propertyValue); |
@@ -506,11 +506,11 @@ discard block |
||
| 506 | 506 | $propertyValue = strtotime(trim($propertyValue)); |
| 507 | 507 | break; |
| 508 | 508 | } |
| 509 | - $docProps->setCustomProperty($propertyName,$propertyValue,$propertyType); |
|
| 509 | + $docProps->setCustomProperty($propertyName, $propertyValue, $propertyType); |
|
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - foreach($xml->Styles[0] as $style) { |
|
| 513 | + foreach ($xml->Styles[0] as $style) { |
|
| 514 | 514 | $style_ss = $style->attributes($namespaces['ss']); |
| 515 | 515 | $styleID = (string) $style_ss['ID']; |
| 516 | 516 | // echo 'Style ID = '.$styleID.'<br />'; |
@@ -524,17 +524,17 @@ discard block |
||
| 524 | 524 | // echo $styleType.'<br />'; |
| 525 | 525 | switch ($styleType) { |
| 526 | 526 | case 'Alignment' : |
| 527 | - foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 527 | + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 528 | 528 | // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; |
| 529 | 529 | $styleAttributeValue = (string) $styleAttributeValue; |
| 530 | 530 | switch ($styleAttributeKey) { |
| 531 | 531 | case 'Vertical' : |
| 532 | - if (self::identifyFixedStyleValue($verticalAlignmentStyles,$styleAttributeValue)) { |
|
| 532 | + if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) { |
|
| 533 | 533 | $this->_styles[$styleID]['alignment']['vertical'] = $styleAttributeValue; |
| 534 | 534 | } |
| 535 | 535 | break; |
| 536 | 536 | case 'Horizontal' : |
| 537 | - if (self::identifyFixedStyleValue($horizontalAlignmentStyles,$styleAttributeValue)) { |
|
| 537 | + if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) { |
|
| 538 | 538 | $this->_styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue; |
| 539 | 539 | } |
| 540 | 540 | break; |
@@ -545,10 +545,10 @@ discard block |
||
| 545 | 545 | } |
| 546 | 546 | break; |
| 547 | 547 | case 'Borders' : |
| 548 | - foreach($styleData->Border as $borderStyle) { |
|
| 548 | + foreach ($styleData->Border as $borderStyle) { |
|
| 549 | 549 | $borderAttributes = $borderStyle->attributes($namespaces['ss']); |
| 550 | 550 | $thisBorder = array(); |
| 551 | - foreach($borderAttributes as $borderStyleKey => $borderStyleValue) { |
|
| 551 | + foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) { |
|
| 552 | 552 | // echo $borderStyleKey.' = '.$borderStyleValue.'<br />'; |
| 553 | 553 | switch ($borderStyleKey) { |
| 554 | 554 | case 'LineStyle' : |
@@ -562,12 +562,12 @@ discard block |
||
| 562 | 562 | $borderPosition = strtolower($borderStyleValue); |
| 563 | 563 | break; |
| 564 | 564 | case 'Color' : |
| 565 | - $borderColour = substr($borderStyleValue,1); |
|
| 565 | + $borderColour = substr($borderStyleValue, 1); |
|
| 566 | 566 | $thisBorder['color']['rgb'] = $borderColour; |
| 567 | 567 | break; |
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | - if (!empty($thisBorder)) { |
|
| 570 | + if ( ! empty($thisBorder)) { |
|
| 571 | 571 | if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) { |
| 572 | 572 | $this->_styles[$styleID]['borders'][$borderPosition] = $thisBorder; |
| 573 | 573 | } |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | } |
| 576 | 576 | break; |
| 577 | 577 | case 'Font' : |
| 578 | - foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 578 | + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 579 | 579 | // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; |
| 580 | 580 | $styleAttributeValue = (string) $styleAttributeValue; |
| 581 | 581 | switch ($styleAttributeKey) { |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | $this->_styles[$styleID]['font']['size'] = $styleAttributeValue; |
| 587 | 587 | break; |
| 588 | 588 | case 'Color' : |
| 589 | - $this->_styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue,1); |
|
| 589 | + $this->_styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue, 1); |
|
| 590 | 590 | break; |
| 591 | 591 | case 'Bold' : |
| 592 | 592 | $this->_styles[$styleID]['font']['bold'] = true; |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | $this->_styles[$styleID]['font']['italic'] = true; |
| 596 | 596 | break; |
| 597 | 597 | case 'Underline' : |
| 598 | - if (self::identifyFixedStyleValue($underlineStyles,$styleAttributeValue)) { |
|
| 598 | + if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) { |
|
| 599 | 599 | $this->_styles[$styleID]['font']['underline'] = $styleAttributeValue; |
| 600 | 600 | } |
| 601 | 601 | break; |
@@ -603,19 +603,19 @@ discard block |
||
| 603 | 603 | } |
| 604 | 604 | break; |
| 605 | 605 | case 'Interior' : |
| 606 | - foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 606 | + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 607 | 607 | // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; |
| 608 | 608 | switch ($styleAttributeKey) { |
| 609 | 609 | case 'Color' : |
| 610 | - $this->_styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue,1); |
|
| 610 | + $this->_styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1); |
|
| 611 | 611 | break; |
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | break; |
| 615 | 615 | case 'NumberFormat' : |
| 616 | - foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 616 | + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 617 | 617 | // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; |
| 618 | - $styleAttributeValue = str_replace($fromFormats,$toFormats,$styleAttributeValue); |
|
| 618 | + $styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue); |
|
| 619 | 619 | switch ($styleAttributeValue) { |
| 620 | 620 | case 'Short Date' : |
| 621 | 621 | $styleAttributeValue = 'dd/mm/yyyy'; |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | } |
| 628 | 628 | break; |
| 629 | 629 | case 'Protection' : |
| 630 | - foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 630 | + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { |
|
| 631 | 631 | // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; |
| 632 | 632 | } |
| 633 | 633 | break; |
@@ -641,11 +641,11 @@ discard block |
||
| 641 | 641 | $worksheetID = 0; |
| 642 | 642 | $xml_ss = $xml->children($namespaces['ss']); |
| 643 | 643 | |
| 644 | - foreach($xml_ss->Worksheet as $worksheet) { |
|
| 644 | + foreach ($xml_ss->Worksheet as $worksheet) { |
|
| 645 | 645 | $worksheet_ss = $worksheet->attributes($namespaces['ss']); |
| 646 | 646 | |
| 647 | 647 | if ((isset($this->_loadSheetsOnly)) && (isset($worksheet_ss['Name'])) && |
| 648 | - (!in_array($worksheet_ss['Name'], $this->_loadSheetsOnly))) { |
|
| 648 | + ( ! in_array($worksheet_ss['Name'], $this->_loadSheetsOnly))) { |
|
| 649 | 649 | continue; |
| 650 | 650 | } |
| 651 | 651 | |
@@ -655,19 +655,19 @@ discard block |
||
| 655 | 655 | $objPHPExcel->createSheet(); |
| 656 | 656 | $objPHPExcel->setActiveSheetIndex($worksheetID); |
| 657 | 657 | if (isset($worksheet_ss['Name'])) { |
| 658 | - $worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'],$this->_charSet); |
|
| 658 | + $worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet); |
|
| 659 | 659 | // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in |
| 660 | 660 | // formula cells... during the load, all formulae should be correct, and we're simply bringing |
| 661 | 661 | // the worksheet name in line with the formula, not the reverse |
| 662 | - $objPHPExcel->getActiveSheet()->setTitle($worksheetName,false); |
|
| 662 | + $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false); |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | $columnID = 'A'; |
| 666 | 666 | if (isset($worksheet->Table->Column)) { |
| 667 | - foreach($worksheet->Table->Column as $columnData) { |
|
| 667 | + foreach ($worksheet->Table->Column as $columnData) { |
|
| 668 | 668 | $columnData_ss = $columnData->attributes($namespaces['ss']); |
| 669 | 669 | if (isset($columnData_ss['Index'])) { |
| 670 | - $columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index']-1); |
|
| 670 | + $columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index'] - 1); |
|
| 671 | 671 | } |
| 672 | 672 | if (isset($columnData_ss['Width'])) { |
| 673 | 673 | $columnWidth = $columnData_ss['Width']; |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | |
| 681 | 681 | $rowID = 1; |
| 682 | 682 | if (isset($worksheet->Table->Row)) { |
| 683 | - foreach($worksheet->Table->Row as $rowData) { |
|
| 683 | + foreach ($worksheet->Table->Row as $rowData) { |
|
| 684 | 684 | $rowHasData = false; |
| 685 | 685 | $row_ss = $rowData->attributes($namespaces['ss']); |
| 686 | 686 | if (isset($row_ss['Index'])) { |
@@ -689,16 +689,16 @@ discard block |
||
| 689 | 689 | // echo '<b>Row '.$rowID.'</b><br />'; |
| 690 | 690 | |
| 691 | 691 | $columnID = 'A'; |
| 692 | - foreach($rowData->Cell as $cell) { |
|
| 692 | + foreach ($rowData->Cell as $cell) { |
|
| 693 | 693 | |
| 694 | 694 | $cell_ss = $cell->attributes($namespaces['ss']); |
| 695 | 695 | if (isset($cell_ss['Index'])) { |
| 696 | - $columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index']-1); |
|
| 696 | + $columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index'] - 1); |
|
| 697 | 697 | } |
| 698 | 698 | $cellRange = $columnID.$rowID; |
| 699 | 699 | |
| 700 | 700 | if ($this->getReadFilter() !== NULL) { |
| 701 | - if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { |
|
| 701 | + if ( ! $this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { |
|
| 702 | 702 | continue; |
| 703 | 703 | } |
| 704 | 704 | } |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) { |
| 707 | 707 | $columnTo = $columnID; |
| 708 | 708 | if (isset($cell_ss['MergeAcross'])) { |
| 709 | - $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1); |
|
| 709 | + $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] - 1); |
|
| 710 | 710 | } |
| 711 | 711 | $rowTo = $rowID; |
| 712 | 712 | if (isset($cell_ss['MergeDown'])) { |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | const TYPE_ERROR = 'e'; |
| 745 | 745 | */ |
| 746 | 746 | case 'String' : |
| 747 | - $cellValue = self::_convertStringEncoding($cellValue,$this->_charSet); |
|
| 747 | + $cellValue = self::_convertStringEncoding($cellValue, $this->_charSet); |
|
| 748 | 748 | $type = PHPExcel_Cell_DataType::TYPE_STRING; |
| 749 | 749 | break; |
| 750 | 750 | case 'Number' : |
@@ -772,58 +772,58 @@ discard block |
||
| 772 | 772 | // echo 'FORMULA<br />'; |
| 773 | 773 | $type = PHPExcel_Cell_DataType::TYPE_FORMULA; |
| 774 | 774 | $columnNumber = PHPExcel_Cell::columnIndexFromString($columnID); |
| 775 | - if (substr($cellDataFormula,0,3) == 'of:') { |
|
| 776 | - $cellDataFormula = substr($cellDataFormula,3); |
|
| 775 | + if (substr($cellDataFormula, 0, 3) == 'of:') { |
|
| 776 | + $cellDataFormula = substr($cellDataFormula, 3); |
|
| 777 | 777 | // echo 'Before: ',$cellDataFormula,'<br />'; |
| 778 | - $temp = explode('"',$cellDataFormula); |
|
| 778 | + $temp = explode('"', $cellDataFormula); |
|
| 779 | 779 | $key = false; |
| 780 | - foreach($temp as &$value) { |
|
| 780 | + foreach ($temp as &$value) { |
|
| 781 | 781 | // Only replace in alternate array entries (i.e. non-quoted blocks) |
| 782 | - if ($key = !$key) { |
|
| 783 | - $value = str_replace(array('[.','.',']'),'',$value); |
|
| 782 | + if ($key = ! $key) { |
|
| 783 | + $value = str_replace(array('[.', '.', ']'), '', $value); |
|
| 784 | 784 | } |
| 785 | 785 | } |
| 786 | 786 | } else { |
| 787 | 787 | // Convert R1C1 style references to A1 style references (but only when not quoted) |
| 788 | 788 | // echo 'Before: ',$cellDataFormula,'<br />'; |
| 789 | - $temp = explode('"',$cellDataFormula); |
|
| 789 | + $temp = explode('"', $cellDataFormula); |
|
| 790 | 790 | $key = false; |
| 791 | - foreach($temp as &$value) { |
|
| 791 | + foreach ($temp as &$value) { |
|
| 792 | 792 | // Only replace in alternate array entries (i.e. non-quoted blocks) |
| 793 | - if ($key = !$key) { |
|
| 794 | - preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE); |
|
| 793 | + if ($key = ! $key) { |
|
| 794 | + preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE); |
|
| 795 | 795 | // Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way |
| 796 | 796 | // through the formula from left to right. Reversing means that we work right to left.through |
| 797 | 797 | // the formula |
| 798 | 798 | $cellReferences = array_reverse($cellReferences); |
| 799 | 799 | // Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent, |
| 800 | 800 | // then modify the formula to use that new reference |
| 801 | - foreach($cellReferences as $cellReference) { |
|
| 801 | + foreach ($cellReferences as $cellReference) { |
|
| 802 | 802 | $rowReference = $cellReference[2][0]; |
| 803 | 803 | // Empty R reference is the current row |
| 804 | 804 | if ($rowReference == '') $rowReference = $rowID; |
| 805 | 805 | // Bracketed R references are relative to the current row |
| 806 | - if ($rowReference{0} == '[') $rowReference = $rowID + trim($rowReference,'[]'); |
|
| 806 | + if ($rowReference{0} == '[') $rowReference = $rowID + trim($rowReference, '[]'); |
|
| 807 | 807 | $columnReference = $cellReference[4][0]; |
| 808 | 808 | // Empty C reference is the current column |
| 809 | 809 | if ($columnReference == '') $columnReference = $columnNumber; |
| 810 | 810 | // Bracketed C references are relative to the current column |
| 811 | - if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference,'[]'); |
|
| 812 | - $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference; |
|
| 813 | - $value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0])); |
|
| 811 | + if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference, '[]'); |
|
| 812 | + $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference - 1).$rowReference; |
|
| 813 | + $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0])); |
|
| 814 | 814 | } |
| 815 | 815 | } |
| 816 | 816 | } |
| 817 | 817 | } |
| 818 | 818 | unset($value); |
| 819 | 819 | // Then rebuild the formula string |
| 820 | - $cellDataFormula = implode('"',$temp); |
|
| 820 | + $cellDataFormula = implode('"', $temp); |
|
| 821 | 821 | // echo 'After: ',$cellDataFormula,'<br />'; |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | // echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />'; |
| 825 | 825 | // |
| 826 | - $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue),$type); |
|
| 826 | + $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type); |
|
| 827 | 827 | if ($hasCalculatedValue) { |
| 828 | 828 | // echo 'Formula result is '.$cellValue.'<br />'; |
| 829 | 829 | $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($cellValue); |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | $commentAttributes = $cell->Comment->attributes($namespaces['ss']); |
| 837 | 837 | $author = 'unknown'; |
| 838 | 838 | if (isset($commentAttributes->Author)) { |
| 839 | - $author = (string)$commentAttributes->Author; |
|
| 839 | + $author = (string) $commentAttributes->Author; |
|
| 840 | 840 | // echo 'Author: ',$author,'<br />'; |
| 841 | 841 | } |
| 842 | 842 | $node = $cell->Comment->Data->asXML(); |
@@ -844,19 +844,19 @@ discard block |
||
| 844 | 844 | // echo $annotation,'<br />'; |
| 845 | 845 | $annotation = strip_tags($node); |
| 846 | 846 | // echo 'Annotation: ',$annotation,'<br />'; |
| 847 | - $objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID ) |
|
| 848 | - ->setAuthor(self::_convertStringEncoding($author ,$this->_charSet)) |
|
| 849 | - ->setText($this->_parseRichText($annotation) ); |
|
| 847 | + $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID) |
|
| 848 | + ->setAuthor(self::_convertStringEncoding($author, $this->_charSet)) |
|
| 849 | + ->setText($this->_parseRichText($annotation)); |
|
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | if (($cellIsSet) && (isset($cell_ss['StyleID']))) { |
| 853 | 853 | $style = (string) $cell_ss['StyleID']; |
| 854 | 854 | // echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />'; |
| 855 | - if ((isset($this->_styles[$style])) && (!empty($this->_styles[$style]))) { |
|
| 855 | + if ((isset($this->_styles[$style])) && ( ! empty($this->_styles[$style]))) { |
|
| 856 | 856 | // echo 'Cell '.$columnID.$rowID.'<br />'; |
| 857 | 857 | // print_r($this->_styles[$style]); |
| 858 | 858 | // echo '<br />'; |
| 859 | - if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) { |
|
| 859 | + if ( ! $objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) { |
|
| 860 | 860 | $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(NULL); |
| 861 | 861 | } |
| 862 | 862 | $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]); |
@@ -887,9 +887,9 @@ discard block |
||
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | |
| 890 | - private static function _convertStringEncoding($string,$charset) { |
|
| 890 | + private static function _convertStringEncoding($string, $charset) { |
|
| 891 | 891 | if ($charset != 'UTF-8') { |
| 892 | - return PHPExcel_Shared_String::ConvertEncoding($string,'UTF-8',$charset); |
|
| 892 | + return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $charset); |
|
| 893 | 893 | } |
| 894 | 894 | return $string; |
| 895 | 895 | } |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | private function _parseRichText($is = '') { |
| 899 | 899 | $value = new PHPExcel_RichText(); |
| 900 | 900 | |
| 901 | - $value->createText(self::_convertStringEncoding($is,$this->_charSet)); |
|
| 901 | + $value->createText(self::_convertStringEncoding($is, $this->_charSet)); |
|
| 902 | 902 | |
| 903 | 903 | return $value; |
| 904 | 904 | } |
@@ -801,14 +801,22 @@ |
||
| 801 | 801 | foreach($cellReferences as $cellReference) { |
| 802 | 802 | $rowReference = $cellReference[2][0]; |
| 803 | 803 | // Empty R reference is the current row |
| 804 | - if ($rowReference == '') $rowReference = $rowID; |
|
| 804 | + if ($rowReference == '') { |
|
| 805 | + $rowReference = $rowID; |
|
| 806 | + } |
|
| 805 | 807 | // Bracketed R references are relative to the current row |
| 806 | - if ($rowReference{0} == '[') $rowReference = $rowID + trim($rowReference,'[]'); |
|
| 808 | + if ($rowReference{0} == '[') { |
|
| 809 | + $rowReference = $rowID + trim($rowReference,'[]'); |
|
| 810 | + } |
|
| 807 | 811 | $columnReference = $cellReference[4][0]; |
| 808 | 812 | // Empty C reference is the current column |
| 809 | - if ($columnReference == '') $columnReference = $columnNumber; |
|
| 813 | + if ($columnReference == '') { |
|
| 814 | + $columnReference = $columnNumber; |
|
| 815 | + } |
|
| 810 | 816 | // Bracketed C references are relative to the current column |
| 811 | - if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference,'[]'); |
|
| 817 | + if ($columnReference{0} == '[') { |
|
| 818 | + $columnReference = $columnNumber + trim($columnReference,'[]'); |
|
| 819 | + } |
|
| 812 | 820 | $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference; |
| 813 | 821 | $value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0])); |
| 814 | 822 | } |
@@ -325,7 +325,7 @@ |
||
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | |
| 328 | - /** |
|
| 328 | + /** |
|
| 329 | 329 | * Loads PHPExcel from file |
| 330 | 330 | * |
| 331 | 331 | * @param string $pFilename |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | /** |
| 225 | 225 | * Can the current PHPExcel_Reader_IReader read the file? |
| 226 | 226 | * |
| 227 | - * @param string $pFileName |
|
| 227 | + * @param string $pFilename |
|
| 228 | 228 | * @return boolean |
| 229 | 229 | * @throws Exception |
| 230 | 230 | */ |
@@ -366,6 +366,11 @@ discard block |
||
| 366 | 366 | } // function _castToString() |
| 367 | 367 | |
| 368 | 368 | |
| 369 | + /** |
|
| 370 | + * @param string $r |
|
| 371 | + * @param string $cellDataType |
|
| 372 | + * @param string $castBaseType |
|
| 373 | + */ |
|
| 369 | 374 | private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) { |
| 370 | 375 | // echo '<font color="darkgreen">Formula</font><br />'; |
| 371 | 376 | // echo '$c->f is '.$c->f.'<br />'; |
@@ -415,6 +420,9 @@ discard block |
||
| 415 | 420 | } |
| 416 | 421 | |
| 417 | 422 | |
| 423 | + /** |
|
| 424 | + * @return string |
|
| 425 | + */ |
|
| 418 | 426 | public function _getFromZipArchive(ZipArchive $archive, $fileName = '') |
| 419 | 427 | { |
| 420 | 428 | // Root-relative paths |
@@ -1755,6 +1763,9 @@ discard block |
||
| 1755 | 1763 | } |
| 1756 | 1764 | |
| 1757 | 1765 | |
| 1766 | + /** |
|
| 1767 | + * @param PHPExcel_Style $docStyle |
|
| 1768 | + */ |
|
| 1758 | 1769 | private static function _readStyle($docStyle, $style) { |
| 1759 | 1770 | // format code |
| 1760 | 1771 | if (isset($style->numFmt)) { |
@@ -1966,6 +1977,9 @@ discard block |
||
| 1966 | 1977 | } |
| 1967 | 1978 | |
| 1968 | 1979 | |
| 1980 | + /** |
|
| 1981 | + * @param string $style |
|
| 1982 | + */ |
|
| 1969 | 1983 | private static function toCSSArray($style) { |
| 1970 | 1984 | $style = str_replace(array("\r","\n"), "", $style); |
| 1971 | 1985 | |
@@ -766,12 +766,12 @@ discard block |
||
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | if (isset($xmlSheet->sheetViews) && isset($xmlSheet->sheetViews->sheetView)) { |
| 769 | - if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) { |
|
| 770 | - $docSheet->getSheetView()->setZoomScale( intval($xmlSheet->sheetViews->sheetView['zoomScale']) ); |
|
| 769 | + if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) { |
|
| 770 | + $docSheet->getSheetView()->setZoomScale( intval($xmlSheet->sheetViews->sheetView['zoomScale']) ); |
|
| 771 | 771 | } |
| 772 | 772 | |
| 773 | - if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) { |
|
| 774 | - $docSheet->getSheetView()->setZoomScaleNormal( intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']) ); |
|
| 773 | + if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) { |
|
| 774 | + $docSheet->getSheetView()->setZoomScaleNormal( intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']) ); |
|
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) { |
@@ -787,22 +787,22 @@ discard block |
||
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | if (isset($xmlSheet->sheetViews->sheetView->pane)) { |
| 790 | - if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) { |
|
| 791 | - $docSheet->freezePane( (string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell'] ); |
|
| 792 | - } else { |
|
| 793 | - $xSplit = 0; |
|
| 794 | - $ySplit = 0; |
|
| 795 | - |
|
| 796 | - if (isset($xmlSheet->sheetViews->sheetView->pane['xSplit'])) { |
|
| 797 | - $xSplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['xSplit']); |
|
| 798 | - } |
|
| 799 | - |
|
| 800 | - if (isset($xmlSheet->sheetViews->sheetView->pane['ySplit'])) { |
|
| 801 | - $ySplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['ySplit']); |
|
| 802 | - } |
|
| 803 | - |
|
| 804 | - $docSheet->freezePaneByColumnAndRow($xSplit, $ySplit); |
|
| 805 | - } |
|
| 790 | + if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) { |
|
| 791 | + $docSheet->freezePane( (string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell'] ); |
|
| 792 | + } else { |
|
| 793 | + $xSplit = 0; |
|
| 794 | + $ySplit = 0; |
|
| 795 | + |
|
| 796 | + if (isset($xmlSheet->sheetViews->sheetView->pane['xSplit'])) { |
|
| 797 | + $xSplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['xSplit']); |
|
| 798 | + } |
|
| 799 | + |
|
| 800 | + if (isset($xmlSheet->sheetViews->sheetView->pane['ySplit'])) { |
|
| 801 | + $ySplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane['ySplit']); |
|
| 802 | + } |
|
| 803 | + |
|
| 804 | + $docSheet->freezePaneByColumnAndRow($xSplit, $ySplit); |
|
| 805 | + } |
|
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | if (isset($xmlSheet->sheetViews->sheetView->selection)) { |
@@ -1193,8 +1193,8 @@ discard block |
||
| 1193 | 1193 | |
| 1194 | 1194 | if ($xmlSheet && $xmlSheet->dataValidations && !$this->_readDataOnly) { |
| 1195 | 1195 | foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation) { |
| 1196 | - // Uppercase coordinate |
|
| 1197 | - $range = strtoupper($dataValidation["sqref"]); |
|
| 1196 | + // Uppercase coordinate |
|
| 1197 | + $range = strtoupper($dataValidation["sqref"]); |
|
| 1198 | 1198 | $rangeSet = explode(' ',$range); |
| 1199 | 1199 | foreach($rangeSet as $range) { |
| 1200 | 1200 | $stRange = $docSheet->shrinkRangeToFit($range); |
@@ -1267,10 +1267,10 @@ discard block |
||
| 1267 | 1267 | if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { |
| 1268 | 1268 | $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
| 1269 | 1269 | foreach ($relsWorksheet->Relationship as $ele) { |
| 1270 | - if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") { |
|
| 1270 | + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") { |
|
| 1271 | 1271 | $comments[(string)$ele["Id"]] = (string)$ele["Target"]; |
| 1272 | 1272 | } |
| 1273 | - if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") { |
|
| 1273 | + if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") { |
|
| 1274 | 1274 | $vmlComments[(string)$ele["Id"]] = (string)$ele["Target"]; |
| 1275 | 1275 | } |
| 1276 | 1276 | } |
@@ -1298,7 +1298,7 @@ discard block |
||
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | 1300 | // Loop through VML comments |
| 1301 | - foreach ($vmlComments as $relName => $relPath) { |
|
| 1301 | + foreach ($vmlComments as $relName => $relPath) { |
|
| 1302 | 1302 | // Load VML comments file |
| 1303 | 1303 | $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); |
| 1304 | 1304 | $vmlCommentsFile = simplexml_load_string( $this->_getFromZipArchive($zip, $relPath) ); |
@@ -1309,42 +1309,42 @@ discard block |
||
| 1309 | 1309 | $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); |
| 1310 | 1310 | |
| 1311 | 1311 | if (isset($shape['style'])) { |
| 1312 | - $style = (string)$shape['style']; |
|
| 1313 | - $fillColor = strtoupper( substr( (string)$shape['fillcolor'], 1 ) ); |
|
| 1314 | - $column = null; |
|
| 1315 | - $row = null; |
|
| 1316 | - |
|
| 1317 | - $clientData = $shape->xpath('.//x:ClientData'); |
|
| 1318 | - if (is_array($clientData) && !empty($clientData)) { |
|
| 1319 | - $clientData = $clientData[0]; |
|
| 1320 | - |
|
| 1321 | - if ( isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note' ) { |
|
| 1322 | - $temp = $clientData->xpath('.//x:Row'); |
|
| 1323 | - if (is_array($temp)) $row = $temp[0]; |
|
| 1324 | - |
|
| 1325 | - $temp = $clientData->xpath('.//x:Column'); |
|
| 1326 | - if (is_array($temp)) $column = $temp[0]; |
|
| 1327 | - } |
|
| 1328 | - } |
|
| 1329 | - |
|
| 1330 | - if (($column !== NULL) && ($row !== NULL)) { |
|
| 1331 | - // Set comment properties |
|
| 1332 | - $comment = $docSheet->getCommentByColumnAndRow((string) $column, $row + 1); |
|
| 1333 | - $comment->getFillColor()->setRGB( $fillColor ); |
|
| 1334 | - |
|
| 1335 | - // Parse style |
|
| 1336 | - $styleArray = explode(';', str_replace(' ', '', $style)); |
|
| 1337 | - foreach ($styleArray as $stylePair) { |
|
| 1338 | - $stylePair = explode(':', $stylePair); |
|
| 1339 | - |
|
| 1340 | - if ($stylePair[0] == 'margin-left') $comment->setMarginLeft($stylePair[1]); |
|
| 1341 | - if ($stylePair[0] == 'margin-top') $comment->setMarginTop($stylePair[1]); |
|
| 1342 | - if ($stylePair[0] == 'width') $comment->setWidth($stylePair[1]); |
|
| 1343 | - if ($stylePair[0] == 'height') $comment->setHeight($stylePair[1]); |
|
| 1344 | - if ($stylePair[0] == 'visibility') $comment->setVisible( $stylePair[1] == 'visible' ); |
|
| 1345 | - |
|
| 1346 | - } |
|
| 1347 | - } |
|
| 1312 | + $style = (string)$shape['style']; |
|
| 1313 | + $fillColor = strtoupper( substr( (string)$shape['fillcolor'], 1 ) ); |
|
| 1314 | + $column = null; |
|
| 1315 | + $row = null; |
|
| 1316 | + |
|
| 1317 | + $clientData = $shape->xpath('.//x:ClientData'); |
|
| 1318 | + if (is_array($clientData) && !empty($clientData)) { |
|
| 1319 | + $clientData = $clientData[0]; |
|
| 1320 | + |
|
| 1321 | + if ( isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note' ) { |
|
| 1322 | + $temp = $clientData->xpath('.//x:Row'); |
|
| 1323 | + if (is_array($temp)) $row = $temp[0]; |
|
| 1324 | + |
|
| 1325 | + $temp = $clientData->xpath('.//x:Column'); |
|
| 1326 | + if (is_array($temp)) $column = $temp[0]; |
|
| 1327 | + } |
|
| 1328 | + } |
|
| 1329 | + |
|
| 1330 | + if (($column !== NULL) && ($row !== NULL)) { |
|
| 1331 | + // Set comment properties |
|
| 1332 | + $comment = $docSheet->getCommentByColumnAndRow((string) $column, $row + 1); |
|
| 1333 | + $comment->getFillColor()->setRGB( $fillColor ); |
|
| 1334 | + |
|
| 1335 | + // Parse style |
|
| 1336 | + $styleArray = explode(';', str_replace(' ', '', $style)); |
|
| 1337 | + foreach ($styleArray as $stylePair) { |
|
| 1338 | + $stylePair = explode(':', $stylePair); |
|
| 1339 | + |
|
| 1340 | + if ($stylePair[0] == 'margin-left') $comment->setMarginLeft($stylePair[1]); |
|
| 1341 | + if ($stylePair[0] == 'margin-top') $comment->setMarginTop($stylePair[1]); |
|
| 1342 | + if ($stylePair[0] == 'width') $comment->setWidth($stylePair[1]); |
|
| 1343 | + if ($stylePair[0] == 'height') $comment->setHeight($stylePair[1]); |
|
| 1344 | + if ($stylePair[0] == 'visibility') $comment->setVisible( $stylePair[1] == 'visible' ); |
|
| 1345 | + |
|
| 1346 | + } |
|
| 1347 | + } |
|
| 1348 | 1348 | } |
| 1349 | 1349 | } |
| 1350 | 1350 | } |
@@ -1919,12 +1919,12 @@ discard block |
||
| 1919 | 1919 | } |
| 1920 | 1920 | |
| 1921 | 1921 | if ( (isset($run->rPr->b["val"]) && ((string) $run->rPr->b["val"] == 'true' || (string) $run->rPr->b["val"] == '1')) |
| 1922 | - || (isset($run->rPr->b) && !isset($run->rPr->b["val"])) ) { |
|
| 1922 | + || (isset($run->rPr->b) && !isset($run->rPr->b["val"])) ) { |
|
| 1923 | 1923 | $objText->getFont()->setBold(true); |
| 1924 | 1924 | } |
| 1925 | 1925 | |
| 1926 | 1926 | if ( (isset($run->rPr->i["val"]) && ((string) $run->rPr->i["val"] == 'true' || (string) $run->rPr->i["val"] == '1')) |
| 1927 | - || (isset($run->rPr->i) && !isset($run->rPr->i["val"])) ) { |
|
| 1927 | + || (isset($run->rPr->i) && !isset($run->rPr->i["val"])) ) { |
|
| 1928 | 1928 | $objText->getFont()->setItalic(true); |
| 1929 | 1929 | } |
| 1930 | 1930 | |
@@ -1945,7 +1945,7 @@ discard block |
||
| 1945 | 1945 | } |
| 1946 | 1946 | |
| 1947 | 1947 | if ( (isset($run->rPr->strike["val"]) && ((string) $run->rPr->strike["val"] == 'true' || (string) $run->rPr->strike["val"] == '1')) |
| 1948 | - || (isset($run->rPr->strike) && !isset($run->rPr->strike["val"])) ) { |
|
| 1948 | + || (isset($run->rPr->strike) && !isset($run->rPr->strike["val"])) ) { |
|
| 1949 | 1949 | $objText->getFont()->setStrikethrough(true); |
| 1950 | 1950 | } |
| 1951 | 1951 | } |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | /** PHPExcel root directory */ |
| 30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
| 30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
| 31 | 31 | /** |
| 32 | 32 | * @ignore |
| 33 | 33 | */ |
| 34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
| 35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
| 34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
| 35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -231,12 +231,12 @@ discard block |
||
| 231 | 231 | public function canRead($pFilename) |
| 232 | 232 | { |
| 233 | 233 | // Check if file exists |
| 234 | - if (!file_exists($pFilename)) { |
|
| 235 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 234 | + if ( ! file_exists($pFilename)) { |
|
| 235 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // Check if zip class exists |
| 239 | - if (!class_exists('ZipArchive')) { |
|
| 239 | + if ( ! class_exists('ZipArchive')) { |
|
| 240 | 240 | throw new Exception("ZipArchive library is not enabled"); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -274,8 +274,8 @@ discard block |
||
| 274 | 274 | public function listWorksheetInfo($pFilename) |
| 275 | 275 | { |
| 276 | 276 | // Check if file exists |
| 277 | - if (!file_exists($pFilename)) { |
|
| 278 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 277 | + if ( ! file_exists($pFilename)) { |
|
| 278 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | $worksheetInfo = array(); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | foreach ($rels->Relationship as $rel) { |
| 288 | 288 | if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") { |
| 289 | 289 | $dir = dirname($rel["Target"]); |
| 290 | - $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 290 | + $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/".basename($rel["Target"]).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 291 | 291 | $relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships"); |
| 292 | 292 | |
| 293 | 293 | $worksheets = array(); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 300 | + $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 301 | 301 | if ($xmlWorkbook->sheets) { |
| 302 | 302 | $dir = dirname($rel["Target"]); |
| 303 | 303 | foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $tmpInfo['totalColumns'] = 0; |
| 310 | 310 | |
| 311 | 311 | $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; |
| 312 | - $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 312 | + $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 313 | 313 | if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) { |
| 314 | 314 | foreach ($xmlSheet->sheetData->row as $row) { |
| 315 | 315 | foreach ($row->c as $c) { |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | } elseif ($value == '1') { |
| 349 | 349 | return true; |
| 350 | 350 | } else { |
| 351 | - return (bool)$c->v; |
|
| 351 | + return (bool) $c->v; |
|
| 352 | 352 | } |
| 353 | 353 | return $value; |
| 354 | 354 | } // function _castToBool() |
@@ -356,38 +356,38 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | private static function _castToError($c) { |
| 358 | 358 | // echo 'Initial Cast to Error<br />'; |
| 359 | - return isset($c->v) ? (string) $c->v : null;; |
|
| 359 | + return isset($c->v) ? (string) $c->v : null; ; |
|
| 360 | 360 | } // function _castToError() |
| 361 | 361 | |
| 362 | 362 | |
| 363 | 363 | private static function _castToString($c) { |
| 364 | 364 | // echo 'Initial Cast to String<br />'; |
| 365 | - return isset($c->v) ? (string) $c->v : null;; |
|
| 365 | + return isset($c->v) ? (string) $c->v : null; ; |
|
| 366 | 366 | } // function _castToString() |
| 367 | 367 | |
| 368 | 368 | |
| 369 | - private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) { |
|
| 369 | + private function _castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType) { |
|
| 370 | 370 | // echo '<font color="darkgreen">Formula</font><br />'; |
| 371 | 371 | // echo '$c->f is '.$c->f.'<br />'; |
| 372 | - $cellDataType = 'f'; |
|
| 373 | - $value = "={$c->f}"; |
|
| 374 | - $calculatedValue = self::$castBaseType($c); |
|
| 372 | + $cellDataType = 'f'; |
|
| 373 | + $value = "={$c->f}"; |
|
| 374 | + $calculatedValue = self::$castBaseType($c); |
|
| 375 | 375 | |
| 376 | 376 | // Shared formula? |
| 377 | - if (isset($c->f['t']) && strtolower((string)$c->f['t']) == 'shared') { |
|
| 377 | + if (isset($c->f['t']) && strtolower((string) $c->f['t']) == 'shared') { |
|
| 378 | 378 | // echo '<font color="darkgreen">SHARED FORMULA</font><br />'; |
| 379 | - $instance = (string)$c->f['si']; |
|
| 379 | + $instance = (string) $c->f['si']; |
|
| 380 | 380 | |
| 381 | 381 | // echo 'Instance ID = '.$instance.'<br />'; |
| 382 | 382 | // |
| 383 | 383 | // echo 'Shared Formula Array:<pre>'; |
| 384 | 384 | // print_r($sharedFormulas); |
| 385 | 385 | // echo '</pre>'; |
| 386 | - if (!isset($sharedFormulas[(string)$c->f['si']])) { |
|
| 386 | + if ( ! isset($sharedFormulas[(string) $c->f['si']])) { |
|
| 387 | 387 | // echo '<font color="darkgreen">SETTING NEW SHARED FORMULA</font><br />'; |
| 388 | 388 | // echo 'Master is '.$r.'<br />'; |
| 389 | 389 | // echo 'Formula is '.$value.'<br />'; |
| 390 | - $sharedFormulas[$instance] = array( 'master' => $r, |
|
| 390 | + $sharedFormulas[$instance] = array('master' => $r, |
|
| 391 | 391 | 'formula' => $value |
| 392 | 392 | ); |
| 393 | 393 | // echo 'New Shared Formula Array:<pre>'; |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | $difference[0] = PHPExcel_Cell::columnIndexFromString($current[0]) - PHPExcel_Cell::columnIndexFromString($master[0]); |
| 405 | 405 | $difference[1] = $current[1] - $master[1]; |
| 406 | 406 | |
| 407 | - $value = $this->_referenceHelper->updateFormulaReferences( $sharedFormulas[$instance]['formula'], |
|
| 407 | + $value = $this->_referenceHelper->updateFormulaReferences($sharedFormulas[$instance]['formula'], |
|
| 408 | 408 | 'A1', |
| 409 | 409 | $difference[0], |
| 410 | 410 | $difference[1] |
@@ -444,8 +444,8 @@ discard block |
||
| 444 | 444 | public function listWorksheetNames($pFilename) |
| 445 | 445 | { |
| 446 | 446 | // Check if file exists |
| 447 | - if (!file_exists($pFilename)) { |
|
| 448 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 447 | + if ( ! file_exists($pFilename)) { |
|
| 448 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | $worksheetNames = array(); |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | foreach ($rels->Relationship as $rel) { |
| 458 | 458 | switch ($rel["Type"]) { |
| 459 | 459 | case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": |
| 460 | - $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 460 | + $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 461 | 461 | |
| 462 | 462 | if ($xmlWorkbook->sheets) { |
| 463 | 463 | foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { |
@@ -483,14 +483,14 @@ discard block |
||
| 483 | 483 | public function load($pFilename) |
| 484 | 484 | { |
| 485 | 485 | // Check if file exists |
| 486 | - if (!file_exists($pFilename)) { |
|
| 487 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 486 | + if ( ! file_exists($pFilename)) { |
|
| 487 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | // Initialisations |
| 491 | 491 | $excel = new PHPExcel; |
| 492 | 492 | $excel->removeSheetByIndex(0); |
| 493 | - if (!$this->_readDataOnly) { |
|
| 493 | + if ( ! $this->_readDataOnly) { |
|
| 494 | 494 | $excel->removeCellStyleXfByIndex(0); // remove the default style |
| 495 | 495 | $excel->removeCellXfByIndex(0); // remove the default style |
| 496 | 496 | } |
@@ -502,22 +502,22 @@ discard block |
||
| 502 | 502 | foreach ($wbRels->Relationship as $rel) { |
| 503 | 503 | switch ($rel["Type"]) { |
| 504 | 504 | case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme": |
| 505 | - $themeOrderArray = array('lt1','dk1','lt2','dk2'); |
|
| 505 | + $themeOrderArray = array('lt1', 'dk1', 'lt2', 'dk2'); |
|
| 506 | 506 | $themeOrderAdditional = count($themeOrderArray); |
| 507 | 507 | |
| 508 | 508 | $xmlTheme = simplexml_load_string($this->_getFromZipArchive($zip, "xl/{$rel['Target']}")); |
| 509 | 509 | if (is_object($xmlTheme)) { |
| 510 | 510 | $xmlThemeName = $xmlTheme->attributes(); |
| 511 | 511 | $xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main"); |
| 512 | - $themeName = (string)$xmlThemeName['name']; |
|
| 512 | + $themeName = (string) $xmlThemeName['name']; |
|
| 513 | 513 | |
| 514 | 514 | $colourScheme = $xmlTheme->themeElements->clrScheme->attributes(); |
| 515 | - $colourSchemeName = (string)$colourScheme['name']; |
|
| 515 | + $colourSchemeName = (string) $colourScheme['name']; |
|
| 516 | 516 | $colourScheme = $xmlTheme->themeElements->clrScheme->children("http://schemas.openxmlformats.org/drawingml/2006/main"); |
| 517 | 517 | |
| 518 | 518 | $themeColours = array(); |
| 519 | 519 | foreach ($colourScheme as $k => $xmlColour) { |
| 520 | - $themePos = array_search($k,$themeOrderArray); |
|
| 520 | + $themePos = array_search($k, $themeOrderArray); |
|
| 521 | 521 | if ($themePos === false) { |
| 522 | 522 | $themePos = $themeOrderAdditional++; |
| 523 | 523 | } |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $themeColours[$themePos] = $xmlColourData['val']; |
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | - self::$_theme = new PHPExcel_Reader_Excel2007_Theme($themeName,$colourSchemeName,$themeColours); |
|
| 532 | + self::$_theme = new PHPExcel_Reader_Excel2007_Theme($themeName, $colourSchemeName, $themeColours); |
|
| 533 | 533 | } |
| 534 | 534 | break; |
| 535 | 535 | } |
@@ -579,9 +579,9 @@ discard block |
||
| 579 | 579 | $cellDataOfficeChildren = $xmlProperty->children('http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes'); |
| 580 | 580 | $attributeType = $cellDataOfficeChildren->getName(); |
| 581 | 581 | $attributeValue = (string) $cellDataOfficeChildren->{$attributeType}; |
| 582 | - $attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue,$attributeType); |
|
| 582 | + $attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue, $attributeType); |
|
| 583 | 583 | $attributeType = PHPExcel_DocumentProperties::convertPropertyType($attributeType); |
| 584 | - $docProps->setCustomProperty($propertyName,$attributeValue,$attributeType); |
|
| 584 | + $docProps->setCustomProperty($propertyName, $attributeValue, $attributeType); |
|
| 585 | 585 | } |
| 586 | 586 | } |
| 587 | 587 | } |
@@ -589,16 +589,16 @@ discard block |
||
| 589 | 589 | |
| 590 | 590 | case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": |
| 591 | 591 | $dir = dirname($rel["Target"]); |
| 592 | - $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 592 | + $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/".basename($rel["Target"]).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 593 | 593 | $relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships"); |
| 594 | 594 | |
| 595 | 595 | $sharedStrings = array(); |
| 596 | 596 | $xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']")); |
| 597 | - $xmlStrings = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 597 | + $xmlStrings = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 598 | 598 | if (isset($xmlStrings) && isset($xmlStrings->si)) { |
| 599 | 599 | foreach ($xmlStrings->si as $val) { |
| 600 | 600 | if (isset($val->t)) { |
| 601 | - $sharedStrings[] = PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $val->t ); |
|
| 601 | + $sharedStrings[] = PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $val->t); |
|
| 602 | 602 | } elseif (isset($val->r)) { |
| 603 | 603 | $sharedStrings[] = $this->_parseRichText($val); |
| 604 | 604 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - $styles = array(); |
|
| 615 | + $styles = array(); |
|
| 616 | 616 | $cellStyles = array(); |
| 617 | 617 | $xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']")); |
| 618 | 618 | $xmlStyles = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | if (isset($numFmts) && ($numFmts !== NULL)) { |
| 624 | 624 | $numFmts->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
| 625 | 625 | } |
| 626 | - if (!$this->_readDataOnly && $xmlStyles) { |
|
| 626 | + if ( ! $this->_readDataOnly && $xmlStyles) { |
|
| 627 | 627 | foreach ($xmlStyles->cellXfs->xf as $xf) { |
| 628 | 628 | $numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; |
| 629 | 629 | |
@@ -636,8 +636,8 @@ discard block |
||
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | - if ((int)$xf["numFmtId"] < 164) { |
|
| 640 | - $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); |
|
| 639 | + if ((int) $xf["numFmtId"] < 164) { |
|
| 640 | + $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int) $xf["numFmtId"]); |
|
| 641 | 641 | } |
| 642 | 642 | } |
| 643 | 643 | //$numFmt = str_replace('mm', 'i', $numFmt); |
@@ -665,8 +665,8 @@ discard block |
||
| 665 | 665 | $tmpNumFmt = self::array_item($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); |
| 666 | 666 | if (isset($tmpNumFmt["formatCode"])) { |
| 667 | 667 | $numFmt = (string) $tmpNumFmt["formatCode"]; |
| 668 | - } else if ((int)$xf["numFmtId"] < 165) { |
|
| 669 | - $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); |
|
| 668 | + } else if ((int) $xf["numFmtId"] < 165) { |
|
| 669 | + $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int) $xf["numFmtId"]); |
|
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | 672 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | $dxfs = array(); |
| 691 | - if (!$this->_readDataOnly && $xmlStyles) { |
|
| 691 | + if ( ! $this->_readDataOnly && $xmlStyles) { |
|
| 692 | 692 | if ($xmlStyles->dxfs) { |
| 693 | 693 | foreach ($xmlStyles->dxfs->dxf as $dxf) { |
| 694 | 694 | $style = new PHPExcel_Style; |
@@ -713,13 +713,13 @@ discard block |
||
| 713 | 713 | } |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | - $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 716 | + $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 717 | 717 | |
| 718 | 718 | // Set base date |
| 719 | 719 | if ($xmlWorkbook->workbookPr) { |
| 720 | 720 | PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); |
| 721 | 721 | if (isset($xmlWorkbook->workbookPr['date1904'])) { |
| 722 | - $date1904 = (string)$xmlWorkbook->workbookPr['date1904']; |
|
| 722 | + $date1904 = (string) $xmlWorkbook->workbookPr['date1904']; |
|
| 723 | 723 | if ($date1904 == "true" || $date1904 == "1") { |
| 724 | 724 | PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); |
| 725 | 725 | } |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | ++$oldSheetId; |
| 740 | 740 | |
| 741 | 741 | // Check if sheet should be skipped |
| 742 | - if (isset($this->_loadSheetsOnly) && !in_array((string) $eleSheet["name"], $this->_loadSheetsOnly)) { |
|
| 742 | + if (isset($this->_loadSheetsOnly) && ! in_array((string) $eleSheet["name"], $this->_loadSheetsOnly)) { |
|
| 743 | 743 | ++$countSkippedSheets; |
| 744 | 744 | $mapSheetId[$oldSheetId] = null; |
| 745 | 745 | continue; |
@@ -755,40 +755,40 @@ discard block |
||
| 755 | 755 | // references in formula cells... during the load, all formulae should be correct, |
| 756 | 756 | // and we're simply bringing the worksheet name in line with the formula, not the |
| 757 | 757 | // reverse |
| 758 | - $docSheet->setTitle((string) $eleSheet["name"],false); |
|
| 758 | + $docSheet->setTitle((string) $eleSheet["name"], false); |
|
| 759 | 759 | $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; |
| 760 | - $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 760 | + $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
|
| 761 | 761 | |
| 762 | 762 | $sharedFormulas = array(); |
| 763 | 763 | |
| 764 | 764 | if (isset($eleSheet["state"]) && (string) $eleSheet["state"] != '') { |
| 765 | - $docSheet->setSheetState( (string) $eleSheet["state"] ); |
|
| 765 | + $docSheet->setSheetState((string) $eleSheet["state"]); |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | if (isset($xmlSheet->sheetViews) && isset($xmlSheet->sheetViews->sheetView)) { |
| 769 | 769 | if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) { |
| 770 | - $docSheet->getSheetView()->setZoomScale( intval($xmlSheet->sheetViews->sheetView['zoomScale']) ); |
|
| 770 | + $docSheet->getSheetView()->setZoomScale(intval($xmlSheet->sheetViews->sheetView['zoomScale'])); |
|
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) { |
| 774 | - $docSheet->getSheetView()->setZoomScaleNormal( intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']) ); |
|
| 774 | + $docSheet->getSheetView()->setZoomScaleNormal(intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])); |
|
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) { |
| 778 | - $docSheet->setShowGridLines((string)$xmlSheet->sheetViews->sheetView['showGridLines'] ? true : false); |
|
| 778 | + $docSheet->setShowGridLines((string) $xmlSheet->sheetViews->sheetView['showGridLines'] ? true : false); |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | if (isset($xmlSheet->sheetViews->sheetView['showRowColHeaders'])) { |
| 782 | - $docSheet->setShowRowColHeaders((string)$xmlSheet->sheetViews->sheetView['showRowColHeaders'] ? true : false); |
|
| 782 | + $docSheet->setShowRowColHeaders((string) $xmlSheet->sheetViews->sheetView['showRowColHeaders'] ? true : false); |
|
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | if (isset($xmlSheet->sheetViews->sheetView['rightToLeft'])) { |
| 786 | - $docSheet->setRightToLeft((string)$xmlSheet->sheetViews->sheetView['rightToLeft'] ? true : false); |
|
| 786 | + $docSheet->setRightToLeft((string) $xmlSheet->sheetViews->sheetView['rightToLeft'] ? true : false); |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | if (isset($xmlSheet->sheetViews->sheetView->pane)) { |
| 790 | 790 | if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) { |
| 791 | - $docSheet->freezePane( (string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell'] ); |
|
| 791 | + $docSheet->freezePane((string) $xmlSheet->sheetViews->sheetView->pane['topLeftCell']); |
|
| 792 | 792 | } else { |
| 793 | 793 | $xSplit = 0; |
| 794 | 794 | $ySplit = 0; |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | |
| 808 | 808 | if (isset($xmlSheet->sheetViews->sheetView->selection)) { |
| 809 | 809 | if (isset($xmlSheet->sheetViews->sheetView->selection['sqref'])) { |
| 810 | - $sqref = (string)$xmlSheet->sheetViews->sheetView->selection['sqref']; |
|
| 810 | + $sqref = (string) $xmlSheet->sheetViews->sheetView->selection['sqref']; |
|
| 811 | 811 | $sqref = explode(' ', $sqref); |
| 812 | 812 | $sqref = $sqref[0]; |
| 813 | 813 | $docSheet->setSelectedCells($sqref); |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | |
| 819 | 819 | if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->tabColor)) { |
| 820 | 820 | if (isset($xmlSheet->sheetPr->tabColor['rgb'])) { |
| 821 | - $docSheet->getTabColor()->setARGB( (string)$xmlSheet->sheetPr->tabColor['rgb'] ); |
|
| 821 | + $docSheet->getTabColor()->setARGB((string) $xmlSheet->sheetPr->tabColor['rgb']); |
|
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | |
@@ -845,18 +845,18 @@ discard block |
||
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | if (isset($xmlSheet->sheetFormatPr)) { |
| 848 | - if (isset($xmlSheet->sheetFormatPr['customHeight']) && ((string)$xmlSheet->sheetFormatPr['customHeight'] == '1' || strtolower((string)$xmlSheet->sheetFormatPr['customHeight']) == 'true') && isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) { |
|
| 849 | - $docSheet->getDefaultRowDimension()->setRowHeight( (float)$xmlSheet->sheetFormatPr['defaultRowHeight'] ); |
|
| 848 | + if (isset($xmlSheet->sheetFormatPr['customHeight']) && ((string) $xmlSheet->sheetFormatPr['customHeight'] == '1' || strtolower((string) $xmlSheet->sheetFormatPr['customHeight']) == 'true') && isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) { |
|
| 849 | + $docSheet->getDefaultRowDimension()->setRowHeight((float) $xmlSheet->sheetFormatPr['defaultRowHeight']); |
|
| 850 | 850 | } |
| 851 | 851 | if (isset($xmlSheet->sheetFormatPr['defaultColWidth'])) { |
| 852 | - $docSheet->getDefaultColumnDimension()->setWidth( (float)$xmlSheet->sheetFormatPr['defaultColWidth'] ); |
|
| 852 | + $docSheet->getDefaultColumnDimension()->setWidth((float) $xmlSheet->sheetFormatPr['defaultColWidth']); |
|
| 853 | 853 | } |
| 854 | 854 | } |
| 855 | 855 | |
| 856 | - if (isset($xmlSheet->cols) && !$this->_readDataOnly) { |
|
| 856 | + if (isset($xmlSheet->cols) && ! $this->_readDataOnly) { |
|
| 857 | 857 | foreach ($xmlSheet->cols->col as $col) { |
| 858 | 858 | for ($i = intval($col["min"]) - 1; $i < intval($col["max"]); ++$i) { |
| 859 | - if ($col["style"] && !$this->_readDataOnly) { |
|
| 859 | + if ($col["style"] && ! $this->_readDataOnly) { |
|
| 860 | 860 | $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setXfIndex(intval($col["style"])); |
| 861 | 861 | } |
| 862 | 862 | if ($col["bestFit"]) { |
@@ -880,7 +880,7 @@ discard block |
||
| 880 | 880 | } |
| 881 | 881 | } |
| 882 | 882 | |
| 883 | - if (isset($xmlSheet->printOptions) && !$this->_readDataOnly) { |
|
| 883 | + if (isset($xmlSheet->printOptions) && ! $this->_readDataOnly) { |
|
| 884 | 884 | if ($xmlSheet->printOptions['gridLinesSet'] == 'true' && $xmlSheet->printOptions['gridLinesSet'] == '1') { |
| 885 | 885 | $docSheet->setShowGridlines(true); |
| 886 | 886 | } |
@@ -899,10 +899,10 @@ discard block |
||
| 899 | 899 | |
| 900 | 900 | if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) { |
| 901 | 901 | foreach ($xmlSheet->sheetData->row as $row) { |
| 902 | - if ($row["ht"] && !$this->_readDataOnly) { |
|
| 902 | + if ($row["ht"] && ! $this->_readDataOnly) { |
|
| 903 | 903 | $docSheet->getRowDimension(intval($row["r"]))->setRowHeight(floatval($row["ht"])); |
| 904 | 904 | } |
| 905 | - if ($row["hidden"] && !$this->_readDataOnly) { |
|
| 905 | + if ($row["hidden"] && ! $this->_readDataOnly) { |
|
| 906 | 906 | $docSheet->getRowDimension(intval($row["r"]))->setVisible(false); |
| 907 | 907 | } |
| 908 | 908 | if ($row["collapsed"]) { |
@@ -911,21 +911,21 @@ discard block |
||
| 911 | 911 | if ($row["outlineLevel"] > 0) { |
| 912 | 912 | $docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"])); |
| 913 | 913 | } |
| 914 | - if ($row["s"] && !$this->_readDataOnly) { |
|
| 914 | + if ($row["s"] && ! $this->_readDataOnly) { |
|
| 915 | 915 | $docSheet->getRowDimension(intval($row["r"]))->setXfIndex(intval($row["s"])); |
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | foreach ($row->c as $c) { |
| 919 | - $r = (string) $c["r"]; |
|
| 920 | - $cellDataType = (string) $c["t"]; |
|
| 921 | - $value = null; |
|
| 922 | - $calculatedValue = null; |
|
| 919 | + $r = (string) $c["r"]; |
|
| 920 | + $cellDataType = (string) $c["t"]; |
|
| 921 | + $value = null; |
|
| 922 | + $calculatedValue = null; |
|
| 923 | 923 | |
| 924 | 924 | // Read cell? |
| 925 | 925 | if ($this->getReadFilter() !== NULL) { |
| 926 | 926 | $coordinates = PHPExcel_Cell::coordinateFromString($r); |
| 927 | 927 | |
| 928 | - if (!$this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) { |
|
| 928 | + if ( ! $this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) { |
|
| 929 | 929 | continue; |
| 930 | 930 | } |
| 931 | 931 | } |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | switch ($cellDataType) { |
| 940 | 940 | case "s": |
| 941 | 941 | // echo 'String<br />'; |
| 942 | - if ((string)$c->v != '') { |
|
| 942 | + if ((string) $c->v != '') { |
|
| 943 | 943 | $value = $sharedStrings[intval($c->v)]; |
| 944 | 944 | |
| 945 | 945 | if ($value instanceof PHPExcel_RichText) { |
@@ -952,11 +952,11 @@ discard block |
||
| 952 | 952 | break; |
| 953 | 953 | case "b": |
| 954 | 954 | // echo 'Boolean<br />'; |
| 955 | - if (!isset($c->f)) { |
|
| 955 | + if ( ! isset($c->f)) { |
|
| 956 | 956 | $value = self::_castToBool($c); |
| 957 | 957 | } else { |
| 958 | 958 | // Formula |
| 959 | - $this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToBool'); |
|
| 959 | + $this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, '_castToBool'); |
|
| 960 | 960 | if (isset($c->f['t'])) { |
| 961 | 961 | $att = array(); |
| 962 | 962 | $att = $c->f; |
@@ -972,11 +972,11 @@ discard block |
||
| 972 | 972 | break; |
| 973 | 973 | case "e": |
| 974 | 974 | // echo 'Error<br />'; |
| 975 | - if (!isset($c->f)) { |
|
| 975 | + if ( ! isset($c->f)) { |
|
| 976 | 976 | $value = self::_castToError($c); |
| 977 | 977 | } else { |
| 978 | 978 | // Formula |
| 979 | - $this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToError'); |
|
| 979 | + $this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, '_castToError'); |
|
| 980 | 980 | // echo '$calculatedValue = '.$calculatedValue.'<br />'; |
| 981 | 981 | } |
| 982 | 982 | |
@@ -984,13 +984,13 @@ discard block |
||
| 984 | 984 | |
| 985 | 985 | default: |
| 986 | 986 | // echo 'Default<br />'; |
| 987 | - if (!isset($c->f)) { |
|
| 987 | + if ( ! isset($c->f)) { |
|
| 988 | 988 | // echo 'Not a Formula<br />'; |
| 989 | 989 | $value = self::_castToString($c); |
| 990 | 990 | } else { |
| 991 | 991 | // echo 'Treat as Formula<br />'; |
| 992 | 992 | // Formula |
| 993 | - $this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToString'); |
|
| 993 | + $this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, '_castToString'); |
|
| 994 | 994 | // echo '$calculatedValue = '.$calculatedValue.'<br />'; |
| 995 | 995 | } |
| 996 | 996 | |
@@ -1000,9 +1000,9 @@ discard block |
||
| 1000 | 1000 | |
| 1001 | 1001 | // Check for numeric values |
| 1002 | 1002 | if (is_numeric($value) && $cellDataType != 's') { |
| 1003 | - if ($value == (int)$value) $value = (int)$value; |
|
| 1004 | - elseif ($value == (float)$value) $value = (float)$value; |
|
| 1005 | - elseif ($value == (double)$value) $value = (double)$value; |
|
| 1003 | + if ($value == (int) $value) $value = (int) $value; |
|
| 1004 | + elseif ($value == (float) $value) $value = (float) $value; |
|
| 1005 | + elseif ($value == (double) $value) $value = (double) $value; |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | // Rich text? |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | // Style information? |
| 1025 | - if ($c["s"] && !$this->_readDataOnly) { |
|
| 1025 | + if ($c["s"] && ! $this->_readDataOnly) { |
|
| 1026 | 1026 | // no style index means 0, it seems |
| 1027 | 1027 | $cell->setXfIndex(isset($styles[intval($c["s"])]) ? |
| 1028 | 1028 | intval($c["s"]) : 0); |
@@ -1032,15 +1032,15 @@ discard block |
||
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | $conditionals = array(); |
| 1035 | - if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { |
|
| 1035 | + if ( ! $this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { |
|
| 1036 | 1036 | foreach ($xmlSheet->conditionalFormatting as $conditional) { |
| 1037 | 1037 | foreach ($conditional->cfRule as $cfRule) { |
| 1038 | 1038 | if ( |
| 1039 | 1039 | ( |
| 1040 | - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || |
|
| 1041 | - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || |
|
| 1042 | - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || |
|
| 1043 | - (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION |
|
| 1040 | + (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || |
|
| 1041 | + (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || |
|
| 1042 | + (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || |
|
| 1043 | + (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION |
|
| 1044 | 1044 | ) && isset($dxfs[intval($cfRule["dxfId"])]) |
| 1045 | 1045 | ) { |
| 1046 | 1046 | $conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule; |
@@ -1053,19 +1053,19 @@ discard block |
||
| 1053 | 1053 | $conditionalStyles = array(); |
| 1054 | 1054 | foreach ($cfRules as $cfRule) { |
| 1055 | 1055 | $objConditional = new PHPExcel_Style_Conditional(); |
| 1056 | - $objConditional->setConditionType((string)$cfRule["type"]); |
|
| 1057 | - $objConditional->setOperatorType((string)$cfRule["operator"]); |
|
| 1056 | + $objConditional->setConditionType((string) $cfRule["type"]); |
|
| 1057 | + $objConditional->setOperatorType((string) $cfRule["operator"]); |
|
| 1058 | 1058 | |
| 1059 | - if ((string)$cfRule["text"] != '') { |
|
| 1060 | - $objConditional->setText((string)$cfRule["text"]); |
|
| 1059 | + if ((string) $cfRule["text"] != '') { |
|
| 1060 | + $objConditional->setText((string) $cfRule["text"]); |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | if (count($cfRule->formula) > 1) { |
| 1064 | 1064 | foreach ($cfRule->formula as $formula) { |
| 1065 | - $objConditional->addCondition((string)$formula); |
|
| 1065 | + $objConditional->addCondition((string) $formula); |
|
| 1066 | 1066 | } |
| 1067 | 1067 | } else { |
| 1068 | - $objConditional->addCondition((string)$cfRule->formula); |
|
| 1068 | + $objConditional->addCondition((string) $cfRule->formula); |
|
| 1069 | 1069 | } |
| 1070 | 1070 | $objConditional->setStyle(clone $dxfs[intval($cfRule["dxfId"])]); |
| 1071 | 1071 | $conditionalStyles[] = $objConditional; |
@@ -1080,14 +1080,14 @@ discard block |
||
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | $aKeys = array("sheet", "objects", "scenarios", "formatCells", "formatColumns", "formatRows", "insertColumns", "insertRows", "insertHyperlinks", "deleteColumns", "deleteRows", "selectLockedCells", "sort", "autoFilter", "pivotTables", "selectUnlockedCells"); |
| 1083 | - if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { |
|
| 1083 | + if ( ! $this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { |
|
| 1084 | 1084 | foreach ($aKeys as $key) { |
| 1085 | - $method = "set" . ucfirst($key); |
|
| 1085 | + $method = "set".ucfirst($key); |
|
| 1086 | 1086 | $docSheet->getProtection()->$method($xmlSheet->sheetProtection[$key] == "true"); |
| 1087 | 1087 | } |
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | - if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { |
|
| 1090 | + if ( ! $this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { |
|
| 1091 | 1091 | $docSheet->getProtection()->setPassword((string) $xmlSheet->sheetProtection["password"], true); |
| 1092 | 1092 | if ($xmlSheet->protectedRanges->protectedRange) { |
| 1093 | 1093 | foreach ($xmlSheet->protectedRanges->protectedRange as $protectedRange) { |
@@ -1096,17 +1096,17 @@ discard block |
||
| 1096 | 1096 | } |
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | - if ($xmlSheet && $xmlSheet->autoFilter && !$this->_readDataOnly) { |
|
| 1099 | + if ($xmlSheet && $xmlSheet->autoFilter && ! $this->_readDataOnly) { |
|
| 1100 | 1100 | $docSheet->setAutoFilter((string) $xmlSheet->autoFilter["ref"]); |
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | - if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->_readDataOnly) { |
|
| 1103 | + if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && ! $this->_readDataOnly) { |
|
| 1104 | 1104 | foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) { |
| 1105 | 1105 | $docSheet->mergeCells((string) $mergeCell["ref"]); |
| 1106 | 1106 | } |
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | - if ($xmlSheet && $xmlSheet->pageMargins && !$this->_readDataOnly) { |
|
| 1109 | + if ($xmlSheet && $xmlSheet->pageMargins && ! $this->_readDataOnly) { |
|
| 1110 | 1110 | $docPageMargins = $docSheet->getPageMargins(); |
| 1111 | 1111 | $docPageMargins->setLeft(floatval($xmlSheet->pageMargins["left"])); |
| 1112 | 1112 | $docPageMargins->setRight(floatval($xmlSheet->pageMargins["right"])); |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | $docPageMargins->setFooter(floatval($xmlSheet->pageMargins["footer"])); |
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | - if ($xmlSheet && $xmlSheet->pageSetup && !$this->_readDataOnly) { |
|
| 1119 | + if ($xmlSheet && $xmlSheet->pageSetup && ! $this->_readDataOnly) { |
|
| 1120 | 1120 | $docPageSetup = $docSheet->getPageSetup(); |
| 1121 | 1121 | |
| 1122 | 1122 | if (isset($xmlSheet->pageSetup["orientation"])) { |
@@ -1135,34 +1135,34 @@ discard block |
||
| 1135 | 1135 | $docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup["fitToWidth"]), false); |
| 1136 | 1136 | } |
| 1137 | 1137 | if (isset($xmlSheet->pageSetup["firstPageNumber"]) && isset($xmlSheet->pageSetup["useFirstPageNumber"]) && |
| 1138 | - ((string)$xmlSheet->pageSetup["useFirstPageNumber"] == 'true' || (string)$xmlSheet->pageSetup["useFirstPageNumber"] == '1')) { |
|
| 1138 | + ((string) $xmlSheet->pageSetup["useFirstPageNumber"] == 'true' || (string) $xmlSheet->pageSetup["useFirstPageNumber"] == '1')) { |
|
| 1139 | 1139 | $docPageSetup->setFirstPageNumber(intval($xmlSheet->pageSetup["firstPageNumber"])); |
| 1140 | 1140 | } |
| 1141 | 1141 | } |
| 1142 | 1142 | |
| 1143 | - if ($xmlSheet && $xmlSheet->headerFooter && !$this->_readDataOnly) { |
|
| 1143 | + if ($xmlSheet && $xmlSheet->headerFooter && ! $this->_readDataOnly) { |
|
| 1144 | 1144 | $docHeaderFooter = $docSheet->getHeaderFooter(); |
| 1145 | 1145 | |
| 1146 | 1146 | if (isset($xmlSheet->headerFooter["differentOddEven"]) && |
| 1147 | - ((string)$xmlSheet->headerFooter["differentOddEven"] == 'true' || (string)$xmlSheet->headerFooter["differentOddEven"] == '1')) { |
|
| 1147 | + ((string) $xmlSheet->headerFooter["differentOddEven"] == 'true' || (string) $xmlSheet->headerFooter["differentOddEven"] == '1')) { |
|
| 1148 | 1148 | $docHeaderFooter->setDifferentOddEven(true); |
| 1149 | 1149 | } else { |
| 1150 | 1150 | $docHeaderFooter->setDifferentOddEven(false); |
| 1151 | 1151 | } |
| 1152 | 1152 | if (isset($xmlSheet->headerFooter["differentFirst"]) && |
| 1153 | - ((string)$xmlSheet->headerFooter["differentFirst"] == 'true' || (string)$xmlSheet->headerFooter["differentFirst"] == '1')) { |
|
| 1153 | + ((string) $xmlSheet->headerFooter["differentFirst"] == 'true' || (string) $xmlSheet->headerFooter["differentFirst"] == '1')) { |
|
| 1154 | 1154 | $docHeaderFooter->setDifferentFirst(true); |
| 1155 | 1155 | } else { |
| 1156 | 1156 | $docHeaderFooter->setDifferentFirst(false); |
| 1157 | 1157 | } |
| 1158 | 1158 | if (isset($xmlSheet->headerFooter["scaleWithDoc"]) && |
| 1159 | - ((string)$xmlSheet->headerFooter["scaleWithDoc"] == 'false' || (string)$xmlSheet->headerFooter["scaleWithDoc"] == '0')) { |
|
| 1159 | + ((string) $xmlSheet->headerFooter["scaleWithDoc"] == 'false' || (string) $xmlSheet->headerFooter["scaleWithDoc"] == '0')) { |
|
| 1160 | 1160 | $docHeaderFooter->setScaleWithDocument(false); |
| 1161 | 1161 | } else { |
| 1162 | 1162 | $docHeaderFooter->setScaleWithDocument(true); |
| 1163 | 1163 | } |
| 1164 | 1164 | if (isset($xmlSheet->headerFooter["alignWithMargins"]) && |
| 1165 | - ((string)$xmlSheet->headerFooter["alignWithMargins"] == 'false' || (string)$xmlSheet->headerFooter["alignWithMargins"] == '0')) { |
|
| 1165 | + ((string) $xmlSheet->headerFooter["alignWithMargins"] == 'false' || (string) $xmlSheet->headerFooter["alignWithMargins"] == '0')) { |
|
| 1166 | 1166 | $docHeaderFooter->setAlignWithMargins(false); |
| 1167 | 1167 | } else { |
| 1168 | 1168 | $docHeaderFooter->setAlignWithMargins(true); |
@@ -1176,27 +1176,27 @@ discard block |
||
| 1176 | 1176 | $docHeaderFooter->setFirstFooter((string) $xmlSheet->headerFooter->firstFooter); |
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | - if ($xmlSheet && $xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk && !$this->_readDataOnly) { |
|
| 1179 | + if ($xmlSheet && $xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk && ! $this->_readDataOnly) { |
|
| 1180 | 1180 | foreach ($xmlSheet->rowBreaks->brk as $brk) { |
| 1181 | 1181 | if ($brk["man"]) { |
| 1182 | 1182 | $docSheet->setBreak("A$brk[id]", PHPExcel_Worksheet::BREAK_ROW); |
| 1183 | 1183 | } |
| 1184 | 1184 | } |
| 1185 | 1185 | } |
| 1186 | - if ($xmlSheet && $xmlSheet->colBreaks && $xmlSheet->colBreaks->brk && !$this->_readDataOnly) { |
|
| 1186 | + if ($xmlSheet && $xmlSheet->colBreaks && $xmlSheet->colBreaks->brk && ! $this->_readDataOnly) { |
|
| 1187 | 1187 | foreach ($xmlSheet->colBreaks->brk as $brk) { |
| 1188 | 1188 | if ($brk["man"]) { |
| 1189 | - $docSheet->setBreak(PHPExcel_Cell::stringFromColumnIndex($brk["id"]) . "1", PHPExcel_Worksheet::BREAK_COLUMN); |
|
| 1189 | + $docSheet->setBreak(PHPExcel_Cell::stringFromColumnIndex($brk["id"])."1", PHPExcel_Worksheet::BREAK_COLUMN); |
|
| 1190 | 1190 | } |
| 1191 | 1191 | } |
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | - if ($xmlSheet && $xmlSheet->dataValidations && !$this->_readDataOnly) { |
|
| 1194 | + if ($xmlSheet && $xmlSheet->dataValidations && ! $this->_readDataOnly) { |
|
| 1195 | 1195 | foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation) { |
| 1196 | 1196 | // Uppercase coordinate |
| 1197 | 1197 | $range = strtoupper($dataValidation["sqref"]); |
| 1198 | - $rangeSet = explode(' ',$range); |
|
| 1199 | - foreach($rangeSet as $range) { |
|
| 1198 | + $rangeSet = explode(' ', $range); |
|
| 1199 | + foreach ($rangeSet as $range) { |
|
| 1200 | 1200 | $stRange = $docSheet->shrinkRangeToFit($range); |
| 1201 | 1201 | |
| 1202 | 1202 | // Extract all cell references in $range |
@@ -1224,13 +1224,13 @@ discard block |
||
| 1224 | 1224 | |
| 1225 | 1225 | // Add hyperlinks |
| 1226 | 1226 | $hyperlinks = array(); |
| 1227 | - if (!$this->_readDataOnly) { |
|
| 1227 | + if ( ! $this->_readDataOnly) { |
|
| 1228 | 1228 | // Locate hyperlink relations |
| 1229 | - if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { |
|
| 1230 | - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1229 | + if ($zip->locateName(dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")) { |
|
| 1230 | + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1231 | 1231 | foreach ($relsWorksheet->Relationship as $ele) { |
| 1232 | 1232 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") { |
| 1233 | - $hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"]; |
|
| 1233 | + $hyperlinks[(string) $ele["Id"]] = (string) $ele["Target"]; |
|
| 1234 | 1234 | } |
| 1235 | 1235 | } |
| 1236 | 1236 | } |
@@ -1242,17 +1242,17 @@ discard block |
||
| 1242 | 1242 | $linkRel = $hyperlink->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'); |
| 1243 | 1243 | |
| 1244 | 1244 | foreach (PHPExcel_Cell::extractAllCellReferencesInRange($hyperlink['ref']) as $cellReference) { |
| 1245 | - $cell = $docSheet->getCell( $cellReference ); |
|
| 1245 | + $cell = $docSheet->getCell($cellReference); |
|
| 1246 | 1246 | if (isset($linkRel['id'])) { |
| 1247 | - $cell->getHyperlink()->setUrl( $hyperlinks[ (string)$linkRel['id'] ] ); |
|
| 1247 | + $cell->getHyperlink()->setUrl($hyperlinks[(string) $linkRel['id']]); |
|
| 1248 | 1248 | } |
| 1249 | 1249 | if (isset($hyperlink['location'])) { |
| 1250 | - $cell->getHyperlink()->setUrl( 'sheet://' . (string)$hyperlink['location'] ); |
|
| 1250 | + $cell->getHyperlink()->setUrl('sheet://'.(string) $hyperlink['location']); |
|
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | 1253 | // Tooltip |
| 1254 | 1254 | if (isset($hyperlink['tooltip'])) { |
| 1255 | - $cell->getHyperlink()->setTooltip( (string)$hyperlink['tooltip'] ); |
|
| 1255 | + $cell->getHyperlink()->setTooltip((string) $hyperlink['tooltip']); |
|
| 1256 | 1256 | } |
| 1257 | 1257 | } |
| 1258 | 1258 | } |
@@ -1262,16 +1262,16 @@ discard block |
||
| 1262 | 1262 | // Add comments |
| 1263 | 1263 | $comments = array(); |
| 1264 | 1264 | $vmlComments = array(); |
| 1265 | - if (!$this->_readDataOnly) { |
|
| 1265 | + if ( ! $this->_readDataOnly) { |
|
| 1266 | 1266 | // Locate comment relations |
| 1267 | - if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { |
|
| 1268 | - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1267 | + if ($zip->locateName(dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")) { |
|
| 1268 | + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1269 | 1269 | foreach ($relsWorksheet->Relationship as $ele) { |
| 1270 | 1270 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") { |
| 1271 | - $comments[(string)$ele["Id"]] = (string)$ele["Target"]; |
|
| 1271 | + $comments[(string) $ele["Id"]] = (string) $ele["Target"]; |
|
| 1272 | 1272 | } |
| 1273 | 1273 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") { |
| 1274 | - $vmlComments[(string)$ele["Id"]] = (string)$ele["Target"]; |
|
| 1274 | + $vmlComments[(string) $ele["Id"]] = (string) $ele["Target"]; |
|
| 1275 | 1275 | } |
| 1276 | 1276 | } |
| 1277 | 1277 | } |
@@ -1279,29 +1279,29 @@ discard block |
||
| 1279 | 1279 | // Loop through comments |
| 1280 | 1280 | foreach ($comments as $relName => $relPath) { |
| 1281 | 1281 | // Load comments file |
| 1282 | - $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); |
|
| 1283 | - $commentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath) ); |
|
| 1282 | + $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet")."/".$relPath); |
|
| 1283 | + $commentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath)); |
|
| 1284 | 1284 | |
| 1285 | 1285 | // Utility variables |
| 1286 | 1286 | $authors = array(); |
| 1287 | 1287 | |
| 1288 | 1288 | // Loop through authors |
| 1289 | 1289 | foreach ($commentsFile->authors->author as $author) { |
| 1290 | - $authors[] = (string)$author; |
|
| 1290 | + $authors[] = (string) $author; |
|
| 1291 | 1291 | } |
| 1292 | 1292 | |
| 1293 | 1293 | // Loop through contents |
| 1294 | 1294 | foreach ($commentsFile->commentList->comment as $comment) { |
| 1295 | - $docSheet->getComment( (string)$comment['ref'] )->setAuthor( $authors[(string)$comment['authorId']] ); |
|
| 1296 | - $docSheet->getComment( (string)$comment['ref'] )->setText( $this->_parseRichText($comment->text) ); |
|
| 1295 | + $docSheet->getComment((string) $comment['ref'])->setAuthor($authors[(string) $comment['authorId']]); |
|
| 1296 | + $docSheet->getComment((string) $comment['ref'])->setText($this->_parseRichText($comment->text)); |
|
| 1297 | 1297 | } |
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | 1300 | // Loop through VML comments |
| 1301 | 1301 | foreach ($vmlComments as $relName => $relPath) { |
| 1302 | 1302 | // Load VML comments file |
| 1303 | - $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); |
|
| 1304 | - $vmlCommentsFile = simplexml_load_string( $this->_getFromZipArchive($zip, $relPath) ); |
|
| 1303 | + $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet")."/".$relPath); |
|
| 1304 | + $vmlCommentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath)); |
|
| 1305 | 1305 | $vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); |
| 1306 | 1306 | |
| 1307 | 1307 | $shapes = $vmlCommentsFile->xpath('//v:shape'); |
@@ -1309,16 +1309,16 @@ discard block |
||
| 1309 | 1309 | $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); |
| 1310 | 1310 | |
| 1311 | 1311 | if (isset($shape['style'])) { |
| 1312 | - $style = (string)$shape['style']; |
|
| 1313 | - $fillColor = strtoupper( substr( (string)$shape['fillcolor'], 1 ) ); |
|
| 1312 | + $style = (string) $shape['style']; |
|
| 1313 | + $fillColor = strtoupper(substr((string) $shape['fillcolor'], 1)); |
|
| 1314 | 1314 | $column = null; |
| 1315 | 1315 | $row = null; |
| 1316 | 1316 | |
| 1317 | 1317 | $clientData = $shape->xpath('.//x:ClientData'); |
| 1318 | - if (is_array($clientData) && !empty($clientData)) { |
|
| 1319 | - $clientData = $clientData[0]; |
|
| 1318 | + if (is_array($clientData) && ! empty($clientData)) { |
|
| 1319 | + $clientData = $clientData[0]; |
|
| 1320 | 1320 | |
| 1321 | - if ( isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note' ) { |
|
| 1321 | + if (isset($clientData['ObjectType']) && (string) $clientData['ObjectType'] == 'Note') { |
|
| 1322 | 1322 | $temp = $clientData->xpath('.//x:Row'); |
| 1323 | 1323 | if (is_array($temp)) $row = $temp[0]; |
| 1324 | 1324 | |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | if (($column !== NULL) && ($row !== NULL)) { |
| 1331 | 1331 | // Set comment properties |
| 1332 | 1332 | $comment = $docSheet->getCommentByColumnAndRow((string) $column, $row + 1); |
| 1333 | - $comment->getFillColor()->setRGB( $fillColor ); |
|
| 1333 | + $comment->getFillColor()->setRGB($fillColor); |
|
| 1334 | 1334 | |
| 1335 | 1335 | // Parse style |
| 1336 | 1336 | $styleArray = explode(';', str_replace(' ', '', $style)); |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | if ($stylePair[0] == 'margin-top') $comment->setMarginTop($stylePair[1]); |
| 1342 | 1342 | if ($stylePair[0] == 'width') $comment->setWidth($stylePair[1]); |
| 1343 | 1343 | if ($stylePair[0] == 'height') $comment->setHeight($stylePair[1]); |
| 1344 | - if ($stylePair[0] == 'visibility') $comment->setVisible( $stylePair[1] == 'visible' ); |
|
| 1344 | + if ($stylePair[0] == 'visibility') $comment->setVisible($stylePair[1] == 'visible'); |
|
| 1345 | 1345 | |
| 1346 | 1346 | } |
| 1347 | 1347 | } |
@@ -1350,9 +1350,9 @@ discard block |
||
| 1350 | 1350 | } |
| 1351 | 1351 | |
| 1352 | 1352 | // Header/footer images |
| 1353 | - if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) { |
|
| 1354 | - if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { |
|
| 1355 | - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1353 | + if ($xmlSheet && $xmlSheet->legacyDrawingHF && ! $this->_readDataOnly) { |
|
| 1354 | + if ($zip->locateName(dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")) { |
|
| 1355 | + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1356 | 1356 | $vmlRelationship = ''; |
| 1357 | 1357 | |
| 1358 | 1358 | foreach ($relsWorksheet->Relationship as $ele) { |
@@ -1363,7 +1363,7 @@ discard block |
||
| 1363 | 1363 | |
| 1364 | 1364 | if ($vmlRelationship != '') { |
| 1365 | 1365 | // Fetch linked images |
| 1366 | - $relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels' )); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1366 | + $relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship).'/_rels/'.basename($vmlRelationship).'.rels')); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1367 | 1367 | $drawings = array(); |
| 1368 | 1368 | foreach ($relsVML->Relationship as $ele) { |
| 1369 | 1369 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") { |
@@ -1384,20 +1384,20 @@ discard block |
||
| 1384 | 1384 | $imageData = $imageData[0]; |
| 1385 | 1385 | |
| 1386 | 1386 | $imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office'); |
| 1387 | - $style = self::toCSSArray( (string)$shape['style'] ); |
|
| 1387 | + $style = self::toCSSArray((string) $shape['style']); |
|
| 1388 | 1388 | |
| 1389 | - $hfImages[ (string)$shape['id'] ] = new PHPExcel_Worksheet_HeaderFooterDrawing(); |
|
| 1389 | + $hfImages[(string) $shape['id']] = new PHPExcel_Worksheet_HeaderFooterDrawing(); |
|
| 1390 | 1390 | if (isset($imageData['title'])) { |
| 1391 | - $hfImages[ (string)$shape['id'] ]->setName( (string)$imageData['title'] ); |
|
| 1391 | + $hfImages[(string) $shape['id']]->setName((string) $imageData['title']); |
|
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | - $hfImages[ (string)$shape['id'] ]->setPath("zip://$pFilename#" . $drawings[(string)$imageData['relid']], false); |
|
| 1395 | - $hfImages[ (string)$shape['id'] ]->setResizeProportional(false); |
|
| 1396 | - $hfImages[ (string)$shape['id'] ]->setWidth($style['width']); |
|
| 1397 | - $hfImages[ (string)$shape['id'] ]->setHeight($style['height']); |
|
| 1398 | - $hfImages[ (string)$shape['id'] ]->setOffsetX($style['margin-left']); |
|
| 1399 | - $hfImages[ (string)$shape['id'] ]->setOffsetY($style['margin-top']); |
|
| 1400 | - $hfImages[ (string)$shape['id'] ]->setResizeProportional(true); |
|
| 1394 | + $hfImages[(string) $shape['id']]->setPath("zip://$pFilename#".$drawings[(string) $imageData['relid']], false); |
|
| 1395 | + $hfImages[(string) $shape['id']]->setResizeProportional(false); |
|
| 1396 | + $hfImages[(string) $shape['id']]->setWidth($style['width']); |
|
| 1397 | + $hfImages[(string) $shape['id']]->setHeight($style['height']); |
|
| 1398 | + $hfImages[(string) $shape['id']]->setOffsetX($style['margin-left']); |
|
| 1399 | + $hfImages[(string) $shape['id']]->setOffsetY($style['margin-top']); |
|
| 1400 | + $hfImages[(string) $shape['id']]->setResizeProportional(true); |
|
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | 1403 | $docSheet->getHeaderFooter()->setImages($hfImages); |
@@ -1408,18 +1408,18 @@ discard block |
||
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | // TODO: Make sure drawings and graph are loaded differently! |
| 1411 | - if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { |
|
| 1412 | - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1411 | + if ($zip->locateName(dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")) { |
|
| 1412 | + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet")."/_rels/".basename($fileWorksheet).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1413 | 1413 | $drawings = array(); |
| 1414 | 1414 | foreach ($relsWorksheet->Relationship as $ele) { |
| 1415 | 1415 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") { |
| 1416 | 1416 | $drawings[(string) $ele["Id"]] = self::dir_add("$dir/$fileWorksheet", $ele["Target"]); |
| 1417 | 1417 | } |
| 1418 | 1418 | } |
| 1419 | - if ($xmlSheet->drawing && !$this->_readDataOnly) { |
|
| 1419 | + if ($xmlSheet->drawing && ! $this->_readDataOnly) { |
|
| 1420 | 1420 | foreach ($xmlSheet->drawing as $drawing) { |
| 1421 | 1421 | $fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; |
| 1422 | - $relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1422 | + $relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing)."/_rels/".basename($fileDrawing).".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); |
|
| 1423 | 1423 | $images = array(); |
| 1424 | 1424 | |
| 1425 | 1425 | if ($relsDrawing && $relsDrawing->Relationship) { |
@@ -1446,8 +1446,8 @@ discard block |
||
| 1446 | 1446 | $objDrawing = new PHPExcel_Worksheet_Drawing; |
| 1447 | 1447 | $objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); |
| 1448 | 1448 | $objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); |
| 1449 | - $objDrawing->setPath("zip://$pFilename#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); |
|
| 1450 | - $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1)); |
|
| 1449 | + $objDrawing->setPath("zip://$pFilename#".$images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); |
|
| 1450 | + $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col).($oneCellAnchor->from->row + 1)); |
|
| 1451 | 1451 | $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff)); |
| 1452 | 1452 | $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff)); |
| 1453 | 1453 | $objDrawing->setResizeProportional(false); |
@@ -1468,10 +1468,10 @@ discard block |
||
| 1468 | 1468 | } |
| 1469 | 1469 | $objDrawing->setWorksheet($docSheet); |
| 1470 | 1470 | } else { |
| 1471 | - $coordinates = PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1); |
|
| 1471 | + $coordinates = PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col).($oneCellAnchor->from->row + 1); |
|
| 1472 | 1472 | $offsetX = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff); |
| 1473 | 1473 | $offsetY = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff); |
| 1474 | - $width = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")); |
|
| 1474 | + $width = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")); |
|
| 1475 | 1475 | $height = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy")); |
| 1476 | 1476 | } |
| 1477 | 1477 | } |
@@ -1485,8 +1485,8 @@ discard block |
||
| 1485 | 1485 | $objDrawing = new PHPExcel_Worksheet_Drawing; |
| 1486 | 1486 | $objDrawing->setName((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); |
| 1487 | 1487 | $objDrawing->setDescription((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); |
| 1488 | - $objDrawing->setPath("zip://$pFilename#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); |
|
| 1489 | - $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1)); |
|
| 1488 | + $objDrawing->setPath("zip://$pFilename#".$images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); |
|
| 1489 | + $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col).($twoCellAnchor->from->row + 1)); |
|
| 1490 | 1490 | $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff)); |
| 1491 | 1491 | $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff)); |
| 1492 | 1492 | $objDrawing->setResizeProportional(false); |
@@ -1508,19 +1508,19 @@ discard block |
||
| 1508 | 1508 | $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000); |
| 1509 | 1509 | } |
| 1510 | 1510 | $objDrawing->setWorksheet($docSheet); |
| 1511 | - } elseif($this->_includeCharts) { |
|
| 1512 | - $fromCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1); |
|
| 1511 | + } elseif ($this->_includeCharts) { |
|
| 1512 | + $fromCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col).($twoCellAnchor->from->row + 1); |
|
| 1513 | 1513 | $fromOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff); |
| 1514 | 1514 | $fromOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff); |
| 1515 | - $toCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col) . ($twoCellAnchor->to->row + 1); |
|
| 1515 | + $toCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col).($twoCellAnchor->to->row + 1); |
|
| 1516 | 1516 | $toOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->colOff); |
| 1517 | 1517 | $toOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->rowOff); |
| 1518 | - $graphic = $twoCellAnchor->graphicFrame->children("http://schemas.openxmlformats.org/drawingml/2006/main")->graphic; |
|
| 1519 | - $chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart; |
|
| 1518 | + $graphic = $twoCellAnchor->graphicFrame->children("http://schemas.openxmlformats.org/drawingml/2006/main")->graphic; |
|
| 1519 | + $chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart; |
|
| 1520 | 1520 | $thisChart = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"); |
| 1521 | 1521 | |
| 1522 | 1522 | $chartDetails[$docSheet->getTitle().'!'.$thisChart] = |
| 1523 | - array( 'fromCoordinate' => $fromCoordinate, |
|
| 1523 | + array('fromCoordinate' => $fromCoordinate, |
|
| 1524 | 1524 | 'fromOffsetX' => $fromOffsetX, |
| 1525 | 1525 | 'fromOffsetY' => $fromOffsetY, |
| 1526 | 1526 | 'toCoordinate' => $toCoordinate, |
@@ -1540,23 +1540,23 @@ discard block |
||
| 1540 | 1540 | if ($xmlWorkbook->definedNames) { |
| 1541 | 1541 | foreach ($xmlWorkbook->definedNames->definedName as $definedName) { |
| 1542 | 1542 | // Extract range |
| 1543 | - $extractedRange = (string)$definedName; |
|
| 1543 | + $extractedRange = (string) $definedName; |
|
| 1544 | 1544 | $extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange); |
| 1545 | - if (($spos = strpos($extractedRange,'!')) !== false) { |
|
| 1546 | - $extractedRange = substr($extractedRange,0,$spos).str_replace('$', '', substr($extractedRange,$spos)); |
|
| 1545 | + if (($spos = strpos($extractedRange, '!')) !== false) { |
|
| 1546 | + $extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos)); |
|
| 1547 | 1547 | } else { |
| 1548 | 1548 | $extractedRange = str_replace('$', '', $extractedRange); |
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | 1551 | // Valid range? |
| 1552 | - if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') { |
|
| 1552 | + if (stripos((string) $definedName, '#REF!') !== false || $extractedRange == '') { |
|
| 1553 | 1553 | continue; |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | 1556 | // Some definedNames are only applicable if we are on the same sheet... |
| 1557 | - if ((string)$definedName['localSheetId'] != '' && (string)$definedName['localSheetId'] == $sheetId) { |
|
| 1557 | + if ((string) $definedName['localSheetId'] != '' && (string) $definedName['localSheetId'] == $sheetId) { |
|
| 1558 | 1558 | // Switch on type |
| 1559 | - switch ((string)$definedName['name']) { |
|
| 1559 | + switch ((string) $definedName['name']) { |
|
| 1560 | 1560 | |
| 1561 | 1561 | case '_xlnm._FilterDatabase': |
| 1562 | 1562 | $docSheet->setAutoFilter($extractedRange); |
@@ -1582,14 +1582,14 @@ discard block |
||
| 1582 | 1582 | break; |
| 1583 | 1583 | |
| 1584 | 1584 | case '_xlnm.Print_Area': |
| 1585 | - $rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma? |
|
| 1585 | + $rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma? |
|
| 1586 | 1586 | $newRangeSets = array(); |
| 1587 | - foreach($rangeSets as $rangeSet) { |
|
| 1588 | - $range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark? |
|
| 1587 | + foreach ($rangeSets as $rangeSet) { |
|
| 1588 | + $range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark? |
|
| 1589 | 1589 | $rangeSet = isset($range[1]) ? $range[1] : $range[0]; |
| 1590 | 1590 | $newRangeSets[] = str_replace('$', '', $rangeSet); |
| 1591 | 1591 | } |
| 1592 | - $docSheet->getPageSetup()->setPrintArea(implode(',',$newRangeSets)); |
|
| 1592 | + $docSheet->getPageSetup()->setPrintArea(implode(',', $newRangeSets)); |
|
| 1593 | 1593 | break; |
| 1594 | 1594 | |
| 1595 | 1595 | default: |
@@ -1607,24 +1607,24 @@ discard block |
||
| 1607 | 1607 | if ($xmlWorkbook->definedNames) { |
| 1608 | 1608 | foreach ($xmlWorkbook->definedNames->definedName as $definedName) { |
| 1609 | 1609 | // Extract range |
| 1610 | - $extractedRange = (string)$definedName; |
|
| 1610 | + $extractedRange = (string) $definedName; |
|
| 1611 | 1611 | $extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange); |
| 1612 | - if (($spos = strpos($extractedRange,'!')) !== false) { |
|
| 1613 | - $extractedRange = substr($extractedRange,0,$spos).str_replace('$', '', substr($extractedRange,$spos)); |
|
| 1612 | + if (($spos = strpos($extractedRange, '!')) !== false) { |
|
| 1613 | + $extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos)); |
|
| 1614 | 1614 | } else { |
| 1615 | 1615 | $extractedRange = str_replace('$', '', $extractedRange); |
| 1616 | 1616 | } |
| 1617 | 1617 | |
| 1618 | 1618 | // Valid range? |
| 1619 | - if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') { |
|
| 1619 | + if (stripos((string) $definedName, '#REF!') !== false || $extractedRange == '') { |
|
| 1620 | 1620 | continue; |
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | 1623 | // Some definedNames are only applicable if we are on the same sheet... |
| 1624 | - if ((string)$definedName['localSheetId'] != '') { |
|
| 1624 | + if ((string) $definedName['localSheetId'] != '') { |
|
| 1625 | 1625 | // Local defined name |
| 1626 | 1626 | // Switch on type |
| 1627 | - switch ((string)$definedName['name']) { |
|
| 1627 | + switch ((string) $definedName['name']) { |
|
| 1628 | 1628 | |
| 1629 | 1629 | case '_xlnm._FilterDatabase': |
| 1630 | 1630 | case '_xlnm.Print_Titles': |
@@ -1632,26 +1632,26 @@ discard block |
||
| 1632 | 1632 | break; |
| 1633 | 1633 | |
| 1634 | 1634 | default: |
| 1635 | - $range = explode('!', (string)$definedName); |
|
| 1635 | + $range = explode('!', (string) $definedName); |
|
| 1636 | 1636 | if (count($range) == 2) { |
| 1637 | 1637 | $range[0] = str_replace("''", "'", $range[0]); |
| 1638 | 1638 | $range[0] = str_replace("'", "", $range[0]); |
| 1639 | 1639 | if ($worksheet = $docSheet->getParent()->getSheetByName($range[0])) { |
| 1640 | 1640 | $extractedRange = str_replace('$', '', $range[1]); |
| 1641 | - $scope = $docSheet->getParent()->getSheet((string)$definedName['localSheetId']); |
|
| 1641 | + $scope = $docSheet->getParent()->getSheet((string) $definedName['localSheetId']); |
|
| 1642 | 1642 | |
| 1643 | - $excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $worksheet, $extractedRange, true, $scope) ); |
|
| 1643 | + $excel->addNamedRange(new PHPExcel_NamedRange((string) $definedName['name'], $worksheet, $extractedRange, true, $scope)); |
|
| 1644 | 1644 | } |
| 1645 | 1645 | } |
| 1646 | 1646 | break; |
| 1647 | 1647 | } |
| 1648 | - } else if (!isset($definedName['localSheetId'])) { |
|
| 1648 | + } else if ( ! isset($definedName['localSheetId'])) { |
|
| 1649 | 1649 | // "Global" definedNames |
| 1650 | 1650 | $locatedSheet = null; |
| 1651 | 1651 | $extractedSheetName = ''; |
| 1652 | - if (strpos( (string)$definedName, '!' ) !== false) { |
|
| 1652 | + if (strpos((string) $definedName, '!') !== false) { |
|
| 1653 | 1653 | // Extract sheet name |
| 1654 | - $extractedSheetName = PHPExcel_Worksheet::extractSheetTitle( (string)$definedName, true ); |
|
| 1654 | + $extractedSheetName = PHPExcel_Worksheet::extractSheetTitle((string) $definedName, true); |
|
| 1655 | 1655 | $extractedSheetName = $extractedSheetName[0]; |
| 1656 | 1656 | |
| 1657 | 1657 | // Locate sheet |
@@ -1663,14 +1663,14 @@ discard block |
||
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | if ($locatedSheet !== NULL) { |
| 1666 | - $excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $locatedSheet, $extractedRange, false) ); |
|
| 1666 | + $excel->addNamedRange(new PHPExcel_NamedRange((string) $definedName['name'], $locatedSheet, $extractedRange, false)); |
|
| 1667 | 1667 | } |
| 1668 | 1668 | } |
| 1669 | 1669 | } |
| 1670 | 1670 | } |
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | - if (!$this->_readDataOnly) { |
|
| 1673 | + if ( ! $this->_readDataOnly) { |
|
| 1674 | 1674 | // active sheet index |
| 1675 | 1675 | $activeTab = intval($xmlWorkbook->bookViews->workbookView["activeTab"]); // refers to old sheet index |
| 1676 | 1676 | |
@@ -1690,15 +1690,15 @@ discard block |
||
| 1690 | 1690 | } |
| 1691 | 1691 | |
| 1692 | 1692 | |
| 1693 | - if (!$this->_readDataOnly) { |
|
| 1693 | + if ( ! $this->_readDataOnly) { |
|
| 1694 | 1694 | $contentTypes = simplexml_load_string($this->_getFromZipArchive($zip, "[Content_Types].xml")); |
| 1695 | 1695 | foreach ($contentTypes->Override as $contentType) { |
| 1696 | 1696 | switch ($contentType["ContentType"]) { |
| 1697 | 1697 | case "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": |
| 1698 | 1698 | if ($this->_includeCharts) { |
| 1699 | - $chartEntryRef = ltrim($contentType['PartName'],'/'); |
|
| 1699 | + $chartEntryRef = ltrim($contentType['PartName'], '/'); |
|
| 1700 | 1700 | $chartElements = simplexml_load_string($this->_getFromZipArchive($zip, $chartEntryRef)); |
| 1701 | - $objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml')); |
|
| 1701 | + $objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements, basename($chartEntryRef, '.xml')); |
|
| 1702 | 1702 | |
| 1703 | 1703 | // echo 'Chart ',$chartEntryRef,'<br />'; |
| 1704 | 1704 | // var_dump($charts[$chartEntryRef]); |
@@ -1711,11 +1711,11 @@ discard block |
||
| 1711 | 1711 | |
| 1712 | 1712 | $excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart); |
| 1713 | 1713 | $objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet'])); |
| 1714 | - $objChart->setTopLeftPosition( $chartDetails[$chartPositionRef]['fromCoordinate'], |
|
| 1714 | + $objChart->setTopLeftPosition($chartDetails[$chartPositionRef]['fromCoordinate'], |
|
| 1715 | 1715 | $chartDetails[$chartPositionRef]['fromOffsetX'], |
| 1716 | 1716 | $chartDetails[$chartPositionRef]['fromOffsetY'] |
| 1717 | 1717 | ); |
| 1718 | - $objChart->setBottomRightPosition( $chartDetails[$chartPositionRef]['toCoordinate'], |
|
| 1718 | + $objChart->setBottomRightPosition($chartDetails[$chartPositionRef]['toCoordinate'], |
|
| 1719 | 1719 | $chartDetails[$chartPositionRef]['toOffsetX'], |
| 1720 | 1720 | $chartDetails[$chartPositionRef]['toOffsetY'] |
| 1721 | 1721 | ); |
@@ -1732,14 +1732,14 @@ discard block |
||
| 1732 | 1732 | } |
| 1733 | 1733 | |
| 1734 | 1734 | |
| 1735 | - private static function _readColor($color, $background=false) { |
|
| 1735 | + private static function _readColor($color, $background = false) { |
|
| 1736 | 1736 | if (isset($color["rgb"])) { |
| 1737 | - return (string)$color["rgb"]; |
|
| 1737 | + return (string) $color["rgb"]; |
|
| 1738 | 1738 | } else if (isset($color["indexed"])) { |
| 1739 | - return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB(); |
|
| 1739 | + return PHPExcel_Style_Color::indexedColor($color["indexed"] - 7, $background)->getARGB(); |
|
| 1740 | 1740 | } else if (isset($color["theme"])) { |
| 1741 | 1741 | if (self::$_theme !== NULL) { |
| 1742 | - $returnColour = self::$_theme->getColourByIndex((int)$color["theme"]); |
|
| 1742 | + $returnColour = self::$_theme->getColourByIndex((int) $color["theme"]); |
|
| 1743 | 1743 | if (isset($color["tint"])) { |
| 1744 | 1744 | $tintAdjust = (float) $color["tint"]; |
| 1745 | 1745 | $returnColour = PHPExcel_Style_Color::changeBrightness($returnColour, $tintAdjust); |
@@ -1766,24 +1766,24 @@ discard block |
||
| 1766 | 1766 | $docStyle->getFont()->setName((string) $style->font->name["val"]); |
| 1767 | 1767 | $docStyle->getFont()->setSize((string) $style->font->sz["val"]); |
| 1768 | 1768 | if (isset($style->font->b)) { |
| 1769 | - $docStyle->getFont()->setBold(!isset($style->font->b["val"]) || $style->font->b["val"] == 'true' || $style->font->b["val"] == '1'); |
|
| 1769 | + $docStyle->getFont()->setBold( ! isset($style->font->b["val"]) || $style->font->b["val"] == 'true' || $style->font->b["val"] == '1'); |
|
| 1770 | 1770 | } |
| 1771 | 1771 | if (isset($style->font->i)) { |
| 1772 | - $docStyle->getFont()->setItalic(!isset($style->font->i["val"]) || $style->font->i["val"] == 'true' || $style->font->i["val"] == '1'); |
|
| 1772 | + $docStyle->getFont()->setItalic( ! isset($style->font->i["val"]) || $style->font->i["val"] == 'true' || $style->font->i["val"] == '1'); |
|
| 1773 | 1773 | } |
| 1774 | 1774 | if (isset($style->font->strike)) { |
| 1775 | - $docStyle->getFont()->setStrikethrough(!isset($style->font->strike["val"]) || $style->font->strike["val"] == 'true' || $style->font->strike["val"] == '1'); |
|
| 1775 | + $docStyle->getFont()->setStrikethrough( ! isset($style->font->strike["val"]) || $style->font->strike["val"] == 'true' || $style->font->strike["val"] == '1'); |
|
| 1776 | 1776 | } |
| 1777 | 1777 | $docStyle->getFont()->getColor()->setARGB(self::_readColor($style->font->color)); |
| 1778 | 1778 | |
| 1779 | - if (isset($style->font->u) && !isset($style->font->u["val"])) { |
|
| 1779 | + if (isset($style->font->u) && ! isset($style->font->u["val"])) { |
|
| 1780 | 1780 | $docStyle->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); |
| 1781 | 1781 | } else if (isset($style->font->u) && isset($style->font->u["val"])) { |
| 1782 | - $docStyle->getFont()->setUnderline((string)$style->font->u["val"]); |
|
| 1782 | + $docStyle->getFont()->setUnderline((string) $style->font->u["val"]); |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | 1785 | if (isset($style->font->vertAlign) && isset($style->font->vertAlign["val"])) { |
| 1786 | - $vertAlign = strtolower((string)$style->font->vertAlign["val"]); |
|
| 1786 | + $vertAlign = strtolower((string) $style->font->vertAlign["val"]); |
|
| 1787 | 1787 | if ($vertAlign == 'superscript') { |
| 1788 | 1788 | $docStyle->getFont()->setSuperScript(true); |
| 1789 | 1789 | } |
@@ -1797,23 +1797,23 @@ discard block |
||
| 1797 | 1797 | if (isset($style->fill)) { |
| 1798 | 1798 | if ($style->fill->gradientFill) { |
| 1799 | 1799 | $gradientFill = $style->fill->gradientFill[0]; |
| 1800 | - if(!empty($gradientFill["type"])) { |
|
| 1800 | + if ( ! empty($gradientFill["type"])) { |
|
| 1801 | 1801 | $docStyle->getFill()->setFillType((string) $gradientFill["type"]); |
| 1802 | 1802 | } |
| 1803 | 1803 | $docStyle->getFill()->setRotation(floatval($gradientFill["degree"])); |
| 1804 | 1804 | $gradientFill->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); |
| 1805 | - $docStyle->getFill()->getStartColor()->setARGB(self::_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color) ); |
|
| 1806 | - $docStyle->getFill()->getEndColor()->setARGB(self::_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color) ); |
|
| 1805 | + $docStyle->getFill()->getStartColor()->setARGB(self::_readColor(self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color)); |
|
| 1806 | + $docStyle->getFill()->getEndColor()->setARGB(self::_readColor(self::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color)); |
|
| 1807 | 1807 | } elseif ($style->fill->patternFill) { |
| 1808 | - $patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid'; |
|
| 1808 | + $patternType = (string) $style->fill->patternFill["patternType"] != '' ? (string) $style->fill->patternFill["patternType"] : 'solid'; |
|
| 1809 | 1809 | $docStyle->getFill()->setFillType($patternType); |
| 1810 | 1810 | if ($style->fill->patternFill->fgColor) { |
| 1811 | - $docStyle->getFill()->getStartColor()->setARGB(self::_readColor($style->fill->patternFill->fgColor,true)); |
|
| 1811 | + $docStyle->getFill()->getStartColor()->setARGB(self::_readColor($style->fill->patternFill->fgColor, true)); |
|
| 1812 | 1812 | } else { |
| 1813 | 1813 | $docStyle->getFill()->getStartColor()->setARGB('FF000000'); |
| 1814 | 1814 | } |
| 1815 | 1815 | if ($style->fill->patternFill->bgColor) { |
| 1816 | - $docStyle->getFill()->getEndColor()->setARGB(self::_readColor($style->fill->patternFill->bgColor,true)); |
|
| 1816 | + $docStyle->getFill()->getEndColor()->setARGB(self::_readColor($style->fill->patternFill->bgColor, true)); |
|
| 1817 | 1817 | } |
| 1818 | 1818 | } |
| 1819 | 1819 | } |
@@ -1850,22 +1850,22 @@ discard block |
||
| 1850 | 1850 | $docStyle->getAlignment()->setVertical((string) $style->alignment["vertical"]); |
| 1851 | 1851 | |
| 1852 | 1852 | $textRotation = 0; |
| 1853 | - if ((int)$style->alignment["textRotation"] <= 90) { |
|
| 1854 | - $textRotation = (int)$style->alignment["textRotation"]; |
|
| 1855 | - } else if ((int)$style->alignment["textRotation"] > 90) { |
|
| 1856 | - $textRotation = 90 - (int)$style->alignment["textRotation"]; |
|
| 1853 | + if ((int) $style->alignment["textRotation"] <= 90) { |
|
| 1854 | + $textRotation = (int) $style->alignment["textRotation"]; |
|
| 1855 | + } else if ((int) $style->alignment["textRotation"] > 90) { |
|
| 1856 | + $textRotation = 90 - (int) $style->alignment["textRotation"]; |
|
| 1857 | 1857 | } |
| 1858 | 1858 | |
| 1859 | 1859 | $docStyle->getAlignment()->setTextRotation(intval($textRotation)); |
| 1860 | - $docStyle->getAlignment()->setWrapText( (string)$style->alignment["wrapText"] == "true" || (string)$style->alignment["wrapText"] == "1" ); |
|
| 1861 | - $docStyle->getAlignment()->setShrinkToFit( (string)$style->alignment["shrinkToFit"] == "true" || (string)$style->alignment["shrinkToFit"] == "1" ); |
|
| 1862 | - $docStyle->getAlignment()->setIndent( intval((string)$style->alignment["indent"]) > 0 ? intval((string)$style->alignment["indent"]) : 0 ); |
|
| 1860 | + $docStyle->getAlignment()->setWrapText((string) $style->alignment["wrapText"] == "true" || (string) $style->alignment["wrapText"] == "1"); |
|
| 1861 | + $docStyle->getAlignment()->setShrinkToFit((string) $style->alignment["shrinkToFit"] == "true" || (string) $style->alignment["shrinkToFit"] == "1"); |
|
| 1862 | + $docStyle->getAlignment()->setIndent(intval((string) $style->alignment["indent"]) > 0 ? intval((string) $style->alignment["indent"]) : 0); |
|
| 1863 | 1863 | } |
| 1864 | 1864 | |
| 1865 | 1865 | // protection |
| 1866 | 1866 | if (isset($style->protection)) { |
| 1867 | 1867 | if (isset($style->protection['locked'])) { |
| 1868 | - if ((string)$style->protection['locked'] == 'true') { |
|
| 1868 | + if ((string) $style->protection['locked'] == 'true') { |
|
| 1869 | 1869 | $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_PROTECTED); |
| 1870 | 1870 | } else { |
| 1871 | 1871 | $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); |
@@ -1873,7 +1873,7 @@ discard block |
||
| 1873 | 1873 | } |
| 1874 | 1874 | |
| 1875 | 1875 | if (isset($style->protection['hidden'])) { |
| 1876 | - if ((string)$style->protection['hidden'] == 'true') { |
|
| 1876 | + if ((string) $style->protection['hidden'] == 'true') { |
|
| 1877 | 1877 | $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_PROTECTED); |
| 1878 | 1878 | } else { |
| 1879 | 1879 | $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); |
@@ -1897,14 +1897,14 @@ discard block |
||
| 1897 | 1897 | $value = new PHPExcel_RichText(); |
| 1898 | 1898 | |
| 1899 | 1899 | if (isset($is->t)) { |
| 1900 | - $value->createText( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $is->t ) ); |
|
| 1900 | + $value->createText(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $is->t)); |
|
| 1901 | 1901 | } else { |
| 1902 | 1902 | foreach ($is->r as $run) { |
| 1903 | - if (!isset($run->rPr)) { |
|
| 1904 | - $objText = $value->createText( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $run->t ) ); |
|
| 1903 | + if ( ! isset($run->rPr)) { |
|
| 1904 | + $objText = $value->createText(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $run->t)); |
|
| 1905 | 1905 | |
| 1906 | 1906 | } else { |
| 1907 | - $objText = $value->createTextRun( PHPExcel_Shared_String::ControlCharacterOOXML2PHP( (string) $run->t ) ); |
|
| 1907 | + $objText = $value->createTextRun(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $run->t)); |
|
| 1908 | 1908 | |
| 1909 | 1909 | if (isset($run->rPr->rFont["val"])) { |
| 1910 | 1910 | $objText->getFont()->setName((string) $run->rPr->rFont["val"]); |
@@ -1915,21 +1915,21 @@ discard block |
||
| 1915 | 1915 | } |
| 1916 | 1916 | |
| 1917 | 1917 | if (isset($run->rPr->color)) { |
| 1918 | - $objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($run->rPr->color) ) ); |
|
| 1918 | + $objText->getFont()->setColor(new PHPExcel_Style_Color(self::_readColor($run->rPr->color))); |
|
| 1919 | 1919 | } |
| 1920 | 1920 | |
| 1921 | - if ( (isset($run->rPr->b["val"]) && ((string) $run->rPr->b["val"] == 'true' || (string) $run->rPr->b["val"] == '1')) |
|
| 1922 | - || (isset($run->rPr->b) && !isset($run->rPr->b["val"])) ) { |
|
| 1921 | + if ((isset($run->rPr->b["val"]) && ((string) $run->rPr->b["val"] == 'true' || (string) $run->rPr->b["val"] == '1')) |
|
| 1922 | + || (isset($run->rPr->b) && ! isset($run->rPr->b["val"]))) { |
|
| 1923 | 1923 | $objText->getFont()->setBold(true); |
| 1924 | 1924 | } |
| 1925 | 1925 | |
| 1926 | - if ( (isset($run->rPr->i["val"]) && ((string) $run->rPr->i["val"] == 'true' || (string) $run->rPr->i["val"] == '1')) |
|
| 1927 | - || (isset($run->rPr->i) && !isset($run->rPr->i["val"])) ) { |
|
| 1926 | + if ((isset($run->rPr->i["val"]) && ((string) $run->rPr->i["val"] == 'true' || (string) $run->rPr->i["val"] == '1')) |
|
| 1927 | + || (isset($run->rPr->i) && ! isset($run->rPr->i["val"]))) { |
|
| 1928 | 1928 | $objText->getFont()->setItalic(true); |
| 1929 | 1929 | } |
| 1930 | 1930 | |
| 1931 | 1931 | if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign["val"])) { |
| 1932 | - $vertAlign = strtolower((string)$run->rPr->vertAlign["val"]); |
|
| 1932 | + $vertAlign = strtolower((string) $run->rPr->vertAlign["val"]); |
|
| 1933 | 1933 | if ($vertAlign == 'superscript') { |
| 1934 | 1934 | $objText->getFont()->setSuperScript(true); |
| 1935 | 1935 | } |
@@ -1938,14 +1938,14 @@ discard block |
||
| 1938 | 1938 | } |
| 1939 | 1939 | } |
| 1940 | 1940 | |
| 1941 | - if (isset($run->rPr->u) && !isset($run->rPr->u["val"])) { |
|
| 1941 | + if (isset($run->rPr->u) && ! isset($run->rPr->u["val"])) { |
|
| 1942 | 1942 | $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); |
| 1943 | 1943 | } else if (isset($run->rPr->u) && isset($run->rPr->u["val"])) { |
| 1944 | - $objText->getFont()->setUnderline((string)$run->rPr->u["val"]); |
|
| 1944 | + $objText->getFont()->setUnderline((string) $run->rPr->u["val"]); |
|
| 1945 | 1945 | } |
| 1946 | 1946 | |
| 1947 | - if ( (isset($run->rPr->strike["val"]) && ((string) $run->rPr->strike["val"] == 'true' || (string) $run->rPr->strike["val"] == '1')) |
|
| 1948 | - || (isset($run->rPr->strike) && !isset($run->rPr->strike["val"])) ) { |
|
| 1947 | + if ((isset($run->rPr->strike["val"]) && ((string) $run->rPr->strike["val"] == 'true' || (string) $run->rPr->strike["val"] == '1')) |
|
| 1948 | + || (isset($run->rPr->strike) && ! isset($run->rPr->strike["val"]))) { |
|
| 1949 | 1949 | $objText->getFont()->setStrikethrough(true); |
| 1950 | 1950 | } |
| 1951 | 1951 | } |
@@ -1962,12 +1962,12 @@ discard block |
||
| 1962 | 1962 | |
| 1963 | 1963 | |
| 1964 | 1964 | private static function dir_add($base, $add) { |
| 1965 | - return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add"); |
|
| 1965 | + return preg_replace('~[^/]+/\.\./~', '', dirname($base)."/$add"); |
|
| 1966 | 1966 | } |
| 1967 | 1967 | |
| 1968 | 1968 | |
| 1969 | 1969 | private static function toCSSArray($style) { |
| 1970 | - $style = str_replace(array("\r","\n"), "", $style); |
|
| 1970 | + $style = str_replace(array("\r", "\n"), "", $style); |
|
| 1971 | 1971 | |
| 1972 | 1972 | $temp = explode(';', $style); |
| 1973 | 1973 | $style = array(); |
@@ -561,10 +561,12 @@ discard block |
||
| 561 | 561 | $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); |
| 562 | 562 | if (is_object($xmlCore)) { |
| 563 | 563 | $docProps = $excel->getProperties(); |
| 564 | - if (isset($xmlCore->Company)) |
|
| 565 | - $docProps->setCompany((string) $xmlCore->Company); |
|
| 566 | - if (isset($xmlCore->Manager)) |
|
| 567 | - $docProps->setManager((string) $xmlCore->Manager); |
|
| 564 | + if (isset($xmlCore->Company)) { |
|
| 565 | + $docProps->setCompany((string) $xmlCore->Company); |
|
| 566 | + } |
|
| 567 | + if (isset($xmlCore->Manager)) { |
|
| 568 | + $docProps->setManager((string) $xmlCore->Manager); |
|
| 569 | + } |
|
| 568 | 570 | } |
| 569 | 571 | break; |
| 570 | 572 | |
@@ -1000,9 +1002,13 @@ discard block |
||
| 1000 | 1002 | |
| 1001 | 1003 | // Check for numeric values |
| 1002 | 1004 | if (is_numeric($value) && $cellDataType != 's') { |
| 1003 | - if ($value == (int)$value) $value = (int)$value; |
|
| 1004 | - elseif ($value == (float)$value) $value = (float)$value; |
|
| 1005 | - elseif ($value == (double)$value) $value = (double)$value; |
|
| 1005 | + if ($value == (int)$value) { |
|
| 1006 | + $value = (int)$value; |
|
| 1007 | + } elseif ($value == (float)$value) { |
|
| 1008 | + $value = (float)$value; |
|
| 1009 | + } elseif ($value == (double)$value) { |
|
| 1010 | + $value = (double)$value; |
|
| 1011 | + } |
|
| 1006 | 1012 | } |
| 1007 | 1013 | |
| 1008 | 1014 | // Rich text? |
@@ -1320,10 +1326,14 @@ discard block |
||
| 1320 | 1326 | |
| 1321 | 1327 | if ( isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note' ) { |
| 1322 | 1328 | $temp = $clientData->xpath('.//x:Row'); |
| 1323 | - if (is_array($temp)) $row = $temp[0]; |
|
| 1329 | + if (is_array($temp)) { |
|
| 1330 | + $row = $temp[0]; |
|
| 1331 | + } |
|
| 1324 | 1332 | |
| 1325 | 1333 | $temp = $clientData->xpath('.//x:Column'); |
| 1326 | - if (is_array($temp)) $column = $temp[0]; |
|
| 1334 | + if (is_array($temp)) { |
|
| 1335 | + $column = $temp[0]; |
|
| 1336 | + } |
|
| 1327 | 1337 | } |
| 1328 | 1338 | } |
| 1329 | 1339 | |
@@ -1337,11 +1347,21 @@ discard block |
||
| 1337 | 1347 | foreach ($styleArray as $stylePair) { |
| 1338 | 1348 | $stylePair = explode(':', $stylePair); |
| 1339 | 1349 | |
| 1340 | - if ($stylePair[0] == 'margin-left') $comment->setMarginLeft($stylePair[1]); |
|
| 1341 | - if ($stylePair[0] == 'margin-top') $comment->setMarginTop($stylePair[1]); |
|
| 1342 | - if ($stylePair[0] == 'width') $comment->setWidth($stylePair[1]); |
|
| 1343 | - if ($stylePair[0] == 'height') $comment->setHeight($stylePair[1]); |
|
| 1344 | - if ($stylePair[0] == 'visibility') $comment->setVisible( $stylePair[1] == 'visible' ); |
|
| 1350 | + if ($stylePair[0] == 'margin-left') { |
|
| 1351 | + $comment->setMarginLeft($stylePair[1]); |
|
| 1352 | + } |
|
| 1353 | + if ($stylePair[0] == 'margin-top') { |
|
| 1354 | + $comment->setMarginTop($stylePair[1]); |
|
| 1355 | + } |
|
| 1356 | + if ($stylePair[0] == 'width') { |
|
| 1357 | + $comment->setWidth($stylePair[1]); |
|
| 1358 | + } |
|
| 1359 | + if ($stylePair[0] == 'height') { |
|
| 1360 | + $comment->setHeight($stylePair[1]); |
|
| 1361 | + } |
|
| 1362 | + if ($stylePair[0] == 'visibility') { |
|
| 1363 | + $comment->setVisible( $stylePair[1] == 'visible' ); |
|
| 1364 | + } |
|
| 1345 | 1365 | |
| 1346 | 1366 | } |
| 1347 | 1367 | } |
@@ -34,6 +34,10 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | class PHPExcel_Reader_Excel2007_Chart |
| 36 | 36 | { |
| 37 | + /** |
|
| 38 | + * @param string $name |
|
| 39 | + * @param string $format |
|
| 40 | + */ |
|
| 37 | 41 | private static function _getAttribute($component, $name, $format) { |
| 38 | 42 | $attributes = $component->attributes(); |
| 39 | 43 | if (isset($attributes[$name])) { |
@@ -60,6 +64,10 @@ discard block |
||
| 60 | 64 | } |
| 61 | 65 | |
| 62 | 66 | |
| 67 | + /** |
|
| 68 | + * @param SimpleXMLElement $chartElements |
|
| 69 | + * @param string $chartName |
|
| 70 | + */ |
|
| 63 | 71 | public static function readChart($chartElements,$chartName) { |
| 64 | 72 | $namespacesChartMeta = $chartElements->getNamespaces(true); |
| 65 | 73 | $chartElementsC = $chartElements->children($namespacesChartMeta['c']); |
@@ -188,6 +196,9 @@ discard block |
||
| 188 | 196 | } // function readChart() |
| 189 | 197 | |
| 190 | 198 | |
| 199 | + /** |
|
| 200 | + * @param string $type |
|
| 201 | + */ |
|
| 191 | 202 | private static function _chartTitle($titleDetails,$namespacesChartMeta,$type) { |
| 192 | 203 | $caption = array(); |
| 193 | 204 | $titleLayout = null; |
@@ -51,104 +51,104 @@ discard block |
||
| 51 | 51 | } // function _getAttribute() |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - private static function _readColor($color,$background=false) { |
|
| 54 | + private static function _readColor($color, $background = false) { |
|
| 55 | 55 | if (isset($color["rgb"])) { |
| 56 | - return (string)$color["rgb"]; |
|
| 56 | + return (string) $color["rgb"]; |
|
| 57 | 57 | } else if (isset($color["indexed"])) { |
| 58 | - return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB(); |
|
| 58 | + return PHPExcel_Style_Color::indexedColor($color["indexed"] - 7, $background)->getARGB(); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
| 63 | - public static function readChart($chartElements,$chartName) { |
|
| 63 | + public static function readChart($chartElements, $chartName) { |
|
| 64 | 64 | $namespacesChartMeta = $chartElements->getNamespaces(true); |
| 65 | 65 | $chartElementsC = $chartElements->children($namespacesChartMeta['c']); |
| 66 | 66 | |
| 67 | 67 | $XaxisLabel = $YaxisLabel = $legend = $title = null; |
| 68 | 68 | |
| 69 | - foreach($chartElementsC as $chartElementKey => $chartElement) { |
|
| 69 | + foreach ($chartElementsC as $chartElementKey => $chartElement) { |
|
| 70 | 70 | switch ($chartElementKey) { |
| 71 | 71 | case "chart": |
| 72 | - foreach($chartElement as $chartDetailsKey => $chartDetails) { |
|
| 72 | + foreach ($chartElement as $chartDetailsKey => $chartDetails) { |
|
| 73 | 73 | $chartDetailsC = $chartDetails->children($namespacesChartMeta['c']); |
| 74 | 74 | switch ($chartDetailsKey) { |
| 75 | 75 | case "plotArea": |
| 76 | 76 | $plotAreaLayout = $XaxisLable = $YaxisLable = null; |
| 77 | 77 | $plotSeries = array(); |
| 78 | - foreach($chartDetails as $chartDetailKey => $chartDetail) { |
|
| 78 | + foreach ($chartDetails as $chartDetailKey => $chartDetail) { |
|
| 79 | 79 | switch ($chartDetailKey) { |
| 80 | 80 | case "layout": |
| 81 | - $plotAreaLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'plotArea'); |
|
| 81 | + $plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta, 'plotArea'); |
|
| 82 | 82 | break; |
| 83 | 83 | case "catAx": |
| 84 | 84 | if (isset($chartDetail->title)) { |
| 85 | - $XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat'); |
|
| 85 | + $XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat'); |
|
| 86 | 86 | } |
| 87 | 87 | break; |
| 88 | 88 | case "dateAx": |
| 89 | 89 | if (isset($chartDetail->title)) { |
| 90 | - $XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat'); |
|
| 90 | + $XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat'); |
|
| 91 | 91 | } |
| 92 | 92 | break; |
| 93 | 93 | case "valAx": |
| 94 | 94 | if (isset($chartDetail->title)) { |
| 95 | - $YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']),$namespacesChartMeta,'cat'); |
|
| 95 | + $YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat'); |
|
| 96 | 96 | } |
| 97 | 97 | break; |
| 98 | 98 | case "barChart": |
| 99 | 99 | case "bar3DChart": |
| 100 | 100 | $barDirection = self::_getAttribute($chartDetail->barDir, 'val', 'string'); |
| 101 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 101 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 102 | 102 | $plotSer->setPlotDirection($barDirection); |
| 103 | 103 | $plotSeries[] = $plotSer; |
| 104 | 104 | break; |
| 105 | 105 | case "lineChart": |
| 106 | 106 | case "line3DChart": |
| 107 | - $plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 107 | + $plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 108 | 108 | break; |
| 109 | 109 | case "areaChart": |
| 110 | 110 | case "area3DChart": |
| 111 | - $plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 111 | + $plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 112 | 112 | break; |
| 113 | 113 | case "doughnutChart": |
| 114 | 114 | case "pieChart": |
| 115 | 115 | case "pie3DChart": |
| 116 | 116 | $explosion = isset($chartDetail->ser->explosion); |
| 117 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 117 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 118 | 118 | $plotSer->setPlotStyle($explosion); |
| 119 | 119 | $plotSeries[] = $plotSer; |
| 120 | 120 | break; |
| 121 | 121 | case "scatterChart": |
| 122 | 122 | $scatterStyle = self::_getAttribute($chartDetail->scatterStyle, 'val', 'string'); |
| 123 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 123 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 124 | 124 | $plotSer->setPlotStyle($scatterStyle); |
| 125 | 125 | $plotSeries[] = $plotSer; |
| 126 | 126 | break; |
| 127 | 127 | case "bubbleChart": |
| 128 | 128 | $bubbleScale = self::_getAttribute($chartDetail->bubbleScale, 'val', 'integer'); |
| 129 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 129 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 130 | 130 | $plotSer->setPlotStyle($bubbleScale); |
| 131 | 131 | $plotSeries[] = $plotSer; |
| 132 | 132 | break; |
| 133 | 133 | case "radarChart": |
| 134 | 134 | $radarStyle = self::_getAttribute($chartDetail->radarStyle, 'val', 'string'); |
| 135 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 135 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 136 | 136 | $plotSer->setPlotStyle($radarStyle); |
| 137 | 137 | $plotSeries[] = $plotSer; |
| 138 | 138 | break; |
| 139 | 139 | case "surfaceChart": |
| 140 | 140 | case "surface3DChart": |
| 141 | 141 | $wireFrame = self::_getAttribute($chartDetail->wireframe, 'val', 'boolean'); |
| 142 | - $plotSer = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 142 | + $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 143 | 143 | $plotSer->setPlotStyle($wireFrame); |
| 144 | 144 | $plotSeries[] = $plotSer; |
| 145 | 145 | break; |
| 146 | 146 | case "stockChart": |
| 147 | - $plotSeries[] = self::_chartDataSeries($chartDetail,$namespacesChartMeta,$chartDetailKey); |
|
| 147 | + $plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); |
|
| 148 | 148 | break; |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | - $plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout,$plotSeries); |
|
| 151 | + $plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries); |
|
| 152 | 152 | break; |
| 153 | 153 | case "plotVisOnly": |
| 154 | 154 | $plotVisOnly = self::_getAttribute($chartDetails, 'val', 'string'); |
@@ -157,13 +157,13 @@ discard block |
||
| 157 | 157 | $dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string'); |
| 158 | 158 | break; |
| 159 | 159 | case "title": |
| 160 | - $title = self::_chartTitle($chartDetails,$namespacesChartMeta,'title'); |
|
| 160 | + $title = self::_chartTitle($chartDetails, $namespacesChartMeta, 'title'); |
|
| 161 | 161 | break; |
| 162 | 162 | case "legend": |
| 163 | 163 | $legendPos = 'r'; |
| 164 | 164 | $legendLayout = null; |
| 165 | 165 | $legendOverlay = false; |
| 166 | - foreach($chartDetails as $chartDetailKey => $chartDetail) { |
|
| 166 | + foreach ($chartDetails as $chartDetailKey => $chartDetail) { |
|
| 167 | 167 | switch ($chartDetailKey) { |
| 168 | 168 | case "legendPos": |
| 169 | 169 | $legendPos = self::_getAttribute($chartDetail, 'val', 'string'); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean'); |
| 173 | 173 | break; |
| 174 | 174 | case "layout": |
| 175 | - $legendLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta,'legend'); |
|
| 175 | + $legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta, 'legend'); |
|
| 176 | 176 | break; |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -182,20 +182,20 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | - $chart = new PHPExcel_Chart($chartName,$title,$legend,$plotArea,$plotVisOnly,$dispBlanksAs,$XaxisLabel,$YaxisLabel); |
|
| 185 | + $chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel); |
|
| 186 | 186 | |
| 187 | 187 | return $chart; |
| 188 | 188 | } // function readChart() |
| 189 | 189 | |
| 190 | 190 | |
| 191 | - private static function _chartTitle($titleDetails,$namespacesChartMeta,$type) { |
|
| 191 | + private static function _chartTitle($titleDetails, $namespacesChartMeta, $type) { |
|
| 192 | 192 | $caption = array(); |
| 193 | 193 | $titleLayout = null; |
| 194 | - foreach($titleDetails as $titleDetailKey => $chartDetail) { |
|
| 194 | + foreach ($titleDetails as $titleDetailKey => $chartDetail) { |
|
| 195 | 195 | switch ($titleDetailKey) { |
| 196 | 196 | case "tx": |
| 197 | 197 | $titleDetails = $chartDetail->rich->children($namespacesChartMeta['a']); |
| 198 | - foreach($titleDetails as $titleKey => $titleDetail) { |
|
| 198 | + foreach ($titleDetails as $titleKey => $titleDetail) { |
|
| 199 | 199 | switch ($titleKey) { |
| 200 | 200 | case "p": |
| 201 | 201 | $titleDetailPart = $titleDetail->children($namespacesChartMeta['a']); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | break; |
| 206 | 206 | case "layout": |
| 207 | - $titleLayout = self::_chartLayoutDetails($chartDetail,$namespacesChartMeta); |
|
| 207 | + $titleLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta); |
|
| 208 | 208 | break; |
| 209 | 209 | } |
| 210 | 210 | } |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | } // function _chartTitle() |
| 214 | 214 | |
| 215 | 215 | |
| 216 | - private static function _chartLayoutDetails($chartDetail,$namespacesChartMeta) { |
|
| 217 | - if (!isset($chartDetail->manualLayout)) { |
|
| 216 | + private static function _chartLayoutDetails($chartDetail, $namespacesChartMeta) { |
|
| 217 | + if ( ! isset($chartDetail->manualLayout)) { |
|
| 218 | 218 | return null; |
| 219 | 219 | } |
| 220 | 220 | $details = $chartDetail->manualLayout->children($namespacesChartMeta['c']); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | return null; |
| 223 | 223 | } |
| 224 | 224 | $layout = array(); |
| 225 | - foreach($details as $detailKey => $detail) { |
|
| 225 | + foreach ($details as $detailKey => $detail) { |
|
| 226 | 226 | // echo $detailKey,' => ',self::_getAttribute($detail, 'val', 'string'),'<br />'; |
| 227 | 227 | $layout[$detailKey] = self::_getAttribute($detail, 'val', 'string'); |
| 228 | 228 | } |
@@ -230,20 +230,20 @@ discard block |
||
| 230 | 230 | } // function _chartLayoutDetails() |
| 231 | 231 | |
| 232 | 232 | |
| 233 | - private static function _chartDataSeries($chartDetail,$namespacesChartMeta,$plotType) { |
|
| 233 | + private static function _chartDataSeries($chartDetail, $namespacesChartMeta, $plotType) { |
|
| 234 | 234 | $multiSeriesType = NULL; |
| 235 | 235 | $smoothLine = false; |
| 236 | 236 | $seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array(); |
| 237 | 237 | |
| 238 | 238 | $seriesDetailSet = $chartDetail->children($namespacesChartMeta['c']); |
| 239 | - foreach($seriesDetailSet as $seriesDetailKey => $seriesDetails) { |
|
| 239 | + foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) { |
|
| 240 | 240 | switch ($seriesDetailKey) { |
| 241 | 241 | case "grouping": |
| 242 | 242 | $multiSeriesType = self::_getAttribute($chartDetail->grouping, 'val', 'string'); |
| 243 | 243 | break; |
| 244 | 244 | case "ser": |
| 245 | 245 | $marker = NULL; |
| 246 | - foreach($seriesDetails as $seriesKey => $seriesDetail) { |
|
| 246 | + foreach ($seriesDetails as $seriesKey => $seriesDetail) { |
|
| 247 | 247 | switch ($seriesKey) { |
| 248 | 248 | case "idx": |
| 249 | 249 | $seriesIndex = self::_getAttribute($seriesDetail, 'val', 'integer'); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $plotOrder[$seriesIndex] = $seriesOrder; |
| 254 | 254 | break; |
| 255 | 255 | case "tx": |
| 256 | - $seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta); |
|
| 256 | + $seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); |
|
| 257 | 257 | break; |
| 258 | 258 | case "marker": |
| 259 | 259 | $marker = self::_getAttribute($seriesDetail->symbol, 'val', 'string'); |
@@ -262,59 +262,59 @@ discard block |
||
| 262 | 262 | $smoothLine = self::_getAttribute($seriesDetail, 'val', 'boolean'); |
| 263 | 263 | break; |
| 264 | 264 | case "cat": |
| 265 | - $seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta); |
|
| 265 | + $seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); |
|
| 266 | 266 | break; |
| 267 | 267 | case "val": |
| 268 | - $seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker); |
|
| 268 | + $seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); |
|
| 269 | 269 | break; |
| 270 | 270 | case "xVal": |
| 271 | - $seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker); |
|
| 271 | + $seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); |
|
| 272 | 272 | break; |
| 273 | 273 | case "yVal": |
| 274 | - $seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail,$namespacesChartMeta,$marker); |
|
| 274 | + $seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); |
|
| 275 | 275 | break; |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | - return new PHPExcel_Chart_DataSeries($plotType,$multiSeriesType,$plotOrder,$seriesLabel,$seriesCategory,$seriesValues,$smoothLine); |
|
| 280 | + return new PHPExcel_Chart_DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine); |
|
| 281 | 281 | } // function _chartDataSeries() |
| 282 | 282 | |
| 283 | 283 | |
| 284 | 284 | private static function _chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false) { |
| 285 | 285 | if (isset($seriesDetail->strRef)) { |
| 286 | 286 | $seriesSource = (string) $seriesDetail->strRef->f; |
| 287 | - $seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']),'s'); |
|
| 287 | + $seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']), 's'); |
|
| 288 | 288 | |
| 289 | - return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); |
|
| 289 | + return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); |
|
| 290 | 290 | } elseif (isset($seriesDetail->numRef)) { |
| 291 | 291 | $seriesSource = (string) $seriesDetail->numRef->f; |
| 292 | 292 | $seriesData = self::_chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c'])); |
| 293 | 293 | |
| 294 | - return new PHPExcel_Chart_DataSeriesValues('Number',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); |
|
| 294 | + return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); |
|
| 295 | 295 | } elseif (isset($seriesDetail->multiLvlStrRef)) { |
| 296 | 296 | $seriesSource = (string) $seriesDetail->multiLvlStrRef->f; |
| 297 | - $seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']),'s'); |
|
| 297 | + $seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']), 's'); |
|
| 298 | 298 | $seriesData['pointCount'] = count($seriesData['dataValues']); |
| 299 | 299 | |
| 300 | - return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); |
|
| 300 | + return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); |
|
| 301 | 301 | } elseif (isset($seriesDetail->multiLvlNumRef)) { |
| 302 | 302 | $seriesSource = (string) $seriesDetail->multiLvlNumRef->f; |
| 303 | - $seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']),'s'); |
|
| 303 | + $seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']), 's'); |
|
| 304 | 304 | $seriesData['pointCount'] = count($seriesData['dataValues']); |
| 305 | 305 | |
| 306 | - return new PHPExcel_Chart_DataSeriesValues('String',$seriesSource,$seriesData['formatCode'],$seriesData['pointCount'],$seriesData['dataValues'],$marker,$smoothLine); |
|
| 306 | + return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); |
|
| 307 | 307 | } |
| 308 | 308 | return null; |
| 309 | 309 | } // function _chartDataSeriesValueSet() |
| 310 | 310 | |
| 311 | 311 | |
| 312 | - private static function _chartDataSeriesValues($seriesValueSet,$dataType='n') { |
|
| 312 | + private static function _chartDataSeriesValues($seriesValueSet, $dataType = 'n') { |
|
| 313 | 313 | $seriesVal = array(); |
| 314 | 314 | $formatCode = ''; |
| 315 | 315 | $pointCount = 0; |
| 316 | 316 | |
| 317 | - foreach($seriesValueSet as $seriesValueIdx => $seriesValue) { |
|
| 317 | + foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) { |
|
| 318 | 318 | switch ($seriesValueIdx) { |
| 319 | 319 | case 'ptCount': |
| 320 | 320 | $pointCount = self::_getAttribute($seriesValue, 'val', 'integer'); |
@@ -333,20 +333,20 @@ discard block |
||
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - return array( 'formatCode' => $formatCode, |
|
| 336 | + return array('formatCode' => $formatCode, |
|
| 337 | 337 | 'pointCount' => $pointCount, |
| 338 | 338 | 'dataValues' => $seriesVal |
| 339 | 339 | ); |
| 340 | 340 | } // function _chartDataSeriesValues() |
| 341 | 341 | |
| 342 | 342 | |
| 343 | - private static function _chartDataSeriesValuesMultiLevel($seriesValueSet,$dataType='n') { |
|
| 343 | + private static function _chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType = 'n') { |
|
| 344 | 344 | $seriesVal = array(); |
| 345 | 345 | $formatCode = ''; |
| 346 | 346 | $pointCount = 0; |
| 347 | 347 | |
| 348 | - foreach($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) { |
|
| 349 | - foreach($seriesLevel as $seriesValueIdx => $seriesValue) { |
|
| 348 | + foreach ($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) { |
|
| 349 | + foreach ($seriesLevel as $seriesValueIdx => $seriesValue) { |
|
| 350 | 350 | switch ($seriesValueIdx) { |
| 351 | 351 | case 'ptCount': |
| 352 | 352 | $pointCount = self::_getAttribute($seriesValue, 'val', 'integer'); |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - return array( 'formatCode' => $formatCode, |
|
| 369 | + return array('formatCode' => $formatCode, |
|
| 370 | 370 | 'pointCount' => $pointCount, |
| 371 | 371 | 'dataValues' => $seriesVal |
| 372 | 372 | ); |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | private static function _parseRichText($titleDetailPart = null) { |
| 376 | 376 | $value = new PHPExcel_RichText(); |
| 377 | 377 | |
| 378 | - foreach($titleDetailPart as $titleDetailElementKey => $titleDetailElement) { |
|
| 378 | + foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) { |
|
| 379 | 379 | if (isset($titleDetailElement->t)) { |
| 380 | - $objText = $value->createTextRun( (string) $titleDetailElement->t ); |
|
| 380 | + $objText = $value->createTextRun((string) $titleDetailElement->t); |
|
| 381 | 381 | } |
| 382 | 382 | if (isset($titleDetailElement->rPr)) { |
| 383 | 383 | if (isset($titleDetailElement->rPr->rFont["val"])) { |
@@ -385,39 +385,39 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | $fontSize = (self::_getAttribute($titleDetailElement->rPr, 'sz', 'integer')); |
| 388 | - if (!is_null($fontSize)) { |
|
| 388 | + if ( ! is_null($fontSize)) { |
|
| 389 | 389 | $objText->getFont()->setSize(floor($fontSize / 100)); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | $fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string')); |
| 393 | - if (!is_null($fontColor)) { |
|
| 394 | - $objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($fontColor) ) ); |
|
| 393 | + if ( ! is_null($fontColor)) { |
|
| 394 | + $objText->getFont()->setColor(new PHPExcel_Style_Color(self::_readColor($fontColor))); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | $bold = self::_getAttribute($titleDetailElement->rPr, 'b', 'boolean'); |
| 398 | - if (!is_null($bold)) { |
|
| 398 | + if ( ! is_null($bold)) { |
|
| 399 | 399 | $objText->getFont()->setBold($bold); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | $italic = self::_getAttribute($titleDetailElement->rPr, 'i', 'boolean'); |
| 403 | - if (!is_null($italic)) { |
|
| 403 | + if ( ! is_null($italic)) { |
|
| 404 | 404 | $objText->getFont()->setItalic($italic); |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | $baseline = self::_getAttribute($titleDetailElement->rPr, 'baseline', 'integer'); |
| 408 | - if (!is_null($baseline)) { |
|
| 408 | + if ( ! is_null($baseline)) { |
|
| 409 | 409 | if ($baseline > 0) { |
| 410 | 410 | $objText->getFont()->setSuperScript(true); |
| 411 | - } elseif($baseline < 0) { |
|
| 411 | + } elseif ($baseline < 0) { |
|
| 412 | 412 | $objText->getFont()->setSubScript(true); |
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | $underscore = (self::_getAttribute($titleDetailElement->rPr, 'u', 'string')); |
| 417 | - if (!is_null($underscore)) { |
|
| 417 | + if ( ! is_null($underscore)) { |
|
| 418 | 418 | if ($underscore == 'sng') { |
| 419 | 419 | $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); |
| 420 | - } elseif($underscore == 'dbl') { |
|
| 420 | + } elseif ($underscore == 'dbl') { |
|
| 421 | 421 | $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE); |
| 422 | 422 | } else { |
| 423 | 423 | $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_NONE); |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | $strikethrough = (self::_getAttribute($titleDetailElement->rPr, 's', 'string')); |
| 428 | - if (!is_null($strikethrough)) { |
|
| 428 | + if ( ! is_null($strikethrough)) { |
|
| 429 | 429 | if ($strikethrough == 'noStrike') { |
| 430 | 430 | $objText->getFont()->setStrikethrough(false); |
| 431 | 431 | } else { |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | /** |
| 509 | 509 | * Can the current PHPExcel_Reader_IReader read the file? |
| 510 | 510 | * |
| 511 | - * @param string $pFileName |
|
| 511 | + * @param string $pFilename |
|
| 512 | 512 | * @return boolean |
| 513 | 513 | * @throws Exception |
| 514 | 514 | */ |
@@ -4972,7 +4972,7 @@ discard block |
||
| 4972 | 4972 | * is in one piece. |
| 4973 | 4973 | * Moves to next current position in data stream to start of next record different from a CONtINUE record |
| 4974 | 4974 | * |
| 4975 | - * @return array |
|
| 4975 | + * @return integer|null |
|
| 4976 | 4976 | */ |
| 4977 | 4977 | private function _getSplicedRecordData() |
| 4978 | 4978 | { |
@@ -5078,8 +5078,7 @@ discard block |
||
| 5078 | 5078 | * Take array of tokens together with additional data for formula and return human readable formula |
| 5079 | 5079 | * |
| 5080 | 5080 | * @param array $tokens |
| 5081 | - * @param array $additionalData Additional binary data going with the formula |
|
| 5082 | - * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas |
|
| 5081 | + * @param string $additionalData Additional binary data going with the formula |
|
| 5083 | 5082 | * @return string Human readable formula |
| 5084 | 5083 | */ |
| 5085 | 5084 | private function _createFormulaFromTokens($tokens, $additionalData) |
@@ -5243,7 +5242,8 @@ discard block |
||
| 5243 | 5242 | * |
| 5244 | 5243 | * @param string Formula data |
| 5245 | 5244 | * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas |
| 5246 | - * @return array |
|
| 5245 | + * @param string $formulaData |
|
| 5246 | + * @return string |
|
| 5247 | 5247 | * @throws Exception |
| 5248 | 5248 | */ |
| 5249 | 5249 | private function _getNextToken($formulaData, $baseCell = 'A1') |
@@ -6097,7 +6097,7 @@ discard block |
||
| 6097 | 6097 | * section 2.5.15 |
| 6098 | 6098 | * |
| 6099 | 6099 | * @param string $subData |
| 6100 | - * @return array |
|
| 6100 | + * @return string |
|
| 6101 | 6101 | */ |
| 6102 | 6102 | private function _readBIFF8CellRangeAddressList($subData) |
| 6103 | 6103 | { |
@@ -6212,7 +6212,7 @@ discard block |
||
| 6212 | 6212 | * section 2.5.8 |
| 6213 | 6213 | * |
| 6214 | 6214 | * @param string $arrayData |
| 6215 | - * @return array |
|
| 6215 | + * @return string |
|
| 6216 | 6216 | */ |
| 6217 | 6217 | private static function _readBIFF8ConstantArray($arrayData) |
| 6218 | 6218 | { |
@@ -6251,7 +6251,7 @@ discard block |
||
| 6251 | 6251 | * returns e.g. array('value' => '5', 'size' => 9) |
| 6252 | 6252 | * |
| 6253 | 6253 | * @param string $valueData |
| 6254 | - * @return array |
|
| 6254 | + * @return string |
|
| 6255 | 6255 | */ |
| 6256 | 6256 | private static function _readBIFF8Constant($valueData) |
| 6257 | 6257 | { |
@@ -6493,6 +6493,9 @@ discard block |
||
| 6493 | 6493 | } |
| 6494 | 6494 | |
| 6495 | 6495 | |
| 6496 | + /** |
|
| 6497 | + * @param integer $rknum |
|
| 6498 | + */ |
|
| 6496 | 6499 | private static function _GetIEEE754($rknum) |
| 6497 | 6500 | { |
| 6498 | 6501 | if (($rknum & 0x02) != 0) { |
@@ -6523,7 +6526,7 @@ discard block |
||
| 6523 | 6526 | * Get UTF-8 string from (compressed or uncompressed) UTF-16 string |
| 6524 | 6527 | * |
| 6525 | 6528 | * @param string $string |
| 6526 | - * @param bool $compressed |
|
| 6529 | + * @param string|boolean $compressed |
|
| 6527 | 6530 | * @return string |
| 6528 | 6531 | */ |
| 6529 | 6532 | private static function _encodeUTF16($string, $compressed = '') |
@@ -6607,6 +6610,7 @@ discard block |
||
| 6607 | 6610 | * |
| 6608 | 6611 | * @param int $color Indexed color |
| 6609 | 6612 | * @param array $palette Color palette |
| 6613 | + * @param integer $version |
|
| 6610 | 6614 | * @return array RGB color value, example: array('rgb' => 'FF0000') |
| 6611 | 6615 | */ |
| 6612 | 6616 | private static function _readColor($color,$palette,$version) |
@@ -969,55 +969,55 @@ discard block |
||
| 969 | 969 | |
| 970 | 970 | switch ($obj['otObjType']) { |
| 971 | 971 | |
| 972 | - case 0x19: |
|
| 973 | - // Note |
|
| 974 | -// echo 'Cell Annotation Object<br />'; |
|
| 975 | -// echo 'Object ID is ',$obj['idObjID'],'<br />'; |
|
| 976 | -// |
|
| 977 | - if (isset($this->_cellNotes[$obj['idObjID']])) { |
|
| 978 | - $cellNote = $this->_cellNotes[$obj['idObjID']]; |
|
| 979 | - |
|
| 980 | -// echo '_cellNotes[',$obj['idObjID'],']: '; |
|
| 981 | -// var_dump($cellNote); |
|
| 982 | -// echo '<br />'; |
|
| 983 | -// |
|
| 984 | - if (isset($this->_textObjects[$obj['idObjID']])) { |
|
| 985 | - $textObject = $this->_textObjects[$obj['idObjID']]; |
|
| 986 | -// echo '_textObject: '; |
|
| 987 | -// var_dump($textObject); |
|
| 988 | -// echo '<br />'; |
|
| 989 | -// |
|
| 990 | - $this->_cellNotes[$obj['idObjID']]['objTextData'] = $textObject; |
|
| 991 | - $text = $textObject['text']; |
|
| 972 | + case 0x19: |
|
| 973 | + // Note |
|
| 974 | + // echo 'Cell Annotation Object<br />'; |
|
| 975 | + // echo 'Object ID is ',$obj['idObjID'],'<br />'; |
|
| 976 | + // |
|
| 977 | + if (isset($this->_cellNotes[$obj['idObjID']])) { |
|
| 978 | + $cellNote = $this->_cellNotes[$obj['idObjID']]; |
|
| 979 | + |
|
| 980 | + // echo '_cellNotes[',$obj['idObjID'],']: '; |
|
| 981 | + // var_dump($cellNote); |
|
| 982 | + // echo '<br />'; |
|
| 983 | + // |
|
| 984 | + if (isset($this->_textObjects[$obj['idObjID']])) { |
|
| 985 | + $textObject = $this->_textObjects[$obj['idObjID']]; |
|
| 986 | + // echo '_textObject: '; |
|
| 987 | + // var_dump($textObject); |
|
| 988 | + // echo '<br />'; |
|
| 989 | + // |
|
| 990 | + $this->_cellNotes[$obj['idObjID']]['objTextData'] = $textObject; |
|
| 991 | + $text = $textObject['text']; |
|
| 992 | + } |
|
| 993 | + // echo $text,'<br />'; |
|
| 992 | 994 | } |
| 993 | -// echo $text,'<br />'; |
|
| 994 | - } |
|
| 995 | - break; |
|
| 995 | + break; |
|
| 996 | 996 | |
| 997 | - case 0x08: |
|
| 998 | -// echo 'Picture Object<br />'; |
|
| 999 | - // picture |
|
| 1000 | - |
|
| 1001 | - // get index to BSE entry (1-based) |
|
| 1002 | - $BSEindex = $spContainer->getOPT(0x0104); |
|
| 1003 | - $BSECollection = $escherWorkbook->getDggContainer()->getBstoreContainer()->getBSECollection(); |
|
| 1004 | - $BSE = $BSECollection[$BSEindex - 1]; |
|
| 1005 | - $blipType = $BSE->getBlipType(); |
|
| 1006 | - |
|
| 1007 | - // need check because some blip types are not supported by Escher reader such as EMF |
|
| 1008 | - if ($blip = $BSE->getBlip()) { |
|
| 1009 | - $ih = imagecreatefromstring($blip->getData()); |
|
| 1010 | - $drawing = new PHPExcel_Worksheet_MemoryDrawing(); |
|
| 1011 | - $drawing->setImageResource($ih); |
|
| 1012 | - |
|
| 1013 | - // width, height, offsetX, offsetY |
|
| 1014 | - $drawing->setResizeProportional(false); |
|
| 1015 | - $drawing->setWidth($width); |
|
| 1016 | - $drawing->setHeight($height); |
|
| 1017 | - $drawing->setOffsetX($offsetX); |
|
| 1018 | - $drawing->setOffsetY($offsetY); |
|
| 1019 | - |
|
| 1020 | - switch ($blipType) { |
|
| 997 | + case 0x08: |
|
| 998 | + // echo 'Picture Object<br />'; |
|
| 999 | + // picture |
|
| 1000 | + |
|
| 1001 | + // get index to BSE entry (1-based) |
|
| 1002 | + $BSEindex = $spContainer->getOPT(0x0104); |
|
| 1003 | + $BSECollection = $escherWorkbook->getDggContainer()->getBstoreContainer()->getBSECollection(); |
|
| 1004 | + $BSE = $BSECollection[$BSEindex - 1]; |
|
| 1005 | + $blipType = $BSE->getBlipType(); |
|
| 1006 | + |
|
| 1007 | + // need check because some blip types are not supported by Escher reader such as EMF |
|
| 1008 | + if ($blip = $BSE->getBlip()) { |
|
| 1009 | + $ih = imagecreatefromstring($blip->getData()); |
|
| 1010 | + $drawing = new PHPExcel_Worksheet_MemoryDrawing(); |
|
| 1011 | + $drawing->setImageResource($ih); |
|
| 1012 | + |
|
| 1013 | + // width, height, offsetX, offsetY |
|
| 1014 | + $drawing->setResizeProportional(false); |
|
| 1015 | + $drawing->setWidth($width); |
|
| 1016 | + $drawing->setHeight($height); |
|
| 1017 | + $drawing->setOffsetX($offsetX); |
|
| 1018 | + $drawing->setOffsetY($offsetY); |
|
| 1019 | + |
|
| 1020 | + switch ($blipType) { |
|
| 1021 | 1021 | case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG: |
| 1022 | 1022 | $drawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG); |
| 1023 | 1023 | $drawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_JPEG); |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | $drawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG); |
| 1028 | 1028 | $drawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_PNG); |
| 1029 | 1029 | break; |
| 1030 | - } |
|
| 1030 | + } |
|
| 1031 | 1031 | |
| 1032 | 1032 | $drawing->setWorksheet($this->_phpSheet); |
| 1033 | 1033 | $drawing->setCoordinates($spContainer->getStartCoordinates()); |
@@ -1035,9 +1035,9 @@ discard block |
||
| 1035 | 1035 | |
| 1036 | 1036 | break; |
| 1037 | 1037 | |
| 1038 | - default: |
|
| 1039 | - // other object type |
|
| 1040 | - break; |
|
| 1038 | + default: |
|
| 1039 | + // other object type |
|
| 1040 | + break; |
|
| 1041 | 1041 | |
| 1042 | 1042 | } |
| 1043 | 1043 | } |
@@ -1071,74 +1071,74 @@ discard block |
||
| 1071 | 1071 | if ($definedName['isBuiltInName']) { |
| 1072 | 1072 | switch ($definedName['name']) { |
| 1073 | 1073 | |
| 1074 | - case pack('C', 0x06): |
|
| 1075 | - // print area |
|
| 1076 | - // in general, formula looks like this: Foo!$C$7:$J$66,Bar!$A$1:$IV$2 |
|
| 1074 | + case pack('C', 0x06): |
|
| 1075 | + // print area |
|
| 1076 | + // in general, formula looks like this: Foo!$C$7:$J$66,Bar!$A$1:$IV$2 |
|
| 1077 | 1077 | |
| 1078 | - $ranges = explode(',', $definedName['formula']); // FIXME: what if sheetname contains comma? |
|
| 1078 | + $ranges = explode(',', $definedName['formula']); // FIXME: what if sheetname contains comma? |
|
| 1079 | 1079 | |
| 1080 | - $extractedRanges = array(); |
|
| 1081 | - foreach ($ranges as $range) { |
|
| 1082 | - // $range should look like one of these |
|
| 1083 | - // Foo!$C$7:$J$66 |
|
| 1084 | - // Bar!$A$1:$IV$2 |
|
| 1080 | + $extractedRanges = array(); |
|
| 1081 | + foreach ($ranges as $range) { |
|
| 1082 | + // $range should look like one of these |
|
| 1083 | + // Foo!$C$7:$J$66 |
|
| 1084 | + // Bar!$A$1:$IV$2 |
|
| 1085 | 1085 | |
| 1086 | - $explodes = explode('!', $range); // FIXME: what if sheetname contains exclamation mark? |
|
| 1087 | - $sheetName = $explodes[0]; |
|
| 1086 | + $explodes = explode('!', $range); // FIXME: what if sheetname contains exclamation mark? |
|
| 1087 | + $sheetName = $explodes[0]; |
|
| 1088 | 1088 | |
| 1089 | - if (count($explodes) == 2) { |
|
| 1090 | - $extractedRanges[] = str_replace('$', '', $explodes[1]); // C7:J66 |
|
| 1089 | + if (count($explodes) == 2) { |
|
| 1090 | + $extractedRanges[] = str_replace('$', '', $explodes[1]); // C7:J66 |
|
| 1091 | + } |
|
| 1091 | 1092 | } |
| 1092 | - } |
|
| 1093 | - if ($docSheet = $this->_phpExcel->getSheetByName($sheetName)) { |
|
| 1094 | - $docSheet->getPageSetup()->setPrintArea(implode(',', $extractedRanges)); // C7:J66,A1:IV2 |
|
| 1095 | - } |
|
| 1096 | - break; |
|
| 1093 | + if ($docSheet = $this->_phpExcel->getSheetByName($sheetName)) { |
|
| 1094 | + $docSheet->getPageSetup()->setPrintArea(implode(',', $extractedRanges)); // C7:J66,A1:IV2 |
|
| 1095 | + } |
|
| 1096 | + break; |
|
| 1097 | 1097 | |
| 1098 | - case pack('C', 0x07): |
|
| 1099 | - // print titles (repeating rows) |
|
| 1100 | - // Assuming BIFF8, there are 3 cases |
|
| 1101 | - // 1. repeating rows |
|
| 1102 | - // formula looks like this: Sheet!$A$1:$IV$2 |
|
| 1103 | - // rows 1-2 repeat |
|
| 1104 | - // 2. repeating columns |
|
| 1105 | - // formula looks like this: Sheet!$A$1:$B$65536 |
|
| 1106 | - // columns A-B repeat |
|
| 1107 | - // 3. both repeating rows and repeating columns |
|
| 1108 | - // formula looks like this: Sheet!$A$1:$B$65536,Sheet!$A$1:$IV$2 |
|
| 1109 | - |
|
| 1110 | - $ranges = explode(',', $definedName['formula']); // FIXME: what if sheetname contains comma? |
|
| 1111 | - |
|
| 1112 | - foreach ($ranges as $range) { |
|
| 1113 | - // $range should look like this one of these |
|
| 1114 | - // Sheet!$A$1:$B$65536 |
|
| 1115 | - // Sheet!$A$1:$IV$2 |
|
| 1116 | - |
|
| 1117 | - $explodes = explode('!', $range); |
|
| 1118 | - |
|
| 1119 | - if (count($explodes) == 2) { |
|
| 1120 | - if ($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) { |
|
| 1121 | - |
|
| 1122 | - $extractedRange = $explodes[1]; |
|
| 1123 | - $extractedRange = str_replace('$', '', $extractedRange); |
|
| 1124 | - |
|
| 1125 | - $coordinateStrings = explode(':', $extractedRange); |
|
| 1126 | - if (count($coordinateStrings) == 2) { |
|
| 1127 | - list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($coordinateStrings[0]); |
|
| 1128 | - list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($coordinateStrings[1]); |
|
| 1129 | - |
|
| 1130 | - if ($firstColumn == 'A' and $lastColumn == 'IV') { |
|
| 1131 | - // then we have repeating rows |
|
| 1132 | - $docSheet->getPageSetup()->setRowsToRepeatAtTop(array($firstRow, $lastRow)); |
|
| 1133 | - } elseif ($firstRow == 1 and $lastRow == 65536) { |
|
| 1134 | - // then we have repeating columns |
|
| 1135 | - $docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($firstColumn, $lastColumn)); |
|
| 1098 | + case pack('C', 0x07): |
|
| 1099 | + // print titles (repeating rows) |
|
| 1100 | + // Assuming BIFF8, there are 3 cases |
|
| 1101 | + // 1. repeating rows |
|
| 1102 | + // formula looks like this: Sheet!$A$1:$IV$2 |
|
| 1103 | + // rows 1-2 repeat |
|
| 1104 | + // 2. repeating columns |
|
| 1105 | + // formula looks like this: Sheet!$A$1:$B$65536 |
|
| 1106 | + // columns A-B repeat |
|
| 1107 | + // 3. both repeating rows and repeating columns |
|
| 1108 | + // formula looks like this: Sheet!$A$1:$B$65536,Sheet!$A$1:$IV$2 |
|
| 1109 | + |
|
| 1110 | + $ranges = explode(',', $definedName['formula']); // FIXME: what if sheetname contains comma? |
|
| 1111 | + |
|
| 1112 | + foreach ($ranges as $range) { |
|
| 1113 | + // $range should look like this one of these |
|
| 1114 | + // Sheet!$A$1:$B$65536 |
|
| 1115 | + // Sheet!$A$1:$IV$2 |
|
| 1116 | + |
|
| 1117 | + $explodes = explode('!', $range); |
|
| 1118 | + |
|
| 1119 | + if (count($explodes) == 2) { |
|
| 1120 | + if ($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) { |
|
| 1121 | + |
|
| 1122 | + $extractedRange = $explodes[1]; |
|
| 1123 | + $extractedRange = str_replace('$', '', $extractedRange); |
|
| 1124 | + |
|
| 1125 | + $coordinateStrings = explode(':', $extractedRange); |
|
| 1126 | + if (count($coordinateStrings) == 2) { |
|
| 1127 | + list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($coordinateStrings[0]); |
|
| 1128 | + list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($coordinateStrings[1]); |
|
| 1129 | + |
|
| 1130 | + if ($firstColumn == 'A' and $lastColumn == 'IV') { |
|
| 1131 | + // then we have repeating rows |
|
| 1132 | + $docSheet->getPageSetup()->setRowsToRepeatAtTop(array($firstRow, $lastRow)); |
|
| 1133 | + } elseif ($firstRow == 1 and $lastRow == 65536) { |
|
| 1134 | + // then we have repeating columns |
|
| 1135 | + $docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($firstColumn, $lastColumn)); |
|
| 1136 | + } |
|
| 1136 | 1137 | } |
| 1137 | 1138 | } |
| 1138 | 1139 | } |
| 1139 | 1140 | } |
| 1140 | - } |
|
| 1141 | - break; |
|
| 1141 | + break; |
|
| 1142 | 1142 | |
| 1143 | 1143 | } |
| 1144 | 1144 | } else { |
@@ -2368,12 +2368,12 @@ discard block |
||
| 2368 | 2368 | $builtInId = ord($recordData{2}); |
| 2369 | 2369 | |
| 2370 | 2370 | switch ($builtInId) { |
| 2371 | - case 0x00: |
|
| 2372 | - // currently, we are not using this for anything |
|
| 2373 | - break; |
|
| 2371 | + case 0x00: |
|
| 2372 | + // currently, we are not using this for anything |
|
| 2373 | + break; |
|
| 2374 | 2374 | |
| 2375 | - default: |
|
| 2376 | - break; |
|
| 2375 | + default: |
|
| 2376 | + break; |
|
| 2377 | 2377 | } |
| 2378 | 2378 | |
| 2379 | 2379 | } else { |
@@ -3181,8 +3181,8 @@ discard block |
||
| 3181 | 3181 | if (!$isNotInit) { |
| 3182 | 3182 | $this->_phpSheet->getPageSetup()->setPaperSize($paperSize); |
| 3183 | 3183 | switch ($isPortrait) { |
| 3184 | - case 0: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); break; |
|
| 3185 | - case 1: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT); break; |
|
| 3184 | + case 0: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); break; |
|
| 3185 | + case 1: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT); break; |
|
| 3186 | 3186 | } |
| 3187 | 3187 | |
| 3188 | 3188 | $this->_phpSheet->getPageSetup()->setScale($scale, false); |
@@ -4356,90 +4356,90 @@ discard block |
||
| 4356 | 4356 | } |
| 4357 | 4357 | |
| 4358 | 4358 | switch ($hyperlinkType) { |
| 4359 | - case 'URL': |
|
| 4360 | - // section 5.58.2: Hyperlink containing a URL |
|
| 4361 | - // e.g. http://example.org/index.php |
|
| 4362 | - |
|
| 4363 | - // offset: var; size: 16; GUID of URL Moniker |
|
| 4364 | - $offset += 16; |
|
| 4365 | - // offset: var; size: 4; size (in bytes) of character array of the URL including trailing zero word |
|
| 4366 | - $us = self::_GetInt4d($recordData, $offset); |
|
| 4367 | - $offset += 4; |
|
| 4368 | - // offset: var; size: $us; character array of the URL, no Unicode string header, always 16-bit characters, zero-terminated |
|
| 4369 | - $url = self::_encodeUTF16(substr($recordData, $offset, $us - 2), false); |
|
| 4370 | - $url .= $hasText ? '#' : ''; |
|
| 4371 | - $offset += $us; |
|
| 4372 | - break; |
|
| 4373 | - |
|
| 4374 | - case 'local': |
|
| 4375 | - // section 5.58.3: Hyperlink to local file |
|
| 4376 | - // examples: |
|
| 4377 | - // mydoc.txt |
|
| 4378 | - // ../../somedoc.xls#Sheet!A1 |
|
| 4359 | + case 'URL': |
|
| 4360 | + // section 5.58.2: Hyperlink containing a URL |
|
| 4361 | + // e.g. http://example.org/index.php |
|
| 4362 | + |
|
| 4363 | + // offset: var; size: 16; GUID of URL Moniker |
|
| 4364 | + $offset += 16; |
|
| 4365 | + // offset: var; size: 4; size (in bytes) of character array of the URL including trailing zero word |
|
| 4366 | + $us = self::_GetInt4d($recordData, $offset); |
|
| 4367 | + $offset += 4; |
|
| 4368 | + // offset: var; size: $us; character array of the URL, no Unicode string header, always 16-bit characters, zero-terminated |
|
| 4369 | + $url = self::_encodeUTF16(substr($recordData, $offset, $us - 2), false); |
|
| 4370 | + $url .= $hasText ? '#' : ''; |
|
| 4371 | + $offset += $us; |
|
| 4372 | + break; |
|
| 4379 | 4373 | |
| 4380 | - // offset: var; size: 16; GUI of File Moniker |
|
| 4381 | - $offset += 16; |
|
| 4374 | + case 'local': |
|
| 4375 | + // section 5.58.3: Hyperlink to local file |
|
| 4376 | + // examples: |
|
| 4377 | + // mydoc.txt |
|
| 4378 | + // ../../somedoc.xls#Sheet!A1 |
|
| 4382 | 4379 | |
| 4383 | - // offset: var; size: 2; directory up-level count. |
|
| 4384 | - $upLevelCount = self::_GetInt2d($recordData, $offset); |
|
| 4385 | - $offset += 2; |
|
| 4380 | + // offset: var; size: 16; GUI of File Moniker |
|
| 4381 | + $offset += 16; |
|
| 4386 | 4382 | |
| 4387 | - // offset: var; size: 4; character count of the shortened file path and name, including trailing zero word |
|
| 4388 | - $sl = self::_GetInt4d($recordData, $offset); |
|
| 4389 | - $offset += 4; |
|
| 4383 | + // offset: var; size: 2; directory up-level count. |
|
| 4384 | + $upLevelCount = self::_GetInt2d($recordData, $offset); |
|
| 4385 | + $offset += 2; |
|
| 4390 | 4386 | |
| 4391 | - // offset: var; size: sl; character array of the shortened file path and name in 8.3-DOS-format (compressed Unicode string) |
|
| 4392 | - $shortenedFilePath = substr($recordData, $offset, $sl); |
|
| 4393 | - $shortenedFilePath = self::_encodeUTF16($shortenedFilePath, true); |
|
| 4394 | - $shortenedFilePath = substr($shortenedFilePath, 0, -1); // remove trailing zero |
|
| 4387 | + // offset: var; size: 4; character count of the shortened file path and name, including trailing zero word |
|
| 4388 | + $sl = self::_GetInt4d($recordData, $offset); |
|
| 4389 | + $offset += 4; |
|
| 4395 | 4390 | |
| 4396 | - $offset += $sl; |
|
| 4391 | + // offset: var; size: sl; character array of the shortened file path and name in 8.3-DOS-format (compressed Unicode string) |
|
| 4392 | + $shortenedFilePath = substr($recordData, $offset, $sl); |
|
| 4393 | + $shortenedFilePath = self::_encodeUTF16($shortenedFilePath, true); |
|
| 4394 | + $shortenedFilePath = substr($shortenedFilePath, 0, -1); // remove trailing zero |
|
| 4397 | 4395 | |
| 4398 | - // offset: var; size: 24; unknown sequence |
|
| 4399 | - $offset += 24; |
|
| 4396 | + $offset += $sl; |
|
| 4400 | 4397 | |
| 4401 | - // extended file path |
|
| 4402 | - // offset: var; size: 4; size of the following file link field including string lenth mark |
|
| 4403 | - $sz = self::_GetInt4d($recordData, $offset); |
|
| 4404 | - $offset += 4; |
|
| 4398 | + // offset: var; size: 24; unknown sequence |
|
| 4399 | + $offset += 24; |
|
| 4405 | 4400 | |
| 4406 | - // only present if $sz > 0 |
|
| 4407 | - if ($sz > 0) { |
|
| 4408 | - // offset: var; size: 4; size of the character array of the extended file path and name |
|
| 4409 | - $xl = self::_GetInt4d($recordData, $offset); |
|
| 4401 | + // extended file path |
|
| 4402 | + // offset: var; size: 4; size of the following file link field including string lenth mark |
|
| 4403 | + $sz = self::_GetInt4d($recordData, $offset); |
|
| 4410 | 4404 | $offset += 4; |
| 4411 | 4405 | |
| 4412 | - // offset: var; size 2; unknown |
|
| 4413 | - $offset += 2; |
|
| 4406 | + // only present if $sz > 0 |
|
| 4407 | + if ($sz > 0) { |
|
| 4408 | + // offset: var; size: 4; size of the character array of the extended file path and name |
|
| 4409 | + $xl = self::_GetInt4d($recordData, $offset); |
|
| 4410 | + $offset += 4; |
|
| 4414 | 4411 | |
| 4415 | - // offset: var; size $xl; character array of the extended file path and name. |
|
| 4416 | - $extendedFilePath = substr($recordData, $offset, $xl); |
|
| 4417 | - $extendedFilePath = self::_encodeUTF16($extendedFilePath, false); |
|
| 4418 | - $offset += $xl; |
|
| 4419 | - } |
|
| 4412 | + // offset: var; size 2; unknown |
|
| 4413 | + $offset += 2; |
|
| 4420 | 4414 | |
| 4421 | - // construct the path |
|
| 4422 | - $url = str_repeat('..\\', $upLevelCount); |
|
| 4423 | - $url .= ($sz > 0) ? |
|
| 4424 | - $extendedFilePath : $shortenedFilePath; // use extended path if available |
|
| 4425 | - $url .= $hasText ? '#' : ''; |
|
| 4415 | + // offset: var; size $xl; character array of the extended file path and name. |
|
| 4416 | + $extendedFilePath = substr($recordData, $offset, $xl); |
|
| 4417 | + $extendedFilePath = self::_encodeUTF16($extendedFilePath, false); |
|
| 4418 | + $offset += $xl; |
|
| 4419 | + } |
|
| 4426 | 4420 | |
| 4427 | - break; |
|
| 4421 | + // construct the path |
|
| 4422 | + $url = str_repeat('..\\', $upLevelCount); |
|
| 4423 | + $url .= ($sz > 0) ? |
|
| 4424 | + $extendedFilePath : $shortenedFilePath; // use extended path if available |
|
| 4425 | + $url .= $hasText ? '#' : ''; |
|
| 4428 | 4426 | |
| 4427 | + break; |
|
| 4429 | 4428 | |
| 4430 | - case 'UNC': |
|
| 4431 | - // section 5.58.4: Hyperlink to a File with UNC (Universal Naming Convention) Path |
|
| 4432 | - // todo: implement |
|
| 4433 | - return; |
|
| 4434 | 4429 | |
| 4435 | - case 'workbook': |
|
| 4436 | - // section 5.58.5: Hyperlink to the Current Workbook |
|
| 4437 | - // e.g. Sheet2!B1:C2, stored in text mark field |
|
| 4438 | - $url = 'sheet://'; |
|
| 4439 | - break; |
|
| 4430 | + case 'UNC': |
|
| 4431 | + // section 5.58.4: Hyperlink to a File with UNC (Universal Naming Convention) Path |
|
| 4432 | + // todo: implement |
|
| 4433 | + return; |
|
| 4440 | 4434 | |
| 4441 | - default: |
|
| 4442 | - return; |
|
| 4435 | + case 'workbook': |
|
| 4436 | + // section 5.58.5: Hyperlink to the Current Workbook |
|
| 4437 | + // e.g. Sheet2!B1:C2, stored in text mark field |
|
| 4438 | + $url = 'sheet://'; |
|
| 4439 | + break; |
|
| 4440 | + |
|
| 4441 | + default: |
|
| 4442 | + return; |
|
| 4443 | 4443 | |
| 4444 | 4444 | } |
| 4445 | 4445 | |
@@ -4861,54 +4861,54 @@ discard block |
||
| 4861 | 4861 | $iData = substr($recordData, 8); |
| 4862 | 4862 | |
| 4863 | 4863 | switch ($cf) { |
| 4864 | - case 0x09: // Windows bitmap format |
|
| 4865 | - // BITMAPCOREINFO |
|
| 4866 | - // 1. BITMAPCOREHEADER |
|
| 4867 | - // offset: 0; size: 4; bcSize, Specifies the number of bytes required by the structure |
|
| 4868 | - $bcSize = self::_GetInt4d($iData, 0); |
|
| 4869 | -// var_dump($bcSize); |
|
| 4870 | - |
|
| 4871 | - // offset: 4; size: 2; bcWidth, specifies the width of the bitmap, in pixels |
|
| 4872 | - $bcWidth = self::_GetInt2d($iData, 4); |
|
| 4873 | -// var_dump($bcWidth); |
|
| 4874 | - |
|
| 4875 | - // offset: 6; size: 2; bcHeight, specifies the height of the bitmap, in pixels. |
|
| 4876 | - $bcHeight = self::_GetInt2d($iData, 6); |
|
| 4877 | -// var_dump($bcHeight); |
|
| 4878 | - $ih = imagecreatetruecolor($bcWidth, $bcHeight); |
|
| 4879 | - |
|
| 4880 | - // offset: 8; size: 2; bcPlanes, specifies the number of planes for the target device. This value must be 1 |
|
| 4881 | - |
|
| 4882 | - // offset: 10; size: 2; bcBitCount specifies the number of bits-per-pixel. This value must be 1, 4, 8, or 24 |
|
| 4883 | - $bcBitCount = self::_GetInt2d($iData, 10); |
|
| 4884 | -// var_dump($bcBitCount); |
|
| 4885 | - |
|
| 4886 | - $rgbString = substr($iData, 12); |
|
| 4887 | - $rgbTriples = array(); |
|
| 4888 | - while (strlen($rgbString) > 0) { |
|
| 4889 | - $rgbTriples[] = unpack('Cb/Cg/Cr', $rgbString); |
|
| 4890 | - $rgbString = substr($rgbString, 3); |
|
| 4891 | - } |
|
| 4892 | - $x = 0; |
|
| 4893 | - $y = 0; |
|
| 4894 | - foreach ($rgbTriples as $i => $rgbTriple) { |
|
| 4895 | - $color = imagecolorallocate($ih, $rgbTriple['r'], $rgbTriple['g'], $rgbTriple['b']); |
|
| 4896 | - imagesetpixel($ih, $x, $bcHeight - 1 - $y, $color); |
|
| 4897 | - $x = ($x + 1) % $bcWidth; |
|
| 4898 | - $y = $y + floor(($x + 1) / $bcWidth); |
|
| 4899 | - } |
|
| 4900 | - //imagepng($ih, 'image.png'); |
|
| 4864 | + case 0x09: // Windows bitmap format |
|
| 4865 | + // BITMAPCOREINFO |
|
| 4866 | + // 1. BITMAPCOREHEADER |
|
| 4867 | + // offset: 0; size: 4; bcSize, Specifies the number of bytes required by the structure |
|
| 4868 | + $bcSize = self::_GetInt4d($iData, 0); |
|
| 4869 | + // var_dump($bcSize); |
|
| 4870 | + |
|
| 4871 | + // offset: 4; size: 2; bcWidth, specifies the width of the bitmap, in pixels |
|
| 4872 | + $bcWidth = self::_GetInt2d($iData, 4); |
|
| 4873 | + // var_dump($bcWidth); |
|
| 4874 | + |
|
| 4875 | + // offset: 6; size: 2; bcHeight, specifies the height of the bitmap, in pixels. |
|
| 4876 | + $bcHeight = self::_GetInt2d($iData, 6); |
|
| 4877 | + // var_dump($bcHeight); |
|
| 4878 | + $ih = imagecreatetruecolor($bcWidth, $bcHeight); |
|
| 4879 | + |
|
| 4880 | + // offset: 8; size: 2; bcPlanes, specifies the number of planes for the target device. This value must be 1 |
|
| 4881 | + |
|
| 4882 | + // offset: 10; size: 2; bcBitCount specifies the number of bits-per-pixel. This value must be 1, 4, 8, or 24 |
|
| 4883 | + $bcBitCount = self::_GetInt2d($iData, 10); |
|
| 4884 | + // var_dump($bcBitCount); |
|
| 4885 | + |
|
| 4886 | + $rgbString = substr($iData, 12); |
|
| 4887 | + $rgbTriples = array(); |
|
| 4888 | + while (strlen($rgbString) > 0) { |
|
| 4889 | + $rgbTriples[] = unpack('Cb/Cg/Cr', $rgbString); |
|
| 4890 | + $rgbString = substr($rgbString, 3); |
|
| 4891 | + } |
|
| 4892 | + $x = 0; |
|
| 4893 | + $y = 0; |
|
| 4894 | + foreach ($rgbTriples as $i => $rgbTriple) { |
|
| 4895 | + $color = imagecolorallocate($ih, $rgbTriple['r'], $rgbTriple['g'], $rgbTriple['b']); |
|
| 4896 | + imagesetpixel($ih, $x, $bcHeight - 1 - $y, $color); |
|
| 4897 | + $x = ($x + 1) % $bcWidth; |
|
| 4898 | + $y = $y + floor(($x + 1) / $bcWidth); |
|
| 4899 | + } |
|
| 4900 | + //imagepng($ih, 'image.png'); |
|
| 4901 | 4901 | |
| 4902 | - $drawing = new PHPExcel_Worksheet_Drawing(); |
|
| 4903 | - $drawing->setPath($filename); |
|
| 4904 | - $drawing->setWorksheet($this->_phpSheet); |
|
| 4902 | + $drawing = new PHPExcel_Worksheet_Drawing(); |
|
| 4903 | + $drawing->setPath($filename); |
|
| 4904 | + $drawing->setWorksheet($this->_phpSheet); |
|
| 4905 | 4905 | |
| 4906 | - break; |
|
| 4906 | + break; |
|
| 4907 | 4907 | |
| 4908 | - case 0x02: // Windows metafile or Macintosh PICT format |
|
| 4909 | - case 0x0e: // native format |
|
| 4910 | - default; |
|
| 4911 | - break; |
|
| 4908 | + case 0x02: // Windows metafile or Macintosh PICT format |
|
| 4909 | + case 0x0e: // native format |
|
| 4910 | + default; |
|
| 4911 | + break; |
|
| 4912 | 4912 | |
| 4913 | 4913 | } |
| 4914 | 4914 | |
@@ -5100,132 +5100,132 @@ discard block |
||
| 5100 | 5100 | $space5 = isset($space5) ? $space5 : ''; // carriage returns before closing parenthesis |
| 5101 | 5101 | |
| 5102 | 5102 | switch ($token['name']) { |
| 5103 | - case 'tAdd': // addition |
|
| 5104 | - case 'tConcat': // addition |
|
| 5105 | - case 'tDiv': // division |
|
| 5106 | - case 'tEQ': // equality |
|
| 5107 | - case 'tGE': // greater than or equal |
|
| 5108 | - case 'tGT': // greater than |
|
| 5109 | - case 'tIsect': // intersection |
|
| 5110 | - case 'tLE': // less than or equal |
|
| 5111 | - case 'tList': // less than or equal |
|
| 5112 | - case 'tLT': // less than |
|
| 5113 | - case 'tMul': // multiplication |
|
| 5114 | - case 'tNE': // multiplication |
|
| 5115 | - case 'tPower': // power |
|
| 5116 | - case 'tRange': // range |
|
| 5117 | - case 'tSub': // subtraction |
|
| 5118 | - $op2 = array_pop($formulaStrings); |
|
| 5119 | - $op1 = array_pop($formulaStrings); |
|
| 5120 | - $formulaStrings[] = "$op1$space1$space0{$token['data']}$op2"; |
|
| 5121 | - unset($space0, $space1); |
|
| 5122 | - break; |
|
| 5123 | - case 'tUplus': // unary plus |
|
| 5124 | - case 'tUminus': // unary minus |
|
| 5125 | - $op = array_pop($formulaStrings); |
|
| 5126 | - $formulaStrings[] = "$space1$space0{$token['data']}$op"; |
|
| 5127 | - unset($space0, $space1); |
|
| 5128 | - break; |
|
| 5129 | - case 'tPercent': // percent sign |
|
| 5130 | - $op = array_pop($formulaStrings); |
|
| 5131 | - $formulaStrings[] = "$op$space1$space0{$token['data']}"; |
|
| 5132 | - unset($space0, $space1); |
|
| 5133 | - break; |
|
| 5134 | - case 'tAttrVolatile': // indicates volatile function |
|
| 5135 | - case 'tAttrIf': |
|
| 5136 | - case 'tAttrSkip': |
|
| 5137 | - case 'tAttrChoose': |
|
| 5138 | - // token is only important for Excel formula evaluator |
|
| 5139 | - // do nothing |
|
| 5140 | - break; |
|
| 5141 | - case 'tAttrSpace': // space / carriage return |
|
| 5142 | - // space will be used when next token arrives, do not alter formulaString stack |
|
| 5143 | - switch ($token['data']['spacetype']) { |
|
| 5144 | - case 'type0': |
|
| 5145 | - $space0 = str_repeat(' ', $token['data']['spacecount']); |
|
| 5146 | - break; |
|
| 5147 | - case 'type1': |
|
| 5148 | - $space1 = str_repeat("\n", $token['data']['spacecount']); |
|
| 5149 | - break; |
|
| 5150 | - case 'type2': |
|
| 5151 | - $space2 = str_repeat(' ', $token['data']['spacecount']); |
|
| 5103 | + case 'tAdd': // addition |
|
| 5104 | + case 'tConcat': // addition |
|
| 5105 | + case 'tDiv': // division |
|
| 5106 | + case 'tEQ': // equality |
|
| 5107 | + case 'tGE': // greater than or equal |
|
| 5108 | + case 'tGT': // greater than |
|
| 5109 | + case 'tIsect': // intersection |
|
| 5110 | + case 'tLE': // less than or equal |
|
| 5111 | + case 'tList': // less than or equal |
|
| 5112 | + case 'tLT': // less than |
|
| 5113 | + case 'tMul': // multiplication |
|
| 5114 | + case 'tNE': // multiplication |
|
| 5115 | + case 'tPower': // power |
|
| 5116 | + case 'tRange': // range |
|
| 5117 | + case 'tSub': // subtraction |
|
| 5118 | + $op2 = array_pop($formulaStrings); |
|
| 5119 | + $op1 = array_pop($formulaStrings); |
|
| 5120 | + $formulaStrings[] = "$op1$space1$space0{$token['data']}$op2"; |
|
| 5121 | + unset($space0, $space1); |
|
| 5152 | 5122 | break; |
| 5153 | - case 'type3': |
|
| 5154 | - $space3 = str_repeat("\n", $token['data']['spacecount']); |
|
| 5123 | + case 'tUplus': // unary plus |
|
| 5124 | + case 'tUminus': // unary minus |
|
| 5125 | + $op = array_pop($formulaStrings); |
|
| 5126 | + $formulaStrings[] = "$space1$space0{$token['data']}$op"; |
|
| 5127 | + unset($space0, $space1); |
|
| 5155 | 5128 | break; |
| 5156 | - case 'type4': |
|
| 5157 | - $space4 = str_repeat(' ', $token['data']['spacecount']); |
|
| 5129 | + case 'tPercent': // percent sign |
|
| 5130 | + $op = array_pop($formulaStrings); |
|
| 5131 | + $formulaStrings[] = "$op$space1$space0{$token['data']}"; |
|
| 5132 | + unset($space0, $space1); |
|
| 5158 | 5133 | break; |
| 5159 | - case 'type5': |
|
| 5160 | - $space5 = str_repeat("\n", $token['data']['spacecount']); |
|
| 5134 | + case 'tAttrVolatile': // indicates volatile function |
|
| 5135 | + case 'tAttrIf': |
|
| 5136 | + case 'tAttrSkip': |
|
| 5137 | + case 'tAttrChoose': |
|
| 5138 | + // token is only important for Excel formula evaluator |
|
| 5139 | + // do nothing |
|
| 5161 | 5140 | break; |
| 5162 | - } |
|
| 5163 | - break; |
|
| 5164 | - case 'tAttrSum': // SUM function with one parameter |
|
| 5165 | - $op = array_pop($formulaStrings); |
|
| 5166 | - $formulaStrings[] = "{$space1}{$space0}SUM($op)"; |
|
| 5167 | - unset($space0, $space1); |
|
| 5168 | - break; |
|
| 5169 | - case 'tFunc': // function with fixed number of arguments |
|
| 5170 | - case 'tFuncV': // function with variable number of arguments |
|
| 5171 | - if ($token['data']['function'] != '') { |
|
| 5172 | - // normal function |
|
| 5173 | - $ops = array(); // array of operators |
|
| 5174 | - for ($i = 0; $i < $token['data']['args']; ++$i) { |
|
| 5175 | - $ops[] = array_pop($formulaStrings); |
|
| 5141 | + case 'tAttrSpace': // space / carriage return |
|
| 5142 | + // space will be used when next token arrives, do not alter formulaString stack |
|
| 5143 | + switch ($token['data']['spacetype']) { |
|
| 5144 | + case 'type0': |
|
| 5145 | + $space0 = str_repeat(' ', $token['data']['spacecount']); |
|
| 5146 | + break; |
|
| 5147 | + case 'type1': |
|
| 5148 | + $space1 = str_repeat("\n", $token['data']['spacecount']); |
|
| 5149 | + break; |
|
| 5150 | + case 'type2': |
|
| 5151 | + $space2 = str_repeat(' ', $token['data']['spacecount']); |
|
| 5152 | + break; |
|
| 5153 | + case 'type3': |
|
| 5154 | + $space3 = str_repeat("\n", $token['data']['spacecount']); |
|
| 5155 | + break; |
|
| 5156 | + case 'type4': |
|
| 5157 | + $space4 = str_repeat(' ', $token['data']['spacecount']); |
|
| 5158 | + break; |
|
| 5159 | + case 'type5': |
|
| 5160 | + $space5 = str_repeat("\n", $token['data']['spacecount']); |
|
| 5161 | + break; |
|
| 5176 | 5162 | } |
| 5177 | - $ops = array_reverse($ops); |
|
| 5178 | - $formulaStrings[] = "$space1$space0{$token['data']['function']}(" . implode(',', $ops) . ")"; |
|
| 5163 | + break; |
|
| 5164 | + case 'tAttrSum': // SUM function with one parameter |
|
| 5165 | + $op = array_pop($formulaStrings); |
|
| 5166 | + $formulaStrings[] = "{$space1}{$space0}SUM($op)"; |
|
| 5179 | 5167 | unset($space0, $space1); |
| 5180 | - } else { |
|
| 5181 | - // add-in function |
|
| 5182 | - $ops = array(); // array of operators |
|
| 5183 | - for ($i = 0; $i < $token['data']['args'] - 1; ++$i) { |
|
| 5184 | - $ops[] = array_pop($formulaStrings); |
|
| 5168 | + break; |
|
| 5169 | + case 'tFunc': // function with fixed number of arguments |
|
| 5170 | + case 'tFuncV': // function with variable number of arguments |
|
| 5171 | + if ($token['data']['function'] != '') { |
|
| 5172 | + // normal function |
|
| 5173 | + $ops = array(); // array of operators |
|
| 5174 | + for ($i = 0; $i < $token['data']['args']; ++$i) { |
|
| 5175 | + $ops[] = array_pop($formulaStrings); |
|
| 5176 | + } |
|
| 5177 | + $ops = array_reverse($ops); |
|
| 5178 | + $formulaStrings[] = "$space1$space0{$token['data']['function']}(" . implode(',', $ops) . ")"; |
|
| 5179 | + unset($space0, $space1); |
|
| 5180 | + } else { |
|
| 5181 | + // add-in function |
|
| 5182 | + $ops = array(); // array of operators |
|
| 5183 | + for ($i = 0; $i < $token['data']['args'] - 1; ++$i) { |
|
| 5184 | + $ops[] = array_pop($formulaStrings); |
|
| 5185 | + } |
|
| 5186 | + $ops = array_reverse($ops); |
|
| 5187 | + $function = array_pop($formulaStrings); |
|
| 5188 | + $formulaStrings[] = "$space1$space0$function(" . implode(',', $ops) . ")"; |
|
| 5189 | + unset($space0, $space1); |
|
| 5185 | 5190 | } |
| 5186 | - $ops = array_reverse($ops); |
|
| 5187 | - $function = array_pop($formulaStrings); |
|
| 5188 | - $formulaStrings[] = "$space1$space0$function(" . implode(',', $ops) . ")"; |
|
| 5191 | + break; |
|
| 5192 | + case 'tParen': // parenthesis |
|
| 5193 | + $expression = array_pop($formulaStrings); |
|
| 5194 | + $formulaStrings[] = "$space3$space2($expression$space5$space4)"; |
|
| 5195 | + unset($space2, $space3, $space4, $space5); |
|
| 5196 | + break; |
|
| 5197 | + case 'tArray': // array constant |
|
| 5198 | + $constantArray = self::_readBIFF8ConstantArray($additionalData); |
|
| 5199 | + $formulaStrings[] = $space1 . $space0 . $constantArray['value']; |
|
| 5200 | + $additionalData = substr($additionalData, $constantArray['size']); // bite of chunk of additional data |
|
| 5189 | 5201 | unset($space0, $space1); |
| 5190 | - } |
|
| 5191 | - break; |
|
| 5192 | - case 'tParen': // parenthesis |
|
| 5193 | - $expression = array_pop($formulaStrings); |
|
| 5194 | - $formulaStrings[] = "$space3$space2($expression$space5$space4)"; |
|
| 5195 | - unset($space2, $space3, $space4, $space5); |
|
| 5196 | - break; |
|
| 5197 | - case 'tArray': // array constant |
|
| 5198 | - $constantArray = self::_readBIFF8ConstantArray($additionalData); |
|
| 5199 | - $formulaStrings[] = $space1 . $space0 . $constantArray['value']; |
|
| 5200 | - $additionalData = substr($additionalData, $constantArray['size']); // bite of chunk of additional data |
|
| 5201 | - unset($space0, $space1); |
|
| 5202 | - break; |
|
| 5203 | - case 'tMemArea': |
|
| 5204 | - // bite off chunk of additional data |
|
| 5205 | - $cellRangeAddressList = $this->_readBIFF8CellRangeAddressList($additionalData); |
|
| 5206 | - $additionalData = substr($additionalData, $cellRangeAddressList['size']); |
|
| 5207 | - $formulaStrings[] = "$space1$space0{$token['data']}"; |
|
| 5208 | - unset($space0, $space1); |
|
| 5209 | - break; |
|
| 5210 | - case 'tArea': // cell range address |
|
| 5211 | - case 'tBool': // boolean |
|
| 5212 | - case 'tErr': // error code |
|
| 5213 | - case 'tInt': // integer |
|
| 5214 | - case 'tMemErr': |
|
| 5215 | - case 'tMemFunc': |
|
| 5216 | - case 'tMissArg': |
|
| 5217 | - case 'tName': |
|
| 5218 | - case 'tNameX': |
|
| 5219 | - case 'tNum': // number |
|
| 5220 | - case 'tRef': // single cell reference |
|
| 5221 | - case 'tRef3d': // 3d cell reference |
|
| 5222 | - case 'tArea3d': // 3d cell range reference |
|
| 5223 | - case 'tRefN': |
|
| 5224 | - case 'tAreaN': |
|
| 5225 | - case 'tStr': // string |
|
| 5226 | - $formulaStrings[] = "$space1$space0{$token['data']}"; |
|
| 5227 | - unset($space0, $space1); |
|
| 5228 | - break; |
|
| 5202 | + break; |
|
| 5203 | + case 'tMemArea': |
|
| 5204 | + // bite off chunk of additional data |
|
| 5205 | + $cellRangeAddressList = $this->_readBIFF8CellRangeAddressList($additionalData); |
|
| 5206 | + $additionalData = substr($additionalData, $cellRangeAddressList['size']); |
|
| 5207 | + $formulaStrings[] = "$space1$space0{$token['data']}"; |
|
| 5208 | + unset($space0, $space1); |
|
| 5209 | + break; |
|
| 5210 | + case 'tArea': // cell range address |
|
| 5211 | + case 'tBool': // boolean |
|
| 5212 | + case 'tErr': // error code |
|
| 5213 | + case 'tInt': // integer |
|
| 5214 | + case 'tMemErr': |
|
| 5215 | + case 'tMemFunc': |
|
| 5216 | + case 'tMissArg': |
|
| 5217 | + case 'tName': |
|
| 5218 | + case 'tNameX': |
|
| 5219 | + case 'tNum': // number |
|
| 5220 | + case 'tRef': // single cell reference |
|
| 5221 | + case 'tRef3d': // 3d cell reference |
|
| 5222 | + case 'tArea3d': // 3d cell range reference |
|
| 5223 | + case 'tRefN': |
|
| 5224 | + case 'tAreaN': |
|
| 5225 | + case 'tStr': // string |
|
| 5226 | + $formulaStrings[] = "$space1$space0{$token['data']}"; |
|
| 5227 | + unset($space0, $space1); |
|
| 5228 | + break; |
|
| 5229 | 5229 | } |
| 5230 | 5230 | } |
| 5231 | 5231 | $formulaString = $formulaStrings[0]; |
@@ -5253,546 +5253,546 @@ discard block |
||
| 5253 | 5253 | $name = false; // initialize token name |
| 5254 | 5254 | |
| 5255 | 5255 | switch ($id) { |
| 5256 | - case 0x03: $name = 'tAdd'; $size = 1; $data = '+'; break; |
|
| 5257 | - case 0x04: $name = 'tSub'; $size = 1; $data = '-'; break; |
|
| 5258 | - case 0x05: $name = 'tMul'; $size = 1; $data = '*'; break; |
|
| 5259 | - case 0x06: $name = 'tDiv'; $size = 1; $data = '/'; break; |
|
| 5260 | - case 0x07: $name = 'tPower'; $size = 1; $data = '^'; break; |
|
| 5261 | - case 0x08: $name = 'tConcat'; $size = 1; $data = '&'; break; |
|
| 5262 | - case 0x09: $name = 'tLT'; $size = 1; $data = '<'; break; |
|
| 5263 | - case 0x0A: $name = 'tLE'; $size = 1; $data = '<='; break; |
|
| 5264 | - case 0x0B: $name = 'tEQ'; $size = 1; $data = '='; break; |
|
| 5265 | - case 0x0C: $name = 'tGE'; $size = 1; $data = '>='; break; |
|
| 5266 | - case 0x0D: $name = 'tGT'; $size = 1; $data = '>'; break; |
|
| 5267 | - case 0x0E: $name = 'tNE'; $size = 1; $data = '<>'; break; |
|
| 5268 | - case 0x0F: $name = 'tIsect'; $size = 1; $data = ' '; break; |
|
| 5269 | - case 0x10: $name = 'tList'; $size = 1; $data = ','; break; |
|
| 5270 | - case 0x11: $name = 'tRange'; $size = 1; $data = ':'; break; |
|
| 5271 | - case 0x12: $name = 'tUplus'; $size = 1; $data = '+'; break; |
|
| 5272 | - case 0x13: $name = 'tUminus'; $size = 1; $data = '-'; break; |
|
| 5273 | - case 0x14: $name = 'tPercent'; $size = 1; $data = '%'; break; |
|
| 5274 | - case 0x15: // parenthesis |
|
| 5275 | - $name = 'tParen'; |
|
| 5276 | - $size = 1; |
|
| 5277 | - $data = null; |
|
| 5278 | - break; |
|
| 5279 | - case 0x16: // missing argument |
|
| 5280 | - $name = 'tMissArg'; |
|
| 5281 | - $size = 1; |
|
| 5282 | - $data = ''; |
|
| 5283 | - break; |
|
| 5284 | - case 0x17: // string |
|
| 5285 | - $name = 'tStr'; |
|
| 5286 | - // offset: 1; size: var; Unicode string, 8-bit string length |
|
| 5287 | - $string = self::_readUnicodeStringShort(substr($formulaData, 1)); |
|
| 5288 | - $size = 1 + $string['size']; |
|
| 5289 | - $data = self::_UTF8toExcelDoubleQuoted($string['value']); |
|
| 5290 | - break; |
|
| 5291 | - case 0x19: // Special attribute |
|
| 5292 | - // offset: 1; size: 1; attribute type flags: |
|
| 5293 | - switch (ord($formulaData[1])) { |
|
| 5294 | - case 0x01: |
|
| 5295 | - $name = 'tAttrVolatile'; |
|
| 5296 | - $size = 4; |
|
| 5256 | + case 0x03: $name = 'tAdd'; $size = 1; $data = '+'; break; |
|
| 5257 | + case 0x04: $name = 'tSub'; $size = 1; $data = '-'; break; |
|
| 5258 | + case 0x05: $name = 'tMul'; $size = 1; $data = '*'; break; |
|
| 5259 | + case 0x06: $name = 'tDiv'; $size = 1; $data = '/'; break; |
|
| 5260 | + case 0x07: $name = 'tPower'; $size = 1; $data = '^'; break; |
|
| 5261 | + case 0x08: $name = 'tConcat'; $size = 1; $data = '&'; break; |
|
| 5262 | + case 0x09: $name = 'tLT'; $size = 1; $data = '<'; break; |
|
| 5263 | + case 0x0A: $name = 'tLE'; $size = 1; $data = '<='; break; |
|
| 5264 | + case 0x0B: $name = 'tEQ'; $size = 1; $data = '='; break; |
|
| 5265 | + case 0x0C: $name = 'tGE'; $size = 1; $data = '>='; break; |
|
| 5266 | + case 0x0D: $name = 'tGT'; $size = 1; $data = '>'; break; |
|
| 5267 | + case 0x0E: $name = 'tNE'; $size = 1; $data = '<>'; break; |
|
| 5268 | + case 0x0F: $name = 'tIsect'; $size = 1; $data = ' '; break; |
|
| 5269 | + case 0x10: $name = 'tList'; $size = 1; $data = ','; break; |
|
| 5270 | + case 0x11: $name = 'tRange'; $size = 1; $data = ':'; break; |
|
| 5271 | + case 0x12: $name = 'tUplus'; $size = 1; $data = '+'; break; |
|
| 5272 | + case 0x13: $name = 'tUminus'; $size = 1; $data = '-'; break; |
|
| 5273 | + case 0x14: $name = 'tPercent'; $size = 1; $data = '%'; break; |
|
| 5274 | + case 0x15: // parenthesis |
|
| 5275 | + $name = 'tParen'; |
|
| 5276 | + $size = 1; |
|
| 5297 | 5277 | $data = null; |
| 5298 | 5278 | break; |
| 5299 | - case 0x02: |
|
| 5300 | - $name = 'tAttrIf'; |
|
| 5301 | - $size = 4; |
|
| 5302 | - $data = null; |
|
| 5303 | - break; |
|
| 5304 | - case 0x04: |
|
| 5305 | - $name = 'tAttrChoose'; |
|
| 5306 | - // offset: 2; size: 2; number of choices in the CHOOSE function ($nc, number of parameters decreased by 1) |
|
| 5307 | - $nc = self::_GetInt2d($formulaData, 2); |
|
| 5308 | - // offset: 4; size: 2 * $nc |
|
| 5309 | - // offset: 4 + 2 * $nc; size: 2 |
|
| 5310 | - $size = 2 * $nc + 6; |
|
| 5311 | - $data = null; |
|
| 5279 | + case 0x16: // missing argument |
|
| 5280 | + $name = 'tMissArg'; |
|
| 5281 | + $size = 1; |
|
| 5282 | + $data = ''; |
|
| 5312 | 5283 | break; |
| 5313 | - case 0x08: |
|
| 5314 | - $name = 'tAttrSkip'; |
|
| 5315 | - $size = 4; |
|
| 5316 | - $data = null; |
|
| 5284 | + case 0x17: // string |
|
| 5285 | + $name = 'tStr'; |
|
| 5286 | + // offset: 1; size: var; Unicode string, 8-bit string length |
|
| 5287 | + $string = self::_readUnicodeStringShort(substr($formulaData, 1)); |
|
| 5288 | + $size = 1 + $string['size']; |
|
| 5289 | + $data = self::_UTF8toExcelDoubleQuoted($string['value']); |
|
| 5317 | 5290 | break; |
| 5318 | - case 0x10: |
|
| 5319 | - $name = 'tAttrSum'; |
|
| 5320 | - $size = 4; |
|
| 5321 | - $data = null; |
|
| 5322 | - break; |
|
| 5323 | - case 0x40: |
|
| 5324 | - case 0x41: |
|
| 5325 | - $name = 'tAttrSpace'; |
|
| 5326 | - $size = 4; |
|
| 5327 | - // offset: 2; size: 2; space type and position |
|
| 5328 | - switch (ord($formulaData[2])) { |
|
| 5329 | - case 0x00: |
|
| 5330 | - $spacetype = 'type0'; |
|
| 5331 | - break; |
|
| 5332 | - case 0x01: |
|
| 5333 | - $spacetype = 'type1'; |
|
| 5334 | - break; |
|
| 5335 | - case 0x02: |
|
| 5336 | - $spacetype = 'type2'; |
|
| 5337 | - break; |
|
| 5338 | - case 0x03: |
|
| 5339 | - $spacetype = 'type3'; |
|
| 5340 | - break; |
|
| 5341 | - case 0x04: |
|
| 5342 | - $spacetype = 'type4'; |
|
| 5343 | - break; |
|
| 5344 | - case 0x05: |
|
| 5345 | - $spacetype = 'type5'; |
|
| 5346 | - break; |
|
| 5347 | - default: |
|
| 5348 | - throw new Exception('Unrecognized space type in tAttrSpace token'); |
|
| 5349 | - break; |
|
| 5350 | - } |
|
| 5351 | - // offset: 3; size: 1; number of inserted spaces/carriage returns |
|
| 5352 | - $spacecount = ord($formulaData[3]); |
|
| 5291 | + case 0x19: // Special attribute |
|
| 5292 | + // offset: 1; size: 1; attribute type flags: |
|
| 5293 | + switch (ord($formulaData[1])) { |
|
| 5294 | + case 0x01: |
|
| 5295 | + $name = 'tAttrVolatile'; |
|
| 5296 | + $size = 4; |
|
| 5297 | + $data = null; |
|
| 5298 | + break; |
|
| 5299 | + case 0x02: |
|
| 5300 | + $name = 'tAttrIf'; |
|
| 5301 | + $size = 4; |
|
| 5302 | + $data = null; |
|
| 5303 | + break; |
|
| 5304 | + case 0x04: |
|
| 5305 | + $name = 'tAttrChoose'; |
|
| 5306 | + // offset: 2; size: 2; number of choices in the CHOOSE function ($nc, number of parameters decreased by 1) |
|
| 5307 | + $nc = self::_GetInt2d($formulaData, 2); |
|
| 5308 | + // offset: 4; size: 2 * $nc |
|
| 5309 | + // offset: 4 + 2 * $nc; size: 2 |
|
| 5310 | + $size = 2 * $nc + 6; |
|
| 5311 | + $data = null; |
|
| 5312 | + break; |
|
| 5313 | + case 0x08: |
|
| 5314 | + $name = 'tAttrSkip'; |
|
| 5315 | + $size = 4; |
|
| 5316 | + $data = null; |
|
| 5317 | + break; |
|
| 5318 | + case 0x10: |
|
| 5319 | + $name = 'tAttrSum'; |
|
| 5320 | + $size = 4; |
|
| 5321 | + $data = null; |
|
| 5322 | + break; |
|
| 5323 | + case 0x40: |
|
| 5324 | + case 0x41: |
|
| 5325 | + $name = 'tAttrSpace'; |
|
| 5326 | + $size = 4; |
|
| 5327 | + // offset: 2; size: 2; space type and position |
|
| 5328 | + switch (ord($formulaData[2])) { |
|
| 5329 | + case 0x00: |
|
| 5330 | + $spacetype = 'type0'; |
|
| 5331 | + break; |
|
| 5332 | + case 0x01: |
|
| 5333 | + $spacetype = 'type1'; |
|
| 5334 | + break; |
|
| 5335 | + case 0x02: |
|
| 5336 | + $spacetype = 'type2'; |
|
| 5337 | + break; |
|
| 5338 | + case 0x03: |
|
| 5339 | + $spacetype = 'type3'; |
|
| 5340 | + break; |
|
| 5341 | + case 0x04: |
|
| 5342 | + $spacetype = 'type4'; |
|
| 5343 | + break; |
|
| 5344 | + case 0x05: |
|
| 5345 | + $spacetype = 'type5'; |
|
| 5346 | + break; |
|
| 5347 | + default: |
|
| 5348 | + throw new Exception('Unrecognized space type in tAttrSpace token'); |
|
| 5349 | + break; |
|
| 5350 | + } |
|
| 5351 | + // offset: 3; size: 1; number of inserted spaces/carriage returns |
|
| 5352 | + $spacecount = ord($formulaData[3]); |
|
| 5353 | 5353 | |
| 5354 | - $data = array('spacetype' => $spacetype, 'spacecount' => $spacecount); |
|
| 5355 | - break; |
|
| 5354 | + $data = array('spacetype' => $spacetype, 'spacecount' => $spacecount); |
|
| 5355 | + break; |
|
| 5356 | 5356 | default: |
| 5357 | 5357 | throw new Exception('Unrecognized attribute flag in tAttr token'); |
| 5358 | 5358 | break; |
| 5359 | 5359 | } |
| 5360 | 5360 | break; |
| 5361 | - case 0x1C: // error code |
|
| 5362 | - // offset: 1; size: 1; error code |
|
| 5363 | - $name = 'tErr'; |
|
| 5364 | - $size = 2; |
|
| 5365 | - $data = self::_mapErrorCode(ord($formulaData[1])); |
|
| 5366 | - break; |
|
| 5367 | - case 0x1D: // boolean |
|
| 5368 | - // offset: 1; size: 1; 0 = false, 1 = true; |
|
| 5369 | - $name = 'tBool'; |
|
| 5370 | - $size = 2; |
|
| 5371 | - $data = ord($formulaData[1]) ? 'TRUE' : 'FALSE'; |
|
| 5372 | - break; |
|
| 5373 | - case 0x1E: // integer |
|
| 5374 | - // offset: 1; size: 2; unsigned 16-bit integer |
|
| 5375 | - $name = 'tInt'; |
|
| 5376 | - $size = 3; |
|
| 5377 | - $data = self::_GetInt2d($formulaData, 1); |
|
| 5378 | - break; |
|
| 5379 | - case 0x1F: // number |
|
| 5380 | - // offset: 1; size: 8; |
|
| 5381 | - $name = 'tNum'; |
|
| 5382 | - $size = 9; |
|
| 5383 | - $data = self::_extractNumber(substr($formulaData, 1)); |
|
| 5384 | - $data = str_replace(',', '.', (string)$data); // in case non-English locale |
|
| 5385 | - break; |
|
| 5386 | - case 0x20: // array constant |
|
| 5387 | - case 0x40: |
|
| 5388 | - case 0x60: |
|
| 5389 | - // offset: 1; size: 7; not used |
|
| 5390 | - $name = 'tArray'; |
|
| 5391 | - $size = 8; |
|
| 5392 | - $data = null; |
|
| 5393 | - break; |
|
| 5394 | - case 0x21: // function with fixed number of arguments |
|
| 5395 | - case 0x41: |
|
| 5396 | - case 0x61: |
|
| 5397 | - $name = 'tFunc'; |
|
| 5398 | - $size = 3; |
|
| 5399 | - // offset: 1; size: 2; index to built-in sheet function |
|
| 5400 | - switch (self::_GetInt2d($formulaData, 1)) { |
|
| 5401 | - case 2: $function = 'ISNA'; $args = 1; break; |
|
| 5402 | - case 3: $function = 'ISERROR'; $args = 1; break; |
|
| 5403 | - case 10: $function = 'NA'; $args = 0; break; |
|
| 5404 | - case 15: $function = 'SIN'; $args = 1; break; |
|
| 5405 | - case 16: $function = 'COS'; $args = 1; break; |
|
| 5406 | - case 17: $function = 'TAN'; $args = 1; break; |
|
| 5407 | - case 18: $function = 'ATAN'; $args = 1; break; |
|
| 5408 | - case 19: $function = 'PI'; $args = 0; break; |
|
| 5409 | - case 20: $function = 'SQRT'; $args = 1; break; |
|
| 5410 | - case 21: $function = 'EXP'; $args = 1; break; |
|
| 5411 | - case 22: $function = 'LN'; $args = 1; break; |
|
| 5412 | - case 23: $function = 'LOG10'; $args = 1; break; |
|
| 5413 | - case 24: $function = 'ABS'; $args = 1; break; |
|
| 5414 | - case 25: $function = 'INT'; $args = 1; break; |
|
| 5415 | - case 26: $function = 'SIGN'; $args = 1; break; |
|
| 5416 | - case 27: $function = 'ROUND'; $args = 2; break; |
|
| 5417 | - case 30: $function = 'REPT'; $args = 2; break; |
|
| 5418 | - case 31: $function = 'MID'; $args = 3; break; |
|
| 5419 | - case 32: $function = 'LEN'; $args = 1; break; |
|
| 5420 | - case 33: $function = 'VALUE'; $args = 1; break; |
|
| 5421 | - case 34: $function = 'TRUE'; $args = 0; break; |
|
| 5422 | - case 35: $function = 'FALSE'; $args = 0; break; |
|
| 5423 | - case 38: $function = 'NOT'; $args = 1; break; |
|
| 5424 | - case 39: $function = 'MOD'; $args = 2; break; |
|
| 5425 | - case 40: $function = 'DCOUNT'; $args = 3; break; |
|
| 5426 | - case 41: $function = 'DSUM'; $args = 3; break; |
|
| 5427 | - case 42: $function = 'DAVERAGE'; $args = 3; break; |
|
| 5428 | - case 43: $function = 'DMIN'; $args = 3; break; |
|
| 5429 | - case 44: $function = 'DMAX'; $args = 3; break; |
|
| 5430 | - case 45: $function = 'DSTDEV'; $args = 3; break; |
|
| 5431 | - case 48: $function = 'TEXT'; $args = 2; break; |
|
| 5432 | - case 61: $function = 'MIRR'; $args = 3; break; |
|
| 5433 | - case 63: $function = 'RAND'; $args = 0; break; |
|
| 5434 | - case 65: $function = 'DATE'; $args = 3; break; |
|
| 5435 | - case 66: $function = 'TIME'; $args = 3; break; |
|
| 5436 | - case 67: $function = 'DAY'; $args = 1; break; |
|
| 5437 | - case 68: $function = 'MONTH'; $args = 1; break; |
|
| 5438 | - case 69: $function = 'YEAR'; $args = 1; break; |
|
| 5439 | - case 71: $function = 'HOUR'; $args = 1; break; |
|
| 5440 | - case 72: $function = 'MINUTE'; $args = 1; break; |
|
| 5441 | - case 73: $function = 'SECOND'; $args = 1; break; |
|
| 5442 | - case 74: $function = 'NOW'; $args = 0; break; |
|
| 5443 | - case 75: $function = 'AREAS'; $args = 1; break; |
|
| 5444 | - case 76: $function = 'ROWS'; $args = 1; break; |
|
| 5445 | - case 77: $function = 'COLUMNS'; $args = 1; break; |
|
| 5446 | - case 83: $function = 'TRANSPOSE'; $args = 1; break; |
|
| 5447 | - case 86: $function = 'TYPE'; $args = 1; break; |
|
| 5448 | - case 97: $function = 'ATAN2'; $args = 2; break; |
|
| 5449 | - case 98: $function = 'ASIN'; $args = 1; break; |
|
| 5450 | - case 99: $function = 'ACOS'; $args = 1; break; |
|
| 5451 | - case 105: $function = 'ISREF'; $args = 1; break; |
|
| 5452 | - case 111: $function = 'CHAR'; $args = 1; break; |
|
| 5453 | - case 112: $function = 'LOWER'; $args = 1; break; |
|
| 5454 | - case 113: $function = 'UPPER'; $args = 1; break; |
|
| 5455 | - case 114: $function = 'PROPER'; $args = 1; break; |
|
| 5456 | - case 117: $function = 'EXACT'; $args = 2; break; |
|
| 5457 | - case 118: $function = 'TRIM'; $args = 1; break; |
|
| 5458 | - case 119: $function = 'REPLACE'; $args = 4; break; |
|
| 5459 | - case 121: $function = 'CODE'; $args = 1; break; |
|
| 5460 | - case 126: $function = 'ISERR'; $args = 1; break; |
|
| 5461 | - case 127: $function = 'ISTEXT'; $args = 1; break; |
|
| 5462 | - case 128: $function = 'ISNUMBER'; $args = 1; break; |
|
| 5463 | - case 129: $function = 'ISBLANK'; $args = 1; break; |
|
| 5464 | - case 130: $function = 'T'; $args = 1; break; |
|
| 5465 | - case 131: $function = 'N'; $args = 1; break; |
|
| 5466 | - case 140: $function = 'DATEVALUE'; $args = 1; break; |
|
| 5467 | - case 141: $function = 'TIMEVALUE'; $args = 1; break; |
|
| 5468 | - case 142: $function = 'SLN'; $args = 3; break; |
|
| 5469 | - case 143: $function = 'SYD'; $args = 4; break; |
|
| 5470 | - case 162: $function = 'CLEAN'; $args = 1; break; |
|
| 5471 | - case 163: $function = 'MDETERM'; $args = 1; break; |
|
| 5472 | - case 164: $function = 'MINVERSE'; $args = 1; break; |
|
| 5473 | - case 165: $function = 'MMULT'; $args = 2; break; |
|
| 5474 | - case 184: $function = 'FACT'; $args = 1; break; |
|
| 5475 | - case 189: $function = 'DPRODUCT'; $args = 3; break; |
|
| 5476 | - case 190: $function = 'ISNONTEXT'; $args = 1; break; |
|
| 5477 | - case 195: $function = 'DSTDEVP'; $args = 3; break; |
|
| 5478 | - case 196: $function = 'DVARP'; $args = 3; break; |
|
| 5479 | - case 198: $function = 'ISLOGICAL'; $args = 1; break; |
|
| 5480 | - case 199: $function = 'DCOUNTA'; $args = 3; break; |
|
| 5481 | - case 207: $function = 'REPLACEB'; $args = 4; break; |
|
| 5482 | - case 210: $function = 'MIDB'; $args = 3; break; |
|
| 5483 | - case 211: $function = 'LENB'; $args = 1; break; |
|
| 5484 | - case 212: $function = 'ROUNDUP'; $args = 2; break; |
|
| 5485 | - case 213: $function = 'ROUNDDOWN'; $args = 2; break; |
|
| 5486 | - case 214: $function = 'ASC'; $args = 1; break; |
|
| 5487 | - case 215: $function = 'DBCS'; $args = 1; break; |
|
| 5488 | - case 221: $function = 'TODAY'; $args = 0; break; |
|
| 5489 | - case 229: $function = 'SINH'; $args = 1; break; |
|
| 5490 | - case 230: $function = 'COSH'; $args = 1; break; |
|
| 5491 | - case 231: $function = 'TANH'; $args = 1; break; |
|
| 5492 | - case 232: $function = 'ASINH'; $args = 1; break; |
|
| 5493 | - case 233: $function = 'ACOSH'; $args = 1; break; |
|
| 5494 | - case 234: $function = 'ATANH'; $args = 1; break; |
|
| 5495 | - case 235: $function = 'DGET'; $args = 3; break; |
|
| 5496 | - case 244: $function = 'INFO'; $args = 1; break; |
|
| 5497 | - case 252: $function = 'FREQUENCY'; $args = 2; break; |
|
| 5498 | - case 261: $function = 'ERROR.TYPE'; $args = 1; break; |
|
| 5499 | - case 271: $function = 'GAMMALN'; $args = 1; break; |
|
| 5500 | - case 273: $function = 'BINOMDIST'; $args = 4; break; |
|
| 5501 | - case 274: $function = 'CHIDIST'; $args = 2; break; |
|
| 5502 | - case 275: $function = 'CHIINV'; $args = 2; break; |
|
| 5503 | - case 276: $function = 'COMBIN'; $args = 2; break; |
|
| 5504 | - case 277: $function = 'CONFIDENCE'; $args = 3; break; |
|
| 5505 | - case 278: $function = 'CRITBINOM'; $args = 3; break; |
|
| 5506 | - case 279: $function = 'EVEN'; $args = 1; break; |
|
| 5507 | - case 280: $function = 'EXPONDIST'; $args = 3; break; |
|
| 5508 | - case 281: $function = 'FDIST'; $args = 3; break; |
|
| 5509 | - case 282: $function = 'FINV'; $args = 3; break; |
|
| 5510 | - case 283: $function = 'FISHER'; $args = 1; break; |
|
| 5511 | - case 284: $function = 'FISHERINV'; $args = 1; break; |
|
| 5512 | - case 285: $function = 'FLOOR'; $args = 2; break; |
|
| 5513 | - case 286: $function = 'GAMMADIST'; $args = 4; break; |
|
| 5514 | - case 287: $function = 'GAMMAINV'; $args = 3; break; |
|
| 5515 | - case 288: $function = 'CEILING'; $args = 2; break; |
|
| 5516 | - case 289: $function = 'HYPGEOMDIST'; $args = 4; break; |
|
| 5517 | - case 290: $function = 'LOGNORMDIST'; $args = 3; break; |
|
| 5518 | - case 291: $function = 'LOGINV'; $args = 3; break; |
|
| 5519 | - case 292: $function = 'NEGBINOMDIST'; $args = 3; break; |
|
| 5520 | - case 293: $function = 'NORMDIST'; $args = 4; break; |
|
| 5521 | - case 294: $function = 'NORMSDIST'; $args = 1; break; |
|
| 5522 | - case 295: $function = 'NORMINV'; $args = 3; break; |
|
| 5523 | - case 296: $function = 'NORMSINV'; $args = 1; break; |
|
| 5524 | - case 297: $function = 'STANDARDIZE'; $args = 3; break; |
|
| 5525 | - case 298: $function = 'ODD'; $args = 1; break; |
|
| 5526 | - case 299: $function = 'PERMUT'; $args = 2; break; |
|
| 5527 | - case 300: $function = 'POISSON'; $args = 3; break; |
|
| 5528 | - case 301: $function = 'TDIST'; $args = 3; break; |
|
| 5529 | - case 302: $function = 'WEIBULL'; $args = 4; break; |
|
| 5530 | - case 303: $function = 'SUMXMY2'; $args = 2; break; |
|
| 5531 | - case 304: $function = 'SUMX2MY2'; $args = 2; break; |
|
| 5532 | - case 305: $function = 'SUMX2PY2'; $args = 2; break; |
|
| 5533 | - case 306: $function = 'CHITEST'; $args = 2; break; |
|
| 5534 | - case 307: $function = 'CORREL'; $args = 2; break; |
|
| 5535 | - case 308: $function = 'COVAR'; $args = 2; break; |
|
| 5536 | - case 309: $function = 'FORECAST'; $args = 3; break; |
|
| 5537 | - case 310: $function = 'FTEST'; $args = 2; break; |
|
| 5538 | - case 311: $function = 'INTERCEPT'; $args = 2; break; |
|
| 5539 | - case 312: $function = 'PEARSON'; $args = 2; break; |
|
| 5540 | - case 313: $function = 'RSQ'; $args = 2; break; |
|
| 5541 | - case 314: $function = 'STEYX'; $args = 2; break; |
|
| 5542 | - case 315: $function = 'SLOPE'; $args = 2; break; |
|
| 5543 | - case 316: $function = 'TTEST'; $args = 4; break; |
|
| 5544 | - case 325: $function = 'LARGE'; $args = 2; break; |
|
| 5545 | - case 326: $function = 'SMALL'; $args = 2; break; |
|
| 5546 | - case 327: $function = 'QUARTILE'; $args = 2; break; |
|
| 5547 | - case 328: $function = 'PERCENTILE'; $args = 2; break; |
|
| 5548 | - case 331: $function = 'TRIMMEAN'; $args = 2; break; |
|
| 5549 | - case 332: $function = 'TINV'; $args = 2; break; |
|
| 5550 | - case 337: $function = 'POWER'; $args = 2; break; |
|
| 5551 | - case 342: $function = 'RADIANS'; $args = 1; break; |
|
| 5552 | - case 343: $function = 'DEGREES'; $args = 1; break; |
|
| 5553 | - case 346: $function = 'COUNTIF'; $args = 2; break; |
|
| 5554 | - case 347: $function = 'COUNTBLANK'; $args = 1; break; |
|
| 5555 | - case 350: $function = 'ISPMT'; $args = 4; break; |
|
| 5556 | - case 351: $function = 'DATEDIF'; $args = 3; break; |
|
| 5557 | - case 352: $function = 'DATESTRING'; $args = 1; break; |
|
| 5558 | - case 353: $function = 'NUMBERSTRING'; $args = 2; break; |
|
| 5559 | - case 360: $function = 'PHONETIC'; $args = 1; break; |
|
| 5560 | - case 368: $function = 'BAHTTEXT'; $args = 1; break; |
|
| 5561 | - default: |
|
| 5562 | - throw new Exception('Unrecognized function in formula'); |
|
| 5361 | + case 0x1C: // error code |
|
| 5362 | + // offset: 1; size: 1; error code |
|
| 5363 | + $name = 'tErr'; |
|
| 5364 | + $size = 2; |
|
| 5365 | + $data = self::_mapErrorCode(ord($formulaData[1])); |
|
| 5563 | 5366 | break; |
| 5564 | - } |
|
| 5565 | - $data = array('function' => $function, 'args' => $args); |
|
| 5566 | - break; |
|
| 5567 | - case 0x22: // function with variable number of arguments |
|
| 5568 | - case 0x42: |
|
| 5569 | - case 0x62: |
|
| 5570 | - $name = 'tFuncV'; |
|
| 5571 | - $size = 4; |
|
| 5572 | - // offset: 1; size: 1; number of arguments |
|
| 5573 | - $args = ord($formulaData[1]); |
|
| 5574 | - // offset: 2: size: 2; index to built-in sheet function |
|
| 5575 | - $index = self::_GetInt2d($formulaData, 2); |
|
| 5576 | - switch ($index) { |
|
| 5577 | - case 0: $function = 'COUNT'; break; |
|
| 5578 | - case 1: $function = 'IF'; break; |
|
| 5579 | - case 4: $function = 'SUM'; break; |
|
| 5580 | - case 5: $function = 'AVERAGE'; break; |
|
| 5581 | - case 6: $function = 'MIN'; break; |
|
| 5582 | - case 7: $function = 'MAX'; break; |
|
| 5583 | - case 8: $function = 'ROW'; break; |
|
| 5584 | - case 9: $function = 'COLUMN'; break; |
|
| 5585 | - case 11: $function = 'NPV'; break; |
|
| 5586 | - case 12: $function = 'STDEV'; break; |
|
| 5587 | - case 13: $function = 'DOLLAR'; break; |
|
| 5588 | - case 14: $function = 'FIXED'; break; |
|
| 5589 | - case 28: $function = 'LOOKUP'; break; |
|
| 5590 | - case 29: $function = 'INDEX'; break; |
|
| 5591 | - case 36: $function = 'AND'; break; |
|
| 5592 | - case 37: $function = 'OR'; break; |
|
| 5593 | - case 46: $function = 'VAR'; break; |
|
| 5594 | - case 49: $function = 'LINEST'; break; |
|
| 5595 | - case 50: $function = 'TREND'; break; |
|
| 5596 | - case 51: $function = 'LOGEST'; break; |
|
| 5597 | - case 52: $function = 'GROWTH'; break; |
|
| 5598 | - case 56: $function = 'PV'; break; |
|
| 5599 | - case 57: $function = 'FV'; break; |
|
| 5600 | - case 58: $function = 'NPER'; break; |
|
| 5601 | - case 59: $function = 'PMT'; break; |
|
| 5602 | - case 60: $function = 'RATE'; break; |
|
| 5603 | - case 62: $function = 'IRR'; break; |
|
| 5604 | - case 64: $function = 'MATCH'; break; |
|
| 5605 | - case 70: $function = 'WEEKDAY'; break; |
|
| 5606 | - case 78: $function = 'OFFSET'; break; |
|
| 5607 | - case 82: $function = 'SEARCH'; break; |
|
| 5608 | - case 100: $function = 'CHOOSE'; break; |
|
| 5609 | - case 101: $function = 'HLOOKUP'; break; |
|
| 5610 | - case 102: $function = 'VLOOKUP'; break; |
|
| 5611 | - case 109: $function = 'LOG'; break; |
|
| 5612 | - case 115: $function = 'LEFT'; break; |
|
| 5613 | - case 116: $function = 'RIGHT'; break; |
|
| 5614 | - case 120: $function = 'SUBSTITUTE'; break; |
|
| 5615 | - case 124: $function = 'FIND'; break; |
|
| 5616 | - case 125: $function = 'CELL'; break; |
|
| 5617 | - case 144: $function = 'DDB'; break; |
|
| 5618 | - case 148: $function = 'INDIRECT'; break; |
|
| 5619 | - case 167: $function = 'IPMT'; break; |
|
| 5620 | - case 168: $function = 'PPMT'; break; |
|
| 5621 | - case 169: $function = 'COUNTA'; break; |
|
| 5622 | - case 183: $function = 'PRODUCT'; break; |
|
| 5623 | - case 193: $function = 'STDEVP'; break; |
|
| 5624 | - case 194: $function = 'VARP'; break; |
|
| 5625 | - case 197: $function = 'TRUNC'; break; |
|
| 5626 | - case 204: $function = 'USDOLLAR'; break; |
|
| 5627 | - case 205: $function = 'FINDB'; break; |
|
| 5628 | - case 206: $function = 'SEARCHB'; break; |
|
| 5629 | - case 208: $function = 'LEFTB'; break; |
|
| 5630 | - case 209: $function = 'RIGHTB'; break; |
|
| 5631 | - case 216: $function = 'RANK'; break; |
|
| 5632 | - case 219: $function = 'ADDRESS'; break; |
|
| 5633 | - case 220: $function = 'DAYS360'; break; |
|
| 5634 | - case 222: $function = 'VDB'; break; |
|
| 5635 | - case 227: $function = 'MEDIAN'; break; |
|
| 5636 | - case 228: $function = 'SUMPRODUCT'; break; |
|
| 5637 | - case 247: $function = 'DB'; break; |
|
| 5638 | - case 255: $function = ''; break; |
|
| 5639 | - case 269: $function = 'AVEDEV'; break; |
|
| 5640 | - case 270: $function = 'BETADIST'; break; |
|
| 5641 | - case 272: $function = 'BETAINV'; break; |
|
| 5642 | - case 317: $function = 'PROB'; break; |
|
| 5643 | - case 318: $function = 'DEVSQ'; break; |
|
| 5644 | - case 319: $function = 'GEOMEAN'; break; |
|
| 5645 | - case 320: $function = 'HARMEAN'; break; |
|
| 5646 | - case 321: $function = 'SUMSQ'; break; |
|
| 5647 | - case 322: $function = 'KURT'; break; |
|
| 5648 | - case 323: $function = 'SKEW'; break; |
|
| 5649 | - case 324: $function = 'ZTEST'; break; |
|
| 5650 | - case 329: $function = 'PERCENTRANK'; break; |
|
| 5651 | - case 330: $function = 'MODE'; break; |
|
| 5652 | - case 336: $function = 'CONCATENATE'; break; |
|
| 5653 | - case 344: $function = 'SUBTOTAL'; break; |
|
| 5654 | - case 345: $function = 'SUMIF'; break; |
|
| 5655 | - case 354: $function = 'ROMAN'; break; |
|
| 5656 | - case 358: $function = 'GETPIVOTDATA'; break; |
|
| 5657 | - case 359: $function = 'HYPERLINK'; break; |
|
| 5658 | - case 361: $function = 'AVERAGEA'; break; |
|
| 5659 | - case 362: $function = 'MAXA'; break; |
|
| 5660 | - case 363: $function = 'MINA'; break; |
|
| 5661 | - case 364: $function = 'STDEVPA'; break; |
|
| 5662 | - case 365: $function = 'VARPA'; break; |
|
| 5663 | - case 366: $function = 'STDEVA'; break; |
|
| 5664 | - case 367: $function = 'VARA'; break; |
|
| 5665 | - default: |
|
| 5666 | - throw new Exception('Unrecognized function in formula'); |
|
| 5367 | + case 0x1D: // boolean |
|
| 5368 | + // offset: 1; size: 1; 0 = false, 1 = true; |
|
| 5369 | + $name = 'tBool'; |
|
| 5370 | + $size = 2; |
|
| 5371 | + $data = ord($formulaData[1]) ? 'TRUE' : 'FALSE'; |
|
| 5667 | 5372 | break; |
| 5668 | - } |
|
| 5373 | + case 0x1E: // integer |
|
| 5374 | + // offset: 1; size: 2; unsigned 16-bit integer |
|
| 5375 | + $name = 'tInt'; |
|
| 5376 | + $size = 3; |
|
| 5377 | + $data = self::_GetInt2d($formulaData, 1); |
|
| 5378 | + break; |
|
| 5379 | + case 0x1F: // number |
|
| 5380 | + // offset: 1; size: 8; |
|
| 5381 | + $name = 'tNum'; |
|
| 5382 | + $size = 9; |
|
| 5383 | + $data = self::_extractNumber(substr($formulaData, 1)); |
|
| 5384 | + $data = str_replace(',', '.', (string)$data); // in case non-English locale |
|
| 5385 | + break; |
|
| 5386 | + case 0x20: // array constant |
|
| 5387 | + case 0x40: |
|
| 5388 | + case 0x60: |
|
| 5389 | + // offset: 1; size: 7; not used |
|
| 5390 | + $name = 'tArray'; |
|
| 5391 | + $size = 8; |
|
| 5392 | + $data = null; |
|
| 5393 | + break; |
|
| 5394 | + case 0x21: // function with fixed number of arguments |
|
| 5395 | + case 0x41: |
|
| 5396 | + case 0x61: |
|
| 5397 | + $name = 'tFunc'; |
|
| 5398 | + $size = 3; |
|
| 5399 | + // offset: 1; size: 2; index to built-in sheet function |
|
| 5400 | + switch (self::_GetInt2d($formulaData, 1)) { |
|
| 5401 | + case 2: $function = 'ISNA'; $args = 1; break; |
|
| 5402 | + case 3: $function = 'ISERROR'; $args = 1; break; |
|
| 5403 | + case 10: $function = 'NA'; $args = 0; break; |
|
| 5404 | + case 15: $function = 'SIN'; $args = 1; break; |
|
| 5405 | + case 16: $function = 'COS'; $args = 1; break; |
|
| 5406 | + case 17: $function = 'TAN'; $args = 1; break; |
|
| 5407 | + case 18: $function = 'ATAN'; $args = 1; break; |
|
| 5408 | + case 19: $function = 'PI'; $args = 0; break; |
|
| 5409 | + case 20: $function = 'SQRT'; $args = 1; break; |
|
| 5410 | + case 21: $function = 'EXP'; $args = 1; break; |
|
| 5411 | + case 22: $function = 'LN'; $args = 1; break; |
|
| 5412 | + case 23: $function = 'LOG10'; $args = 1; break; |
|
| 5413 | + case 24: $function = 'ABS'; $args = 1; break; |
|
| 5414 | + case 25: $function = 'INT'; $args = 1; break; |
|
| 5415 | + case 26: $function = 'SIGN'; $args = 1; break; |
|
| 5416 | + case 27: $function = 'ROUND'; $args = 2; break; |
|
| 5417 | + case 30: $function = 'REPT'; $args = 2; break; |
|
| 5418 | + case 31: $function = 'MID'; $args = 3; break; |
|
| 5419 | + case 32: $function = 'LEN'; $args = 1; break; |
|
| 5420 | + case 33: $function = 'VALUE'; $args = 1; break; |
|
| 5421 | + case 34: $function = 'TRUE'; $args = 0; break; |
|
| 5422 | + case 35: $function = 'FALSE'; $args = 0; break; |
|
| 5423 | + case 38: $function = 'NOT'; $args = 1; break; |
|
| 5424 | + case 39: $function = 'MOD'; $args = 2; break; |
|
| 5425 | + case 40: $function = 'DCOUNT'; $args = 3; break; |
|
| 5426 | + case 41: $function = 'DSUM'; $args = 3; break; |
|
| 5427 | + case 42: $function = 'DAVERAGE'; $args = 3; break; |
|
| 5428 | + case 43: $function = 'DMIN'; $args = 3; break; |
|
| 5429 | + case 44: $function = 'DMAX'; $args = 3; break; |
|
| 5430 | + case 45: $function = 'DSTDEV'; $args = 3; break; |
|
| 5431 | + case 48: $function = 'TEXT'; $args = 2; break; |
|
| 5432 | + case 61: $function = 'MIRR'; $args = 3; break; |
|
| 5433 | + case 63: $function = 'RAND'; $args = 0; break; |
|
| 5434 | + case 65: $function = 'DATE'; $args = 3; break; |
|
| 5435 | + case 66: $function = 'TIME'; $args = 3; break; |
|
| 5436 | + case 67: $function = 'DAY'; $args = 1; break; |
|
| 5437 | + case 68: $function = 'MONTH'; $args = 1; break; |
|
| 5438 | + case 69: $function = 'YEAR'; $args = 1; break; |
|
| 5439 | + case 71: $function = 'HOUR'; $args = 1; break; |
|
| 5440 | + case 72: $function = 'MINUTE'; $args = 1; break; |
|
| 5441 | + case 73: $function = 'SECOND'; $args = 1; break; |
|
| 5442 | + case 74: $function = 'NOW'; $args = 0; break; |
|
| 5443 | + case 75: $function = 'AREAS'; $args = 1; break; |
|
| 5444 | + case 76: $function = 'ROWS'; $args = 1; break; |
|
| 5445 | + case 77: $function = 'COLUMNS'; $args = 1; break; |
|
| 5446 | + case 83: $function = 'TRANSPOSE'; $args = 1; break; |
|
| 5447 | + case 86: $function = 'TYPE'; $args = 1; break; |
|
| 5448 | + case 97: $function = 'ATAN2'; $args = 2; break; |
|
| 5449 | + case 98: $function = 'ASIN'; $args = 1; break; |
|
| 5450 | + case 99: $function = 'ACOS'; $args = 1; break; |
|
| 5451 | + case 105: $function = 'ISREF'; $args = 1; break; |
|
| 5452 | + case 111: $function = 'CHAR'; $args = 1; break; |
|
| 5453 | + case 112: $function = 'LOWER'; $args = 1; break; |
|
| 5454 | + case 113: $function = 'UPPER'; $args = 1; break; |
|
| 5455 | + case 114: $function = 'PROPER'; $args = 1; break; |
|
| 5456 | + case 117: $function = 'EXACT'; $args = 2; break; |
|
| 5457 | + case 118: $function = 'TRIM'; $args = 1; break; |
|
| 5458 | + case 119: $function = 'REPLACE'; $args = 4; break; |
|
| 5459 | + case 121: $function = 'CODE'; $args = 1; break; |
|
| 5460 | + case 126: $function = 'ISERR'; $args = 1; break; |
|
| 5461 | + case 127: $function = 'ISTEXT'; $args = 1; break; |
|
| 5462 | + case 128: $function = 'ISNUMBER'; $args = 1; break; |
|
| 5463 | + case 129: $function = 'ISBLANK'; $args = 1; break; |
|
| 5464 | + case 130: $function = 'T'; $args = 1; break; |
|
| 5465 | + case 131: $function = 'N'; $args = 1; break; |
|
| 5466 | + case 140: $function = 'DATEVALUE'; $args = 1; break; |
|
| 5467 | + case 141: $function = 'TIMEVALUE'; $args = 1; break; |
|
| 5468 | + case 142: $function = 'SLN'; $args = 3; break; |
|
| 5469 | + case 143: $function = 'SYD'; $args = 4; break; |
|
| 5470 | + case 162: $function = 'CLEAN'; $args = 1; break; |
|
| 5471 | + case 163: $function = 'MDETERM'; $args = 1; break; |
|
| 5472 | + case 164: $function = 'MINVERSE'; $args = 1; break; |
|
| 5473 | + case 165: $function = 'MMULT'; $args = 2; break; |
|
| 5474 | + case 184: $function = 'FACT'; $args = 1; break; |
|
| 5475 | + case 189: $function = 'DPRODUCT'; $args = 3; break; |
|
| 5476 | + case 190: $function = 'ISNONTEXT'; $args = 1; break; |
|
| 5477 | + case 195: $function = 'DSTDEVP'; $args = 3; break; |
|
| 5478 | + case 196: $function = 'DVARP'; $args = 3; break; |
|
| 5479 | + case 198: $function = 'ISLOGICAL'; $args = 1; break; |
|
| 5480 | + case 199: $function = 'DCOUNTA'; $args = 3; break; |
|
| 5481 | + case 207: $function = 'REPLACEB'; $args = 4; break; |
|
| 5482 | + case 210: $function = 'MIDB'; $args = 3; break; |
|
| 5483 | + case 211: $function = 'LENB'; $args = 1; break; |
|
| 5484 | + case 212: $function = 'ROUNDUP'; $args = 2; break; |
|
| 5485 | + case 213: $function = 'ROUNDDOWN'; $args = 2; break; |
|
| 5486 | + case 214: $function = 'ASC'; $args = 1; break; |
|
| 5487 | + case 215: $function = 'DBCS'; $args = 1; break; |
|
| 5488 | + case 221: $function = 'TODAY'; $args = 0; break; |
|
| 5489 | + case 229: $function = 'SINH'; $args = 1; break; |
|
| 5490 | + case 230: $function = 'COSH'; $args = 1; break; |
|
| 5491 | + case 231: $function = 'TANH'; $args = 1; break; |
|
| 5492 | + case 232: $function = 'ASINH'; $args = 1; break; |
|
| 5493 | + case 233: $function = 'ACOSH'; $args = 1; break; |
|
| 5494 | + case 234: $function = 'ATANH'; $args = 1; break; |
|
| 5495 | + case 235: $function = 'DGET'; $args = 3; break; |
|
| 5496 | + case 244: $function = 'INFO'; $args = 1; break; |
|
| 5497 | + case 252: $function = 'FREQUENCY'; $args = 2; break; |
|
| 5498 | + case 261: $function = 'ERROR.TYPE'; $args = 1; break; |
|
| 5499 | + case 271: $function = 'GAMMALN'; $args = 1; break; |
|
| 5500 | + case 273: $function = 'BINOMDIST'; $args = 4; break; |
|
| 5501 | + case 274: $function = 'CHIDIST'; $args = 2; break; |
|
| 5502 | + case 275: $function = 'CHIINV'; $args = 2; break; |
|
| 5503 | + case 276: $function = 'COMBIN'; $args = 2; break; |
|
| 5504 | + case 277: $function = 'CONFIDENCE'; $args = 3; break; |
|
| 5505 | + case 278: $function = 'CRITBINOM'; $args = 3; break; |
|
| 5506 | + case 279: $function = 'EVEN'; $args = 1; break; |
|
| 5507 | + case 280: $function = 'EXPONDIST'; $args = 3; break; |
|
| 5508 | + case 281: $function = 'FDIST'; $args = 3; break; |
|
| 5509 | + case 282: $function = 'FINV'; $args = 3; break; |
|
| 5510 | + case 283: $function = 'FISHER'; $args = 1; break; |
|
| 5511 | + case 284: $function = 'FISHERINV'; $args = 1; break; |
|
| 5512 | + case 285: $function = 'FLOOR'; $args = 2; break; |
|
| 5513 | + case 286: $function = 'GAMMADIST'; $args = 4; break; |
|
| 5514 | + case 287: $function = 'GAMMAINV'; $args = 3; break; |
|
| 5515 | + case 288: $function = 'CEILING'; $args = 2; break; |
|
| 5516 | + case 289: $function = 'HYPGEOMDIST'; $args = 4; break; |
|
| 5517 | + case 290: $function = 'LOGNORMDIST'; $args = 3; break; |
|
| 5518 | + case 291: $function = 'LOGINV'; $args = 3; break; |
|
| 5519 | + case 292: $function = 'NEGBINOMDIST'; $args = 3; break; |
|
| 5520 | + case 293: $function = 'NORMDIST'; $args = 4; break; |
|
| 5521 | + case 294: $function = 'NORMSDIST'; $args = 1; break; |
|
| 5522 | + case 295: $function = 'NORMINV'; $args = 3; break; |
|
| 5523 | + case 296: $function = 'NORMSINV'; $args = 1; break; |
|
| 5524 | + case 297: $function = 'STANDARDIZE'; $args = 3; break; |
|
| 5525 | + case 298: $function = 'ODD'; $args = 1; break; |
|
| 5526 | + case 299: $function = 'PERMUT'; $args = 2; break; |
|
| 5527 | + case 300: $function = 'POISSON'; $args = 3; break; |
|
| 5528 | + case 301: $function = 'TDIST'; $args = 3; break; |
|
| 5529 | + case 302: $function = 'WEIBULL'; $args = 4; break; |
|
| 5530 | + case 303: $function = 'SUMXMY2'; $args = 2; break; |
|
| 5531 | + case 304: $function = 'SUMX2MY2'; $args = 2; break; |
|
| 5532 | + case 305: $function = 'SUMX2PY2'; $args = 2; break; |
|
| 5533 | + case 306: $function = 'CHITEST'; $args = 2; break; |
|
| 5534 | + case 307: $function = 'CORREL'; $args = 2; break; |
|
| 5535 | + case 308: $function = 'COVAR'; $args = 2; break; |
|
| 5536 | + case 309: $function = 'FORECAST'; $args = 3; break; |
|
| 5537 | + case 310: $function = 'FTEST'; $args = 2; break; |
|
| 5538 | + case 311: $function = 'INTERCEPT'; $args = 2; break; |
|
| 5539 | + case 312: $function = 'PEARSON'; $args = 2; break; |
|
| 5540 | + case 313: $function = 'RSQ'; $args = 2; break; |
|
| 5541 | + case 314: $function = 'STEYX'; $args = 2; break; |
|
| 5542 | + case 315: $function = 'SLOPE'; $args = 2; break; |
|
| 5543 | + case 316: $function = 'TTEST'; $args = 4; break; |
|
| 5544 | + case 325: $function = 'LARGE'; $args = 2; break; |
|
| 5545 | + case 326: $function = 'SMALL'; $args = 2; break; |
|
| 5546 | + case 327: $function = 'QUARTILE'; $args = 2; break; |
|
| 5547 | + case 328: $function = 'PERCENTILE'; $args = 2; break; |
|
| 5548 | + case 331: $function = 'TRIMMEAN'; $args = 2; break; |
|
| 5549 | + case 332: $function = 'TINV'; $args = 2; break; |
|
| 5550 | + case 337: $function = 'POWER'; $args = 2; break; |
|
| 5551 | + case 342: $function = 'RADIANS'; $args = 1; break; |
|
| 5552 | + case 343: $function = 'DEGREES'; $args = 1; break; |
|
| 5553 | + case 346: $function = 'COUNTIF'; $args = 2; break; |
|
| 5554 | + case 347: $function = 'COUNTBLANK'; $args = 1; break; |
|
| 5555 | + case 350: $function = 'ISPMT'; $args = 4; break; |
|
| 5556 | + case 351: $function = 'DATEDIF'; $args = 3; break; |
|
| 5557 | + case 352: $function = 'DATESTRING'; $args = 1; break; |
|
| 5558 | + case 353: $function = 'NUMBERSTRING'; $args = 2; break; |
|
| 5559 | + case 360: $function = 'PHONETIC'; $args = 1; break; |
|
| 5560 | + case 368: $function = 'BAHTTEXT'; $args = 1; break; |
|
| 5561 | + default: |
|
| 5562 | + throw new Exception('Unrecognized function in formula'); |
|
| 5563 | + break; |
|
| 5564 | + } |
|
| 5669 | 5565 | $data = array('function' => $function, 'args' => $args); |
| 5670 | 5566 | break; |
| 5671 | - case 0x23: // index to defined name |
|
| 5672 | - case 0x43: |
|
| 5673 | - case 0x63: |
|
| 5674 | - $name = 'tName'; |
|
| 5675 | - $size = 5; |
|
| 5676 | - // offset: 1; size: 2; one-based index to definedname record |
|
| 5677 | - $definedNameIndex = self::_GetInt2d($formulaData, 1) - 1; |
|
| 5678 | - // offset: 2; size: 2; not used |
|
| 5679 | - $data = $this->_definedname[$definedNameIndex]['name']; |
|
| 5680 | - break; |
|
| 5681 | - case 0x24: // single cell reference e.g. A5 |
|
| 5682 | - case 0x44: |
|
| 5683 | - case 0x64: |
|
| 5684 | - $name = 'tRef'; |
|
| 5685 | - $size = 5; |
|
| 5686 | - $data = $this->_readBIFF8CellAddress(substr($formulaData, 1, 4)); |
|
| 5687 | - break; |
|
| 5688 | - case 0x25: // cell range reference to cells in the same sheet (2d) |
|
| 5689 | - case 0x45: |
|
| 5690 | - case 0x65: |
|
| 5691 | - $name = 'tArea'; |
|
| 5692 | - $size = 9; |
|
| 5693 | - $data = $this->_readBIFF8CellRangeAddress(substr($formulaData, 1, 8)); |
|
| 5694 | - break; |
|
| 5695 | - case 0x26: // Constant reference sub-expression |
|
| 5696 | - case 0x46: |
|
| 5697 | - case 0x66: |
|
| 5698 | - $name = 'tMemArea'; |
|
| 5699 | - // offset: 1; size: 4; not used |
|
| 5700 | - // offset: 5; size: 2; size of the following subexpression |
|
| 5701 | - $subSize = self::_GetInt2d($formulaData, 5); |
|
| 5702 | - $size = 7 + $subSize; |
|
| 5703 | - $data = $this->_getFormulaFromData(substr($formulaData, 7, $subSize)); |
|
| 5704 | - break; |
|
| 5705 | - case 0x27: // Deleted constant reference sub-expression |
|
| 5706 | - case 0x47: |
|
| 5707 | - case 0x67: |
|
| 5708 | - $name = 'tMemErr'; |
|
| 5709 | - // offset: 1; size: 4; not used |
|
| 5710 | - // offset: 5; size: 2; size of the following subexpression |
|
| 5711 | - $subSize = self::_GetInt2d($formulaData, 5); |
|
| 5712 | - $size = 7 + $subSize; |
|
| 5713 | - $data = $this->_getFormulaFromData(substr($formulaData, 7, $subSize)); |
|
| 5714 | - break; |
|
| 5715 | - case 0x29: // Variable reference sub-expression |
|
| 5716 | - case 0x49: |
|
| 5717 | - case 0x69: |
|
| 5718 | - $name = 'tMemFunc'; |
|
| 5719 | - // offset: 1; size: 2; size of the following sub-expression |
|
| 5720 | - $subSize = self::_GetInt2d($formulaData, 1); |
|
| 5721 | - $size = 3 + $subSize; |
|
| 5722 | - $data = $this->_getFormulaFromData(substr($formulaData, 3, $subSize)); |
|
| 5567 | + case 0x22: // function with variable number of arguments |
|
| 5568 | + case 0x42: |
|
| 5569 | + case 0x62: |
|
| 5570 | + $name = 'tFuncV'; |
|
| 5571 | + $size = 4; |
|
| 5572 | + // offset: 1; size: 1; number of arguments |
|
| 5573 | + $args = ord($formulaData[1]); |
|
| 5574 | + // offset: 2: size: 2; index to built-in sheet function |
|
| 5575 | + $index = self::_GetInt2d($formulaData, 2); |
|
| 5576 | + switch ($index) { |
|
| 5577 | + case 0: $function = 'COUNT'; break; |
|
| 5578 | + case 1: $function = 'IF'; break; |
|
| 5579 | + case 4: $function = 'SUM'; break; |
|
| 5580 | + case 5: $function = 'AVERAGE'; break; |
|
| 5581 | + case 6: $function = 'MIN'; break; |
|
| 5582 | + case 7: $function = 'MAX'; break; |
|
| 5583 | + case 8: $function = 'ROW'; break; |
|
| 5584 | + case 9: $function = 'COLUMN'; break; |
|
| 5585 | + case 11: $function = 'NPV'; break; |
|
| 5586 | + case 12: $function = 'STDEV'; break; |
|
| 5587 | + case 13: $function = 'DOLLAR'; break; |
|
| 5588 | + case 14: $function = 'FIXED'; break; |
|
| 5589 | + case 28: $function = 'LOOKUP'; break; |
|
| 5590 | + case 29: $function = 'INDEX'; break; |
|
| 5591 | + case 36: $function = 'AND'; break; |
|
| 5592 | + case 37: $function = 'OR'; break; |
|
| 5593 | + case 46: $function = 'VAR'; break; |
|
| 5594 | + case 49: $function = 'LINEST'; break; |
|
| 5595 | + case 50: $function = 'TREND'; break; |
|
| 5596 | + case 51: $function = 'LOGEST'; break; |
|
| 5597 | + case 52: $function = 'GROWTH'; break; |
|
| 5598 | + case 56: $function = 'PV'; break; |
|
| 5599 | + case 57: $function = 'FV'; break; |
|
| 5600 | + case 58: $function = 'NPER'; break; |
|
| 5601 | + case 59: $function = 'PMT'; break; |
|
| 5602 | + case 60: $function = 'RATE'; break; |
|
| 5603 | + case 62: $function = 'IRR'; break; |
|
| 5604 | + case 64: $function = 'MATCH'; break; |
|
| 5605 | + case 70: $function = 'WEEKDAY'; break; |
|
| 5606 | + case 78: $function = 'OFFSET'; break; |
|
| 5607 | + case 82: $function = 'SEARCH'; break; |
|
| 5608 | + case 100: $function = 'CHOOSE'; break; |
|
| 5609 | + case 101: $function = 'HLOOKUP'; break; |
|
| 5610 | + case 102: $function = 'VLOOKUP'; break; |
|
| 5611 | + case 109: $function = 'LOG'; break; |
|
| 5612 | + case 115: $function = 'LEFT'; break; |
|
| 5613 | + case 116: $function = 'RIGHT'; break; |
|
| 5614 | + case 120: $function = 'SUBSTITUTE'; break; |
|
| 5615 | + case 124: $function = 'FIND'; break; |
|
| 5616 | + case 125: $function = 'CELL'; break; |
|
| 5617 | + case 144: $function = 'DDB'; break; |
|
| 5618 | + case 148: $function = 'INDIRECT'; break; |
|
| 5619 | + case 167: $function = 'IPMT'; break; |
|
| 5620 | + case 168: $function = 'PPMT'; break; |
|
| 5621 | + case 169: $function = 'COUNTA'; break; |
|
| 5622 | + case 183: $function = 'PRODUCT'; break; |
|
| 5623 | + case 193: $function = 'STDEVP'; break; |
|
| 5624 | + case 194: $function = 'VARP'; break; |
|
| 5625 | + case 197: $function = 'TRUNC'; break; |
|
| 5626 | + case 204: $function = 'USDOLLAR'; break; |
|
| 5627 | + case 205: $function = 'FINDB'; break; |
|
| 5628 | + case 206: $function = 'SEARCHB'; break; |
|
| 5629 | + case 208: $function = 'LEFTB'; break; |
|
| 5630 | + case 209: $function = 'RIGHTB'; break; |
|
| 5631 | + case 216: $function = 'RANK'; break; |
|
| 5632 | + case 219: $function = 'ADDRESS'; break; |
|
| 5633 | + case 220: $function = 'DAYS360'; break; |
|
| 5634 | + case 222: $function = 'VDB'; break; |
|
| 5635 | + case 227: $function = 'MEDIAN'; break; |
|
| 5636 | + case 228: $function = 'SUMPRODUCT'; break; |
|
| 5637 | + case 247: $function = 'DB'; break; |
|
| 5638 | + case 255: $function = ''; break; |
|
| 5639 | + case 269: $function = 'AVEDEV'; break; |
|
| 5640 | + case 270: $function = 'BETADIST'; break; |
|
| 5641 | + case 272: $function = 'BETAINV'; break; |
|
| 5642 | + case 317: $function = 'PROB'; break; |
|
| 5643 | + case 318: $function = 'DEVSQ'; break; |
|
| 5644 | + case 319: $function = 'GEOMEAN'; break; |
|
| 5645 | + case 320: $function = 'HARMEAN'; break; |
|
| 5646 | + case 321: $function = 'SUMSQ'; break; |
|
| 5647 | + case 322: $function = 'KURT'; break; |
|
| 5648 | + case 323: $function = 'SKEW'; break; |
|
| 5649 | + case 324: $function = 'ZTEST'; break; |
|
| 5650 | + case 329: $function = 'PERCENTRANK'; break; |
|
| 5651 | + case 330: $function = 'MODE'; break; |
|
| 5652 | + case 336: $function = 'CONCATENATE'; break; |
|
| 5653 | + case 344: $function = 'SUBTOTAL'; break; |
|
| 5654 | + case 345: $function = 'SUMIF'; break; |
|
| 5655 | + case 354: $function = 'ROMAN'; break; |
|
| 5656 | + case 358: $function = 'GETPIVOTDATA'; break; |
|
| 5657 | + case 359: $function = 'HYPERLINK'; break; |
|
| 5658 | + case 361: $function = 'AVERAGEA'; break; |
|
| 5659 | + case 362: $function = 'MAXA'; break; |
|
| 5660 | + case 363: $function = 'MINA'; break; |
|
| 5661 | + case 364: $function = 'STDEVPA'; break; |
|
| 5662 | + case 365: $function = 'VARPA'; break; |
|
| 5663 | + case 366: $function = 'STDEVA'; break; |
|
| 5664 | + case 367: $function = 'VARA'; break; |
|
| 5665 | + default: |
|
| 5666 | + throw new Exception('Unrecognized function in formula'); |
|
| 5667 | + break; |
|
| 5668 | + } |
|
| 5669 | + $data = array('function' => $function, 'args' => $args); |
|
| 5723 | 5670 | break; |
| 5671 | + case 0x23: // index to defined name |
|
| 5672 | + case 0x43: |
|
| 5673 | + case 0x63: |
|
| 5674 | + $name = 'tName'; |
|
| 5675 | + $size = 5; |
|
| 5676 | + // offset: 1; size: 2; one-based index to definedname record |
|
| 5677 | + $definedNameIndex = self::_GetInt2d($formulaData, 1) - 1; |
|
| 5678 | + // offset: 2; size: 2; not used |
|
| 5679 | + $data = $this->_definedname[$definedNameIndex]['name']; |
|
| 5680 | + break; |
|
| 5681 | + case 0x24: // single cell reference e.g. A5 |
|
| 5682 | + case 0x44: |
|
| 5683 | + case 0x64: |
|
| 5684 | + $name = 'tRef'; |
|
| 5685 | + $size = 5; |
|
| 5686 | + $data = $this->_readBIFF8CellAddress(substr($formulaData, 1, 4)); |
|
| 5687 | + break; |
|
| 5688 | + case 0x25: // cell range reference to cells in the same sheet (2d) |
|
| 5689 | + case 0x45: |
|
| 5690 | + case 0x65: |
|
| 5691 | + $name = 'tArea'; |
|
| 5692 | + $size = 9; |
|
| 5693 | + $data = $this->_readBIFF8CellRangeAddress(substr($formulaData, 1, 8)); |
|
| 5694 | + break; |
|
| 5695 | + case 0x26: // Constant reference sub-expression |
|
| 5696 | + case 0x46: |
|
| 5697 | + case 0x66: |
|
| 5698 | + $name = 'tMemArea'; |
|
| 5699 | + // offset: 1; size: 4; not used |
|
| 5700 | + // offset: 5; size: 2; size of the following subexpression |
|
| 5701 | + $subSize = self::_GetInt2d($formulaData, 5); |
|
| 5702 | + $size = 7 + $subSize; |
|
| 5703 | + $data = $this->_getFormulaFromData(substr($formulaData, 7, $subSize)); |
|
| 5704 | + break; |
|
| 5705 | + case 0x27: // Deleted constant reference sub-expression |
|
| 5706 | + case 0x47: |
|
| 5707 | + case 0x67: |
|
| 5708 | + $name = 'tMemErr'; |
|
| 5709 | + // offset: 1; size: 4; not used |
|
| 5710 | + // offset: 5; size: 2; size of the following subexpression |
|
| 5711 | + $subSize = self::_GetInt2d($formulaData, 5); |
|
| 5712 | + $size = 7 + $subSize; |
|
| 5713 | + $data = $this->_getFormulaFromData(substr($formulaData, 7, $subSize)); |
|
| 5714 | + break; |
|
| 5715 | + case 0x29: // Variable reference sub-expression |
|
| 5716 | + case 0x49: |
|
| 5717 | + case 0x69: |
|
| 5718 | + $name = 'tMemFunc'; |
|
| 5719 | + // offset: 1; size: 2; size of the following sub-expression |
|
| 5720 | + $subSize = self::_GetInt2d($formulaData, 1); |
|
| 5721 | + $size = 3 + $subSize; |
|
| 5722 | + $data = $this->_getFormulaFromData(substr($formulaData, 3, $subSize)); |
|
| 5723 | + break; |
|
| 5724 | 5724 | |
| 5725 | - case 0x2C: // Relative 2d cell reference reference, used in shared formulas and some other places |
|
| 5726 | - case 0x4C: |
|
| 5727 | - case 0x6C: |
|
| 5728 | - $name = 'tRefN'; |
|
| 5729 | - $size = 5; |
|
| 5730 | - $data = $this->_readBIFF8CellAddressB(substr($formulaData, 1, 4), $baseCell); |
|
| 5731 | - break; |
|
| 5725 | + case 0x2C: // Relative 2d cell reference reference, used in shared formulas and some other places |
|
| 5726 | + case 0x4C: |
|
| 5727 | + case 0x6C: |
|
| 5728 | + $name = 'tRefN'; |
|
| 5729 | + $size = 5; |
|
| 5730 | + $data = $this->_readBIFF8CellAddressB(substr($formulaData, 1, 4), $baseCell); |
|
| 5731 | + break; |
|
| 5732 | 5732 | |
| 5733 | - case 0x2D: // Relative 2d range reference |
|
| 5734 | - case 0x4D: |
|
| 5735 | - case 0x6D: |
|
| 5736 | - $name = 'tAreaN'; |
|
| 5737 | - $size = 9; |
|
| 5738 | - $data = $this->_readBIFF8CellRangeAddressB(substr($formulaData, 1, 8), $baseCell); |
|
| 5739 | - break; |
|
| 5733 | + case 0x2D: // Relative 2d range reference |
|
| 5734 | + case 0x4D: |
|
| 5735 | + case 0x6D: |
|
| 5736 | + $name = 'tAreaN'; |
|
| 5737 | + $size = 9; |
|
| 5738 | + $data = $this->_readBIFF8CellRangeAddressB(substr($formulaData, 1, 8), $baseCell); |
|
| 5739 | + break; |
|
| 5740 | 5740 | |
| 5741 | - case 0x39: // External name |
|
| 5742 | - case 0x59: |
|
| 5743 | - case 0x79: |
|
| 5744 | - $name = 'tNameX'; |
|
| 5745 | - $size = 7; |
|
| 5746 | - // offset: 1; size: 2; index to REF entry in EXTERNSHEET record |
|
| 5747 | - // offset: 3; size: 2; one-based index to DEFINEDNAME or EXTERNNAME record |
|
| 5748 | - $index = self::_GetInt2d($formulaData, 3); |
|
| 5749 | - // assume index is to EXTERNNAME record |
|
| 5750 | - $data = $this->_externalNames[$index - 1]['name']; |
|
| 5751 | - // offset: 5; size: 2; not used |
|
| 5752 | - break; |
|
| 5741 | + case 0x39: // External name |
|
| 5742 | + case 0x59: |
|
| 5743 | + case 0x79: |
|
| 5744 | + $name = 'tNameX'; |
|
| 5745 | + $size = 7; |
|
| 5746 | + // offset: 1; size: 2; index to REF entry in EXTERNSHEET record |
|
| 5747 | + // offset: 3; size: 2; one-based index to DEFINEDNAME or EXTERNNAME record |
|
| 5748 | + $index = self::_GetInt2d($formulaData, 3); |
|
| 5749 | + // assume index is to EXTERNNAME record |
|
| 5750 | + $data = $this->_externalNames[$index - 1]['name']; |
|
| 5751 | + // offset: 5; size: 2; not used |
|
| 5752 | + break; |
|
| 5753 | 5753 | |
| 5754 | - case 0x3A: // 3d reference to cell |
|
| 5755 | - case 0x5A: |
|
| 5756 | - case 0x7A: |
|
| 5757 | - $name = 'tRef3d'; |
|
| 5758 | - $size = 7; |
|
| 5754 | + case 0x3A: // 3d reference to cell |
|
| 5755 | + case 0x5A: |
|
| 5756 | + case 0x7A: |
|
| 5757 | + $name = 'tRef3d'; |
|
| 5758 | + $size = 7; |
|
| 5759 | 5759 | |
| 5760 | - try { |
|
| 5761 | - // offset: 1; size: 2; index to REF entry |
|
| 5762 | - $sheetRange = $this->_readSheetRangeByRefIndex(self::_GetInt2d($formulaData, 1)); |
|
| 5763 | - // offset: 3; size: 4; cell address |
|
| 5764 | - $cellAddress = $this->_readBIFF8CellAddress(substr($formulaData, 3, 4)); |
|
| 5760 | + try { |
|
| 5761 | + // offset: 1; size: 2; index to REF entry |
|
| 5762 | + $sheetRange = $this->_readSheetRangeByRefIndex(self::_GetInt2d($formulaData, 1)); |
|
| 5763 | + // offset: 3; size: 4; cell address |
|
| 5764 | + $cellAddress = $this->_readBIFF8CellAddress(substr($formulaData, 3, 4)); |
|
| 5765 | 5765 | |
| 5766 | - $data = "$sheetRange!$cellAddress"; |
|
| 5767 | - } catch (Exception $e) { |
|
| 5768 | - // deleted sheet reference |
|
| 5769 | - $data = '#REF!'; |
|
| 5770 | - } |
|
| 5766 | + $data = "$sheetRange!$cellAddress"; |
|
| 5767 | + } catch (Exception $e) { |
|
| 5768 | + // deleted sheet reference |
|
| 5769 | + $data = '#REF!'; |
|
| 5770 | + } |
|
| 5771 | 5771 | |
| 5772 | - break; |
|
| 5773 | - case 0x3B: // 3d reference to cell range |
|
| 5774 | - case 0x5B: |
|
| 5775 | - case 0x7B: |
|
| 5776 | - $name = 'tArea3d'; |
|
| 5777 | - $size = 11; |
|
| 5772 | + break; |
|
| 5773 | + case 0x3B: // 3d reference to cell range |
|
| 5774 | + case 0x5B: |
|
| 5775 | + case 0x7B: |
|
| 5776 | + $name = 'tArea3d'; |
|
| 5777 | + $size = 11; |
|
| 5778 | 5778 | |
| 5779 | - try { |
|
| 5780 | - // offset: 1; size: 2; index to REF entry |
|
| 5781 | - $sheetRange = $this->_readSheetRangeByRefIndex(self::_GetInt2d($formulaData, 1)); |
|
| 5782 | - // offset: 3; size: 8; cell address |
|
| 5783 | - $cellRangeAddress = $this->_readBIFF8CellRangeAddress(substr($formulaData, 3, 8)); |
|
| 5779 | + try { |
|
| 5780 | + // offset: 1; size: 2; index to REF entry |
|
| 5781 | + $sheetRange = $this->_readSheetRangeByRefIndex(self::_GetInt2d($formulaData, 1)); |
|
| 5782 | + // offset: 3; size: 8; cell address |
|
| 5783 | + $cellRangeAddress = $this->_readBIFF8CellRangeAddress(substr($formulaData, 3, 8)); |
|
| 5784 | 5784 | |
| 5785 | - $data = "$sheetRange!$cellRangeAddress"; |
|
| 5786 | - } catch (Exception $e) { |
|
| 5787 | - // deleted sheet reference |
|
| 5788 | - $data = '#REF!'; |
|
| 5789 | - } |
|
| 5785 | + $data = "$sheetRange!$cellRangeAddress"; |
|
| 5786 | + } catch (Exception $e) { |
|
| 5787 | + // deleted sheet reference |
|
| 5788 | + $data = '#REF!'; |
|
| 5789 | + } |
|
| 5790 | 5790 | |
| 5791 | - break; |
|
| 5792 | - // Unknown cases // don't know how to deal with |
|
| 5793 | - default: |
|
| 5794 | - throw new Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula'); |
|
| 5795 | - break; |
|
| 5791 | + break; |
|
| 5792 | + // Unknown cases // don't know how to deal with |
|
| 5793 | + default: |
|
| 5794 | + throw new Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula'); |
|
| 5795 | + break; |
|
| 5796 | 5796 | } |
| 5797 | 5797 | |
| 5798 | 5798 | return array( |
@@ -6259,35 +6259,35 @@ discard block |
||
| 6259 | 6259 | $identifier = ord($valueData[0]); |
| 6260 | 6260 | |
| 6261 | 6261 | switch ($identifier) { |
| 6262 | - case 0x00: // empty constant (what is this?) |
|
| 6263 | - $value = ''; |
|
| 6264 | - $size = 9; |
|
| 6265 | - break; |
|
| 6266 | - case 0x01: // number |
|
| 6267 | - // offset: 1; size: 8; IEEE 754 floating-point value |
|
| 6268 | - $value = self::_extractNumber(substr($valueData, 1, 8)); |
|
| 6269 | - $size = 9; |
|
| 6270 | - break; |
|
| 6271 | - case 0x02: // string value |
|
| 6272 | - // offset: 1; size: var; Unicode string, 16-bit string length |
|
| 6273 | - $string = self::_readUnicodeStringLong(substr($valueData, 1)); |
|
| 6274 | - $value = '"' . $string['value'] . '"'; |
|
| 6275 | - $size = 1 + $string['size']; |
|
| 6276 | - break; |
|
| 6277 | - case 0x04: // boolean |
|
| 6278 | - // offset: 1; size: 1; 0 = FALSE, 1 = TRUE |
|
| 6279 | - if (ord($valueData[1])) { |
|
| 6280 | - $value = 'TRUE'; |
|
| 6281 | - } else { |
|
| 6282 | - $value = 'FALSE'; |
|
| 6283 | - } |
|
| 6284 | - $size = 9; |
|
| 6285 | - break; |
|
| 6286 | - case 0x10: // error code |
|
| 6287 | - // offset: 1; size: 1; error code |
|
| 6288 | - $value = self::_mapErrorCode(ord($valueData[1])); |
|
| 6289 | - $size = 9; |
|
| 6290 | - break; |
|
| 6262 | + case 0x00: // empty constant (what is this?) |
|
| 6263 | + $value = ''; |
|
| 6264 | + $size = 9; |
|
| 6265 | + break; |
|
| 6266 | + case 0x01: // number |
|
| 6267 | + // offset: 1; size: 8; IEEE 754 floating-point value |
|
| 6268 | + $value = self::_extractNumber(substr($valueData, 1, 8)); |
|
| 6269 | + $size = 9; |
|
| 6270 | + break; |
|
| 6271 | + case 0x02: // string value |
|
| 6272 | + // offset: 1; size: var; Unicode string, 16-bit string length |
|
| 6273 | + $string = self::_readUnicodeStringLong(substr($valueData, 1)); |
|
| 6274 | + $value = '"' . $string['value'] . '"'; |
|
| 6275 | + $size = 1 + $string['size']; |
|
| 6276 | + break; |
|
| 6277 | + case 0x04: // boolean |
|
| 6278 | + // offset: 1; size: 1; 0 = FALSE, 1 = TRUE |
|
| 6279 | + if (ord($valueData[1])) { |
|
| 6280 | + $value = 'TRUE'; |
|
| 6281 | + } else { |
|
| 6282 | + $value = 'FALSE'; |
|
| 6283 | + } |
|
| 6284 | + $size = 9; |
|
| 6285 | + break; |
|
| 6286 | + case 0x10: // error code |
|
| 6287 | + // offset: 1; size: 1; error code |
|
| 6288 | + $value = self::_mapErrorCode(ord($valueData[1])); |
|
| 6289 | + $size = 9; |
|
| 6290 | + break; |
|
| 6291 | 6291 | } |
| 6292 | 6292 | return array( |
| 6293 | 6293 | 'value' => $value, |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | /** PHPExcel root directory */ |
| 61 | -if (!defined('PHPEXCEL_ROOT')) { |
|
| 61 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
| 62 | 62 | /** |
| 63 | 63 | * @ignore |
| 64 | 64 | */ |
| 65 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
| 66 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
| 65 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
| 66 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -80,83 +80,83 @@ discard block |
||
| 80 | 80 | // ParseXL definitions |
| 81 | 81 | const XLS_BIFF8 = 0x0600; |
| 82 | 82 | const XLS_BIFF7 = 0x0500; |
| 83 | - const XLS_WorkbookGlobals = 0x0005; |
|
| 84 | - const XLS_Worksheet = 0x0010; |
|
| 83 | + const XLS_WorkbookGlobals = 0x0005; |
|
| 84 | + const XLS_Worksheet = 0x0010; |
|
| 85 | 85 | |
| 86 | 86 | // record identifiers |
| 87 | 87 | const XLS_Type_FORMULA = 0x0006; |
| 88 | - const XLS_Type_EOF = 0x000a; |
|
| 88 | + const XLS_Type_EOF = 0x000a; |
|
| 89 | 89 | const XLS_Type_PROTECT = 0x0012; |
| 90 | - const XLS_Type_OBJECTPROTECT = 0x0063; |
|
| 91 | - const XLS_Type_SCENPROTECT = 0x00dd; |
|
| 92 | - const XLS_Type_PASSWORD = 0x0013; |
|
| 90 | + const XLS_Type_OBJECTPROTECT = 0x0063; |
|
| 91 | + const XLS_Type_SCENPROTECT = 0x00dd; |
|
| 92 | + const XLS_Type_PASSWORD = 0x0013; |
|
| 93 | 93 | const XLS_Type_HEADER = 0x0014; |
| 94 | 94 | const XLS_Type_FOOTER = 0x0015; |
| 95 | 95 | const XLS_Type_EXTERNSHEET = 0x0017; |
| 96 | 96 | const XLS_Type_DEFINEDNAME = 0x0018; |
| 97 | - const XLS_Type_VERTICALPAGEBREAKS = 0x001a; |
|
| 98 | - const XLS_Type_HORIZONTALPAGEBREAKS = 0x001b; |
|
| 99 | - const XLS_Type_NOTE = 0x001c; |
|
| 97 | + const XLS_Type_VERTICALPAGEBREAKS = 0x001a; |
|
| 98 | + const XLS_Type_HORIZONTALPAGEBREAKS = 0x001b; |
|
| 99 | + const XLS_Type_NOTE = 0x001c; |
|
| 100 | 100 | const XLS_Type_SELECTION = 0x001d; |
| 101 | 101 | const XLS_Type_DATEMODE = 0x0022; |
| 102 | 102 | const XLS_Type_EXTERNNAME = 0x0023; |
| 103 | 103 | const XLS_Type_LEFTMARGIN = 0x0026; |
| 104 | - const XLS_Type_RIGHTMARGIN = 0x0027; |
|
| 104 | + const XLS_Type_RIGHTMARGIN = 0x0027; |
|
| 105 | 105 | const XLS_Type_TOPMARGIN = 0x0028; |
| 106 | - const XLS_Type_BOTTOMMARGIN = 0x0029; |
|
| 107 | - const XLS_Type_PRINTGRIDLINES = 0x002b; |
|
| 106 | + const XLS_Type_BOTTOMMARGIN = 0x0029; |
|
| 107 | + const XLS_Type_PRINTGRIDLINES = 0x002b; |
|
| 108 | 108 | const XLS_Type_FILEPASS = 0x002f; |
| 109 | 109 | const XLS_Type_FONT = 0x0031; |
| 110 | 110 | const XLS_Type_CONTINUE = 0x003c; |
| 111 | 111 | const XLS_Type_PANE = 0x0041; |
| 112 | 112 | const XLS_Type_CODEPAGE = 0x0042; |
| 113 | - const XLS_Type_DEFCOLWIDTH = 0x0055; |
|
| 114 | - const XLS_Type_OBJ = 0x005d; |
|
| 113 | + const XLS_Type_DEFCOLWIDTH = 0x0055; |
|
| 114 | + const XLS_Type_OBJ = 0x005d; |
|
| 115 | 115 | const XLS_Type_COLINFO = 0x007d; |
| 116 | - const XLS_Type_IMDATA = 0x007f; |
|
| 116 | + const XLS_Type_IMDATA = 0x007f; |
|
| 117 | 117 | const XLS_Type_SHEETPR = 0x0081; |
| 118 | 118 | const XLS_Type_HCENTER = 0x0083; |
| 119 | 119 | const XLS_Type_VCENTER = 0x0084; |
| 120 | - const XLS_Type_SHEET = 0x0085; |
|
| 120 | + const XLS_Type_SHEET = 0x0085; |
|
| 121 | 121 | const XLS_Type_PALETTE = 0x0092; |
| 122 | - const XLS_Type_SCL = 0x00a0; |
|
| 122 | + const XLS_Type_SCL = 0x00a0; |
|
| 123 | 123 | const XLS_Type_PAGESETUP = 0x00a1; |
| 124 | - const XLS_Type_MULRK = 0x00bd; |
|
| 124 | + const XLS_Type_MULRK = 0x00bd; |
|
| 125 | 125 | const XLS_Type_MULBLANK = 0x00be; |
| 126 | - const XLS_Type_DBCELL = 0x00d7; |
|
| 127 | - const XLS_Type_XF = 0x00e0; |
|
| 128 | - const XLS_Type_MERGEDCELLS = 0x00e5; |
|
| 129 | - const XLS_Type_MSODRAWINGGROUP = 0x00eb; |
|
| 130 | - const XLS_Type_MSODRAWING = 0x00ec; |
|
| 131 | - const XLS_Type_SST = 0x00fc; |
|
| 132 | - const XLS_Type_LABELSST = 0x00fd; |
|
| 133 | - const XLS_Type_EXTSST = 0x00ff; |
|
| 134 | - const XLS_Type_EXTERNALBOOK = 0x01ae; |
|
| 135 | - const XLS_Type_DATAVALIDATIONS = 0x01b2; |
|
| 136 | - const XLS_Type_TXO = 0x01b6; |
|
| 126 | + const XLS_Type_DBCELL = 0x00d7; |
|
| 127 | + const XLS_Type_XF = 0x00e0; |
|
| 128 | + const XLS_Type_MERGEDCELLS = 0x00e5; |
|
| 129 | + const XLS_Type_MSODRAWINGGROUP = 0x00eb; |
|
| 130 | + const XLS_Type_MSODRAWING = 0x00ec; |
|
| 131 | + const XLS_Type_SST = 0x00fc; |
|
| 132 | + const XLS_Type_LABELSST = 0x00fd; |
|
| 133 | + const XLS_Type_EXTSST = 0x00ff; |
|
| 134 | + const XLS_Type_EXTERNALBOOK = 0x01ae; |
|
| 135 | + const XLS_Type_DATAVALIDATIONS = 0x01b2; |
|
| 136 | + const XLS_Type_TXO = 0x01b6; |
|
| 137 | 137 | const XLS_Type_HYPERLINK = 0x01b8; |
| 138 | - const XLS_Type_DATAVALIDATION = 0x01be; |
|
| 138 | + const XLS_Type_DATAVALIDATION = 0x01be; |
|
| 139 | 139 | const XLS_Type_DIMENSION = 0x0200; |
| 140 | 140 | const XLS_Type_BLANK = 0x0201; |
| 141 | 141 | const XLS_Type_NUMBER = 0x0203; |
| 142 | 142 | const XLS_Type_LABEL = 0x0204; |
| 143 | - const XLS_Type_BOOLERR = 0x0205; |
|
| 143 | + const XLS_Type_BOOLERR = 0x0205; |
|
| 144 | 144 | const XLS_Type_STRING = 0x0207; |
| 145 | - const XLS_Type_ROW = 0x0208; |
|
| 145 | + const XLS_Type_ROW = 0x0208; |
|
| 146 | 146 | const XLS_Type_INDEX = 0x020b; |
| 147 | 147 | const XLS_Type_ARRAY = 0x0221; |
| 148 | - const XLS_Type_DEFAULTROWHEIGHT = 0x0225; |
|
| 149 | - const XLS_Type_WINDOW2 = 0x023e; |
|
| 150 | - const XLS_Type_RK = 0x027e; |
|
| 151 | - const XLS_Type_STYLE = 0x0293; |
|
| 152 | - const XLS_Type_FORMAT = 0x041e; |
|
| 153 | - const XLS_Type_SHAREDFMLA = 0x04bc; |
|
| 154 | - const XLS_Type_BOF = 0x0809; |
|
| 148 | + const XLS_Type_DEFAULTROWHEIGHT = 0x0225; |
|
| 149 | + const XLS_Type_WINDOW2 = 0x023e; |
|
| 150 | + const XLS_Type_RK = 0x027e; |
|
| 151 | + const XLS_Type_STYLE = 0x0293; |
|
| 152 | + const XLS_Type_FORMAT = 0x041e; |
|
| 153 | + const XLS_Type_SHAREDFMLA = 0x04bc; |
|
| 154 | + const XLS_Type_BOF = 0x0809; |
|
| 155 | 155 | const XLS_Type_SHEETPROTECTION = 0x0867; |
| 156 | 156 | const XLS_Type_RANGEPROTECTION = 0x0868; |
| 157 | - const XLS_Type_SHEETLAYOUT = 0x0862; |
|
| 158 | - const XLS_Type_XFEXT = 0x087d; |
|
| 159 | - const XLS_Type_UNKNOWN = 0xffff; |
|
| 157 | + const XLS_Type_SHEETLAYOUT = 0x0862; |
|
| 158 | + const XLS_Type_XFEXT = 0x087d; |
|
| 159 | + const XLS_Type_UNKNOWN = 0xffff; |
|
| 160 | 160 | |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -515,8 +515,8 @@ discard block |
||
| 515 | 515 | public function canRead($pFilename) |
| 516 | 516 | { |
| 517 | 517 | // Check if file exists |
| 518 | - if (!file_exists($pFilename)) { |
|
| 519 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 518 | + if ( ! file_exists($pFilename)) { |
|
| 519 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | try { |
@@ -542,8 +542,8 @@ discard block |
||
| 542 | 542 | public function listWorksheetNames($pFilename) |
| 543 | 543 | { |
| 544 | 544 | // Check if file exists |
| 545 | - if (!file_exists($pFilename)) { |
|
| 546 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 545 | + if ( ! file_exists($pFilename)) { |
|
| 546 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | $worksheetNames = array(); |
@@ -554,18 +554,18 @@ discard block |
||
| 554 | 554 | // total byte size of Excel data (workbook global substream + sheet substreams) |
| 555 | 555 | $this->_dataSize = strlen($this->_data); |
| 556 | 556 | |
| 557 | - $this->_pos = 0; |
|
| 558 | - $this->_sheets = array(); |
|
| 557 | + $this->_pos = 0; |
|
| 558 | + $this->_sheets = array(); |
|
| 559 | 559 | |
| 560 | 560 | // Parse Workbook Global Substream |
| 561 | 561 | while ($this->_pos < $this->_dataSize) { |
| 562 | 562 | $code = self::_GetInt2d($this->_data, $this->_pos); |
| 563 | 563 | |
| 564 | 564 | switch ($code) { |
| 565 | - case self::XLS_Type_BOF: $this->_readBof(); break; |
|
| 566 | - case self::XLS_Type_SHEET: $this->_readSheet(); break; |
|
| 567 | - case self::XLS_Type_EOF: $this->_readDefault(); break 2; |
|
| 568 | - default: $this->_readDefault(); break; |
|
| 565 | + case self::XLS_Type_BOF: $this->_readBof(); break; |
|
| 566 | + case self::XLS_Type_SHEET: $this->_readSheet(); break; |
|
| 567 | + case self::XLS_Type_EOF: $this->_readDefault(); break 2; |
|
| 568 | + default: $this->_readDefault(); break; |
|
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | 571 | |
@@ -591,8 +591,8 @@ discard block |
||
| 591 | 591 | public function listWorksheetInfo($pFilename) |
| 592 | 592 | { |
| 593 | 593 | // Check if file exists |
| 594 | - if (!file_exists($pFilename)) { |
|
| 595 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 594 | + if ( ! file_exists($pFilename)) { |
|
| 595 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | $worksheetInfo = array(); |
@@ -612,10 +612,10 @@ discard block |
||
| 612 | 612 | $code = self::_GetInt2d($this->_data, $this->_pos); |
| 613 | 613 | |
| 614 | 614 | switch ($code) { |
| 615 | - case self::XLS_Type_BOF: $this->_readBof(); break; |
|
| 616 | - case self::XLS_Type_SHEET: $this->_readSheet(); break; |
|
| 617 | - case self::XLS_Type_EOF: $this->_readDefault(); break 2; |
|
| 618 | - default: $this->_readDefault(); break; |
|
| 615 | + case self::XLS_Type_BOF: $this->_readBof(); break; |
|
| 616 | + case self::XLS_Type_SHEET: $this->_readSheet(); break; |
|
| 617 | + case self::XLS_Type_EOF: $this->_readDefault(); break 2; |
|
| 618 | + default: $this->_readDefault(); break; |
|
| 619 | 619 | } |
| 620 | 620 | } |
| 621 | 621 | |
@@ -660,9 +660,9 @@ discard block |
||
| 660 | 660 | $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex); |
| 661 | 661 | $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex); |
| 662 | 662 | break; |
| 663 | - case self::XLS_Type_BOF: $this->_readBof(); break; |
|
| 664 | - case self::XLS_Type_EOF: $this->_readDefault(); break 2; |
|
| 665 | - default: $this->_readDefault(); break; |
|
| 663 | + case self::XLS_Type_BOF: $this->_readBof(); break; |
|
| 664 | + case self::XLS_Type_EOF: $this->_readDefault(); break 2; |
|
| 665 | + default: $this->_readDefault(); break; |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | // Initialisations |
| 692 | 692 | $this->_phpExcel = new PHPExcel; |
| 693 | 693 | $this->_phpExcel->removeSheetByIndex(0); // remove 1st sheet |
| 694 | - if (!$this->_readDataOnly) { |
|
| 694 | + if ( ! $this->_readDataOnly) { |
|
| 695 | 695 | $this->_phpExcel->removeCellStyleXfByIndex(0); // remove the default style |
| 696 | 696 | $this->_phpExcel->removeCellXfByIndex(0); // remove the default style |
| 697 | 697 | } |
@@ -706,54 +706,54 @@ discard block |
||
| 706 | 706 | $this->_dataSize = strlen($this->_data); |
| 707 | 707 | |
| 708 | 708 | // initialize |
| 709 | - $this->_pos = 0; |
|
| 709 | + $this->_pos = 0; |
|
| 710 | 710 | $this->_codepage = 'CP1252'; |
| 711 | 711 | $this->_formats = array(); |
| 712 | 712 | $this->_objFonts = array(); |
| 713 | 713 | $this->_palette = array(); |
| 714 | - $this->_sheets = array(); |
|
| 715 | - $this->_externalBooks = array(); |
|
| 714 | + $this->_sheets = array(); |
|
| 715 | + $this->_externalBooks = array(); |
|
| 716 | 716 | $this->_ref = array(); |
| 717 | - $this->_definedname = array(); |
|
| 717 | + $this->_definedname = array(); |
|
| 718 | 718 | $this->_sst = array(); |
| 719 | - $this->_drawingGroupData = ''; |
|
| 720 | - $this->_xfIndex = ''; |
|
| 721 | - $this->_mapCellXfIndex = array(); |
|
| 722 | - $this->_mapCellStyleXfIndex = array(); |
|
| 719 | + $this->_drawingGroupData = ''; |
|
| 720 | + $this->_xfIndex = ''; |
|
| 721 | + $this->_mapCellXfIndex = array(); |
|
| 722 | + $this->_mapCellStyleXfIndex = array(); |
|
| 723 | 723 | |
| 724 | 724 | // Parse Workbook Global Substream |
| 725 | 725 | while ($this->_pos < $this->_dataSize) { |
| 726 | 726 | $code = self::_GetInt2d($this->_data, $this->_pos); |
| 727 | 727 | |
| 728 | 728 | switch ($code) { |
| 729 | - case self::XLS_Type_BOF: $this->_readBof(); break; |
|
| 730 | - case self::XLS_Type_FILEPASS: $this->_readFilepass(); break; |
|
| 731 | - case self::XLS_Type_CODEPAGE: $this->_readCodepage(); break; |
|
| 732 | - case self::XLS_Type_DATEMODE: $this->_readDateMode(); break; |
|
| 733 | - case self::XLS_Type_FONT: $this->_readFont(); break; |
|
| 734 | - case self::XLS_Type_FORMAT: $this->_readFormat(); break; |
|
| 735 | - case self::XLS_Type_XF: $this->_readXf(); break; |
|
| 736 | - case self::XLS_Type_XFEXT: $this->_readXfExt(); break; |
|
| 737 | - case self::XLS_Type_STYLE: $this->_readStyle(); break; |
|
| 738 | - case self::XLS_Type_PALETTE: $this->_readPalette(); break; |
|
| 739 | - case self::XLS_Type_SHEET: $this->_readSheet(); break; |
|
| 740 | - case self::XLS_Type_EXTERNALBOOK: $this->_readExternalBook(); break; |
|
| 741 | - case self::XLS_Type_EXTERNNAME: $this->_readExternName(); break; |
|
| 742 | - case self::XLS_Type_EXTERNSHEET: $this->_readExternSheet(); break; |
|
| 743 | - case self::XLS_Type_DEFINEDNAME: $this->_readDefinedName(); break; |
|
| 744 | - case self::XLS_Type_MSODRAWINGGROUP: $this->_readMsoDrawingGroup(); break; |
|
| 745 | - case self::XLS_Type_SST: $this->_readSst(); break; |
|
| 746 | - case self::XLS_Type_EOF: $this->_readDefault(); break 2; |
|
| 747 | - default: $this->_readDefault(); break; |
|
| 729 | + case self::XLS_Type_BOF: $this->_readBof(); break; |
|
| 730 | + case self::XLS_Type_FILEPASS: $this->_readFilepass(); break; |
|
| 731 | + case self::XLS_Type_CODEPAGE: $this->_readCodepage(); break; |
|
| 732 | + case self::XLS_Type_DATEMODE: $this->_readDateMode(); break; |
|
| 733 | + case self::XLS_Type_FONT: $this->_readFont(); break; |
|
| 734 | + case self::XLS_Type_FORMAT: $this->_readFormat(); break; |
|
| 735 | + case self::XLS_Type_XF: $this->_readXf(); break; |
|
| 736 | + case self::XLS_Type_XFEXT: $this->_readXfExt(); break; |
|
| 737 | + case self::XLS_Type_STYLE: $this->_readStyle(); break; |
|
| 738 | + case self::XLS_Type_PALETTE: $this->_readPalette(); break; |
|
| 739 | + case self::XLS_Type_SHEET: $this->_readSheet(); break; |
|
| 740 | + case self::XLS_Type_EXTERNALBOOK: $this->_readExternalBook(); break; |
|
| 741 | + case self::XLS_Type_EXTERNNAME: $this->_readExternName(); break; |
|
| 742 | + case self::XLS_Type_EXTERNSHEET: $this->_readExternSheet(); break; |
|
| 743 | + case self::XLS_Type_DEFINEDNAME: $this->_readDefinedName(); break; |
|
| 744 | + case self::XLS_Type_MSODRAWINGGROUP: $this->_readMsoDrawingGroup(); break; |
|
| 745 | + case self::XLS_Type_SST: $this->_readSst(); break; |
|
| 746 | + case self::XLS_Type_EOF: $this->_readDefault(); break 2; |
|
| 747 | + default: $this->_readDefault(); break; |
|
| 748 | 748 | } |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | // Resolve indexed colors for font, fill, and border colors |
| 752 | 752 | // Cannot be resolved already in XF record, because PALETTE record comes afterwards |
| 753 | - if (!$this->_readDataOnly) { |
|
| 753 | + if ( ! $this->_readDataOnly) { |
|
| 754 | 754 | foreach ($this->_objFonts as $objFont) { |
| 755 | 755 | if (isset($objFont->colorIndex)) { |
| 756 | - $color = self::_readColor($objFont->colorIndex,$this->_palette,$this->_version); |
|
| 756 | + $color = self::_readColor($objFont->colorIndex, $this->_palette, $this->_version); |
|
| 757 | 757 | $objFont->getColor()->setRGB($color['rgb']); |
| 758 | 758 | } |
| 759 | 759 | } |
@@ -763,12 +763,12 @@ discard block |
||
| 763 | 763 | $fill = $objStyle->getFill(); |
| 764 | 764 | |
| 765 | 765 | if (isset($fill->startcolorIndex)) { |
| 766 | - $startColor = self::_readColor($fill->startcolorIndex,$this->_palette,$this->_version); |
|
| 766 | + $startColor = self::_readColor($fill->startcolorIndex, $this->_palette, $this->_version); |
|
| 767 | 767 | $fill->getStartColor()->setRGB($startColor['rgb']); |
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | if (isset($fill->endcolorIndex)) { |
| 771 | - $endColor = self::_readColor($fill->endcolorIndex,$this->_palette,$this->_version); |
|
| 771 | + $endColor = self::_readColor($fill->endcolorIndex, $this->_palette, $this->_version); |
|
| 772 | 772 | $fill->getEndColor()->setRGB($endColor['rgb']); |
| 773 | 773 | } |
| 774 | 774 | |
@@ -780,34 +780,34 @@ discard block |
||
| 780 | 780 | $diagonal = $objStyle->getBorders()->getDiagonal(); |
| 781 | 781 | |
| 782 | 782 | if (isset($top->colorIndex)) { |
| 783 | - $borderTopColor = self::_readColor($top->colorIndex,$this->_palette,$this->_version); |
|
| 783 | + $borderTopColor = self::_readColor($top->colorIndex, $this->_palette, $this->_version); |
|
| 784 | 784 | $top->getColor()->setRGB($borderTopColor['rgb']); |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | if (isset($right->colorIndex)) { |
| 788 | - $borderRightColor = self::_readColor($right->colorIndex,$this->_palette,$this->_version); |
|
| 788 | + $borderRightColor = self::_readColor($right->colorIndex, $this->_palette, $this->_version); |
|
| 789 | 789 | $right->getColor()->setRGB($borderRightColor['rgb']); |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | if (isset($bottom->colorIndex)) { |
| 793 | - $borderBottomColor = self::_readColor($bottom->colorIndex,$this->_palette,$this->_version); |
|
| 793 | + $borderBottomColor = self::_readColor($bottom->colorIndex, $this->_palette, $this->_version); |
|
| 794 | 794 | $bottom->getColor()->setRGB($borderBottomColor['rgb']); |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | if (isset($left->colorIndex)) { |
| 798 | - $borderLeftColor = self::_readColor($left->colorIndex,$this->_palette,$this->_version); |
|
| 798 | + $borderLeftColor = self::_readColor($left->colorIndex, $this->_palette, $this->_version); |
|
| 799 | 799 | $left->getColor()->setRGB($borderLeftColor['rgb']); |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | if (isset($diagonal->colorIndex)) { |
| 803 | - $borderDiagonalColor = self::_readColor($diagonal->colorIndex,$this->_palette,$this->_version); |
|
| 803 | + $borderDiagonalColor = self::_readColor($diagonal->colorIndex, $this->_palette, $this->_version); |
|
| 804 | 804 | $diagonal->getColor()->setRGB($borderDiagonalColor['rgb']); |
| 805 | 805 | } |
| 806 | 806 | } |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | // treat MSODRAWINGGROUP records, workbook-level Escher |
| 810 | - if (!$this->_readDataOnly && $this->_drawingGroupData) { |
|
| 810 | + if ( ! $this->_readDataOnly && $this->_drawingGroupData) { |
|
| 811 | 811 | $escherWorkbook = new PHPExcel_Shared_Escher(); |
| 812 | 812 | $reader = new PHPExcel_Reader_Excel5_Escher($escherWorkbook); |
| 813 | 813 | $escherWorkbook = $reader->load($this->_drawingGroupData); |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | // check if sheet should be skipped |
| 829 | - if (isset($this->_loadSheetsOnly) && !in_array($sheet['name'], $this->_loadSheetsOnly)) { |
|
| 829 | + if (isset($this->_loadSheetsOnly) && ! in_array($sheet['name'], $this->_loadSheetsOnly)) { |
|
| 830 | 830 | continue; |
| 831 | 831 | } |
| 832 | 832 | |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula |
| 836 | 836 | // cells... during the load, all formulae should be correct, and we're simply bringing the worksheet |
| 837 | 837 | // name in line with the formula, not the reverse |
| 838 | - $this->_phpSheet->setTitle($sheet['name'],false); |
|
| 838 | + $this->_phpSheet->setTitle($sheet['name'], false); |
|
| 839 | 839 | $this->_phpSheet->setSheetState($sheet['sheetState']); |
| 840 | 840 | |
| 841 | 841 | $this->_pos = $sheet['offset']; |
@@ -866,65 +866,65 @@ discard block |
||
| 866 | 866 | $code = self::_GetInt2d($this->_data, $this->_pos); |
| 867 | 867 | |
| 868 | 868 | switch ($code) { |
| 869 | - case self::XLS_Type_BOF: $this->_readBof(); break; |
|
| 870 | - case self::XLS_Type_PRINTGRIDLINES: $this->_readPrintGridlines(); break; |
|
| 871 | - case self::XLS_Type_DEFAULTROWHEIGHT: $this->_readDefaultRowHeight(); break; |
|
| 872 | - case self::XLS_Type_SHEETPR: $this->_readSheetPr(); break; |
|
| 873 | - case self::XLS_Type_HORIZONTALPAGEBREAKS: $this->_readHorizontalPageBreaks(); break; |
|
| 874 | - case self::XLS_Type_VERTICALPAGEBREAKS: $this->_readVerticalPageBreaks(); break; |
|
| 875 | - case self::XLS_Type_HEADER: $this->_readHeader(); break; |
|
| 876 | - case self::XLS_Type_FOOTER: $this->_readFooter(); break; |
|
| 877 | - case self::XLS_Type_HCENTER: $this->_readHcenter(); break; |
|
| 878 | - case self::XLS_Type_VCENTER: $this->_readVcenter(); break; |
|
| 879 | - case self::XLS_Type_LEFTMARGIN: $this->_readLeftMargin(); break; |
|
| 880 | - case self::XLS_Type_RIGHTMARGIN: $this->_readRightMargin(); break; |
|
| 881 | - case self::XLS_Type_TOPMARGIN: $this->_readTopMargin(); break; |
|
| 882 | - case self::XLS_Type_BOTTOMMARGIN: $this->_readBottomMargin(); break; |
|
| 883 | - case self::XLS_Type_PAGESETUP: $this->_readPageSetup(); break; |
|
| 884 | - case self::XLS_Type_PROTECT: $this->_readProtect(); break; |
|
| 885 | - case self::XLS_Type_SCENPROTECT: $this->_readScenProtect(); break; |
|
| 886 | - case self::XLS_Type_OBJECTPROTECT: $this->_readObjectProtect(); break; |
|
| 887 | - case self::XLS_Type_PASSWORD: $this->_readPassword(); break; |
|
| 888 | - case self::XLS_Type_DEFCOLWIDTH: $this->_readDefColWidth(); break; |
|
| 889 | - case self::XLS_Type_COLINFO: $this->_readColInfo(); break; |
|
| 890 | - case self::XLS_Type_DIMENSION: $this->_readDefault(); break; |
|
| 891 | - case self::XLS_Type_ROW: $this->_readRow(); break; |
|
| 892 | - case self::XLS_Type_DBCELL: $this->_readDefault(); break; |
|
| 893 | - case self::XLS_Type_RK: $this->_readRk(); break; |
|
| 894 | - case self::XLS_Type_LABELSST: $this->_readLabelSst(); break; |
|
| 895 | - case self::XLS_Type_MULRK: $this->_readMulRk(); break; |
|
| 896 | - case self::XLS_Type_NUMBER: $this->_readNumber(); break; |
|
| 897 | - case self::XLS_Type_FORMULA: $this->_readFormula(); break; |
|
| 898 | - case self::XLS_Type_SHAREDFMLA: $this->_readSharedFmla(); break; |
|
| 899 | - case self::XLS_Type_BOOLERR: $this->_readBoolErr(); break; |
|
| 900 | - case self::XLS_Type_MULBLANK: $this->_readMulBlank(); break; |
|
| 901 | - case self::XLS_Type_LABEL: $this->_readLabel(); break; |
|
| 902 | - case self::XLS_Type_BLANK: $this->_readBlank(); break; |
|
| 903 | - case self::XLS_Type_MSODRAWING: $this->_readMsoDrawing(); break; |
|
| 904 | - case self::XLS_Type_OBJ: $this->_readObj(); break; |
|
| 905 | - case self::XLS_Type_WINDOW2: $this->_readWindow2(); break; |
|
| 906 | - case self::XLS_Type_SCL: $this->_readScl(); break; |
|
| 907 | - case self::XLS_Type_PANE: $this->_readPane(); break; |
|
| 908 | - case self::XLS_Type_SELECTION: $this->_readSelection(); break; |
|
| 909 | - case self::XLS_Type_MERGEDCELLS: $this->_readMergedCells(); break; |
|
| 910 | - case self::XLS_Type_HYPERLINK: $this->_readHyperLink(); break; |
|
| 911 | - case self::XLS_Type_DATAVALIDATIONS: $this->_readDataValidations(); break; |
|
| 912 | - case self::XLS_Type_DATAVALIDATION: $this->_readDataValidation(); break; |
|
| 913 | - case self::XLS_Type_SHEETLAYOUT: $this->_readSheetLayout(); break; |
|
| 914 | - case self::XLS_Type_SHEETPROTECTION: $this->_readSheetProtection(); break; |
|
| 915 | - case self::XLS_Type_RANGEPROTECTION: $this->_readRangeProtection(); break; |
|
| 916 | - case self::XLS_Type_NOTE: $this->_readNote(); break; |
|
| 869 | + case self::XLS_Type_BOF: $this->_readBof(); break; |
|
| 870 | + case self::XLS_Type_PRINTGRIDLINES: $this->_readPrintGridlines(); break; |
|
| 871 | + case self::XLS_Type_DEFAULTROWHEIGHT: $this->_readDefaultRowHeight(); break; |
|
| 872 | + case self::XLS_Type_SHEETPR: $this->_readSheetPr(); break; |
|
| 873 | + case self::XLS_Type_HORIZONTALPAGEBREAKS: $this->_readHorizontalPageBreaks(); break; |
|
| 874 | + case self::XLS_Type_VERTICALPAGEBREAKS: $this->_readVerticalPageBreaks(); break; |
|
| 875 | + case self::XLS_Type_HEADER: $this->_readHeader(); break; |
|
| 876 | + case self::XLS_Type_FOOTER: $this->_readFooter(); break; |
|
| 877 | + case self::XLS_Type_HCENTER: $this->_readHcenter(); break; |
|
| 878 | + case self::XLS_Type_VCENTER: $this->_readVcenter(); break; |
|
| 879 | + case self::XLS_Type_LEFTMARGIN: $this->_readLeftMargin(); break; |
|
| 880 | + case self::XLS_Type_RIGHTMARGIN: $this->_readRightMargin(); break; |
|
| 881 | + case self::XLS_Type_TOPMARGIN: $this->_readTopMargin(); break; |
|
| 882 | + case self::XLS_Type_BOTTOMMARGIN: $this->_readBottomMargin(); break; |
|
| 883 | + case self::XLS_Type_PAGESETUP: $this->_readPageSetup(); break; |
|
| 884 | + case self::XLS_Type_PROTECT: $this->_readProtect(); break; |
|
| 885 | + case self::XLS_Type_SCENPROTECT: $this->_readScenProtect(); break; |
|
| 886 | + case self::XLS_Type_OBJECTPROTECT: $this->_readObjectProtect(); break; |
|
| 887 | + case self::XLS_Type_PASSWORD: $this->_readPassword(); break; |
|
| 888 | + case self::XLS_Type_DEFCOLWIDTH: $this->_readDefColWidth(); break; |
|
| 889 | + case self::XLS_Type_COLINFO: $this->_readColInfo(); break; |
|
| 890 | + case self::XLS_Type_DIMENSION: $this->_readDefault(); break; |
|
| 891 | + case self::XLS_Type_ROW: $this->_readRow(); break; |
|
| 892 | + case self::XLS_Type_DBCELL: $this->_readDefault(); break; |
|
| 893 | + case self::XLS_Type_RK: $this->_readRk(); break; |
|
| 894 | + case self::XLS_Type_LABELSST: $this->_readLabelSst(); break; |
|
| 895 | + case self::XLS_Type_MULRK: $this->_readMulRk(); break; |
|
| 896 | + case self::XLS_Type_NUMBER: $this->_readNumber(); break; |
|
| 897 | + case self::XLS_Type_FORMULA: $this->_readFormula(); break; |
|
| 898 | + case self::XLS_Type_SHAREDFMLA: $this->_readSharedFmla(); break; |
|
| 899 | + case self::XLS_Type_BOOLERR: $this->_readBoolErr(); break; |
|
| 900 | + case self::XLS_Type_MULBLANK: $this->_readMulBlank(); break; |
|
| 901 | + case self::XLS_Type_LABEL: $this->_readLabel(); break; |
|
| 902 | + case self::XLS_Type_BLANK: $this->_readBlank(); break; |
|
| 903 | + case self::XLS_Type_MSODRAWING: $this->_readMsoDrawing(); break; |
|
| 904 | + case self::XLS_Type_OBJ: $this->_readObj(); break; |
|
| 905 | + case self::XLS_Type_WINDOW2: $this->_readWindow2(); break; |
|
| 906 | + case self::XLS_Type_SCL: $this->_readScl(); break; |
|
| 907 | + case self::XLS_Type_PANE: $this->_readPane(); break; |
|
| 908 | + case self::XLS_Type_SELECTION: $this->_readSelection(); break; |
|
| 909 | + case self::XLS_Type_MERGEDCELLS: $this->_readMergedCells(); break; |
|
| 910 | + case self::XLS_Type_HYPERLINK: $this->_readHyperLink(); break; |
|
| 911 | + case self::XLS_Type_DATAVALIDATIONS: $this->_readDataValidations(); break; |
|
| 912 | + case self::XLS_Type_DATAVALIDATION: $this->_readDataValidation(); break; |
|
| 913 | + case self::XLS_Type_SHEETLAYOUT: $this->_readSheetLayout(); break; |
|
| 914 | + case self::XLS_Type_SHEETPROTECTION: $this->_readSheetProtection(); break; |
|
| 915 | + case self::XLS_Type_RANGEPROTECTION: $this->_readRangeProtection(); break; |
|
| 916 | + case self::XLS_Type_NOTE: $this->_readNote(); break; |
|
| 917 | 917 | //case self::XLS_Type_IMDATA: $this->_readImData(); break; |
| 918 | - case self::XLS_Type_TXO: $this->_readTextObject(); break; |
|
| 919 | - case self::XLS_Type_CONTINUE: $this->_readContinue(); break; |
|
| 920 | - case self::XLS_Type_EOF: $this->_readDefault(); break 2; |
|
| 921 | - default: $this->_readDefault(); break; |
|
| 918 | + case self::XLS_Type_TXO: $this->_readTextObject(); break; |
|
| 919 | + case self::XLS_Type_CONTINUE: $this->_readContinue(); break; |
|
| 920 | + case self::XLS_Type_EOF: $this->_readDefault(); break 2; |
|
| 921 | + default: $this->_readDefault(); break; |
|
| 922 | 922 | } |
| 923 | 923 | |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | // treat MSODRAWING records, sheet-level Escher |
| 927 | - if (!$this->_readDataOnly && $this->_drawingData) { |
|
| 927 | + if ( ! $this->_readDataOnly && $this->_drawingData) { |
|
| 928 | 928 | $escherWorksheet = new PHPExcel_Shared_Escher(); |
| 929 | 929 | $reader = new PHPExcel_Reader_Excel5_Escher($escherWorksheet); |
| 930 | 930 | $escherWorksheet = $reader->load($this->_drawingData); |
@@ -1046,22 +1046,22 @@ discard block |
||
| 1046 | 1046 | if ($this->_version == self::XLS_BIFF8) { |
| 1047 | 1047 | foreach ($this->_sharedFormulaParts as $cell => $baseCell) { |
| 1048 | 1048 | list($column, $row) = PHPExcel_Cell::coordinateFromString($cell); |
| 1049 | - if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($column, $row, $this->_phpSheet->getTitle()) ) { |
|
| 1049 | + if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($column, $row, $this->_phpSheet->getTitle())) { |
|
| 1050 | 1050 | $formula = $this->_getFormulaFromStructure($this->_sharedFormulas[$baseCell], $cell); |
| 1051 | - $this->_phpSheet->getCell($cell)->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA); |
|
| 1051 | + $this->_phpSheet->getCell($cell)->setValueExplicit('='.$formula, PHPExcel_Cell_DataType::TYPE_FORMULA); |
|
| 1052 | 1052 | } |
| 1053 | 1053 | } |
| 1054 | 1054 | } |
| 1055 | 1055 | |
| 1056 | - if (!empty($this->_cellNotes)) { |
|
| 1057 | - foreach($this->_cellNotes as $note => $noteDetails) { |
|
| 1056 | + if ( ! empty($this->_cellNotes)) { |
|
| 1057 | + foreach ($this->_cellNotes as $note => $noteDetails) { |
|
| 1058 | 1058 | // echo '<b>Cell annotation ',$note,'</b><br />'; |
| 1059 | 1059 | // var_dump($noteDetails); |
| 1060 | 1060 | // echo '<br />'; |
| 1061 | - $cellAddress = str_replace('$','',$noteDetails['cellRef']); |
|
| 1062 | - $this->_phpSheet->getComment( $cellAddress ) |
|
| 1063 | - ->setAuthor( $noteDetails['author'] ) |
|
| 1064 | - ->setText($this->_parseRichText($noteDetails['objTextData']['text']) ); |
|
| 1061 | + $cellAddress = str_replace('$', '', $noteDetails['cellRef']); |
|
| 1062 | + $this->_phpSheet->getComment($cellAddress) |
|
| 1063 | + ->setAuthor($noteDetails['author']) |
|
| 1064 | + ->setText($this->_parseRichText($noteDetails['objTextData']['text'])); |
|
| 1065 | 1065 | } |
| 1066 | 1066 | } |
| 1067 | 1067 | } |
@@ -1083,7 +1083,7 @@ discard block |
||
| 1083 | 1083 | // Foo!$C$7:$J$66 |
| 1084 | 1084 | // Bar!$A$1:$IV$2 |
| 1085 | 1085 | |
| 1086 | - $explodes = explode('!', $range); // FIXME: what if sheetname contains exclamation mark? |
|
| 1086 | + $explodes = explode('!', $range); // FIXME: what if sheetname contains exclamation mark? |
|
| 1087 | 1087 | $sheetName = $explodes[0]; |
| 1088 | 1088 | |
| 1089 | 1089 | if (count($explodes) == 2) { |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | |
| 1148 | 1148 | if (count($explodes) == 2) { |
| 1149 | 1149 | if (($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) || |
| 1150 | - ($docSheet = $this->_phpExcel->getSheetByName(trim($explodes[0],"'")))) { |
|
| 1150 | + ($docSheet = $this->_phpExcel->getSheetByName(trim($explodes[0], "'")))) { |
|
| 1151 | 1151 | $extractedRange = $explodes[1]; |
| 1152 | 1152 | $extractedRange = str_replace('$', '', $extractedRange); |
| 1153 | 1153 | |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | $scope = ($definedName['scope'] == 0) ? |
| 1157 | 1157 | null : $this->_phpExcel->getSheetByName($this->_sheets[$definedName['scope'] - 1]['name']); |
| 1158 | 1158 | |
| 1159 | - $this->_phpExcel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $docSheet, $extractedRange, $localOnly, $scope) ); |
|
| 1159 | + $this->_phpExcel->addNamedRange(new PHPExcel_NamedRange((string) $definedName['name'], $docSheet, $extractedRange, $localOnly, $scope)); |
|
| 1160 | 1160 | } |
| 1161 | 1161 | } else { |
| 1162 | 1162 | // Named Value |
@@ -1200,7 +1200,7 @@ discard block |
||
| 1200 | 1200 | */ |
| 1201 | 1201 | private function _readSummaryInformation() |
| 1202 | 1202 | { |
| 1203 | - if (!isset($this->_summaryInformation)) { |
|
| 1203 | + if ( ! isset($this->_summaryInformation)) { |
|
| 1204 | 1204 | return; |
| 1205 | 1205 | } |
| 1206 | 1206 | |
@@ -1221,7 +1221,7 @@ discard block |
||
| 1221 | 1221 | $secLength = self::_GetInt4d($this->_summaryInformation, $secOffset); |
| 1222 | 1222 | |
| 1223 | 1223 | // offset: $secOffset+4; size: 4; property count |
| 1224 | - $countProperties = self::_GetInt4d($this->_summaryInformation, $secOffset+4); |
|
| 1224 | + $countProperties = self::_GetInt4d($this->_summaryInformation, $secOffset + 4); |
|
| 1225 | 1225 | |
| 1226 | 1226 | // initialize code page (used to resolve string values) |
| 1227 | 1227 | $codePage = 'CP1252'; |
@@ -1231,11 +1231,11 @@ discard block |
||
| 1231 | 1231 | for ($i = 0; $i < $countProperties; ++$i) { |
| 1232 | 1232 | |
| 1233 | 1233 | // offset: ($secOffset+8) + (8 * $i); size: 4; property ID |
| 1234 | - $id = self::_GetInt4d($this->_summaryInformation, ($secOffset+8) + (8 * $i)); |
|
| 1234 | + $id = self::_GetInt4d($this->_summaryInformation, ($secOffset + 8) + (8 * $i)); |
|
| 1235 | 1235 | |
| 1236 | 1236 | // Use value of property id as appropriate |
| 1237 | 1237 | // offset: ($secOffset+12) + (8 * $i); size: 4; offset from beginning of section (48) |
| 1238 | - $offset = self::_GetInt4d($this->_summaryInformation, ($secOffset+12) + (8 * $i)); |
|
| 1238 | + $offset = self::_GetInt4d($this->_summaryInformation, ($secOffset + 12) + (8 * $i)); |
|
| 1239 | 1239 | |
| 1240 | 1240 | $type = self::_GetInt4d($this->_summaryInformation, $secOffset + $offset); |
| 1241 | 1241 | |
@@ -1360,7 +1360,7 @@ discard block |
||
| 1360 | 1360 | */ |
| 1361 | 1361 | private function _readDocumentSummaryInformation() |
| 1362 | 1362 | { |
| 1363 | - if (!isset($this->_documentSummaryInformation)) { |
|
| 1363 | + if ( ! isset($this->_documentSummaryInformation)) { |
|
| 1364 | 1364 | return; |
| 1365 | 1365 | } |
| 1366 | 1366 | |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | // echo '$secLength = ',$secLength,'<br />'; |
| 1385 | 1385 | |
| 1386 | 1386 | // offset: $secOffset+4; size: 4; property count |
| 1387 | - $countProperties = self::_GetInt4d($this->_documentSummaryInformation, $secOffset+4); |
|
| 1387 | + $countProperties = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + 4); |
|
| 1388 | 1388 | // echo '$countProperties = ',$countProperties,'<br />'; |
| 1389 | 1389 | |
| 1390 | 1390 | // initialize code page (used to resolve string values) |
@@ -1395,12 +1395,12 @@ discard block |
||
| 1395 | 1395 | for ($i = 0; $i < $countProperties; ++$i) { |
| 1396 | 1396 | // echo 'Property ',$i,'<br />'; |
| 1397 | 1397 | // offset: ($secOffset+8) + (8 * $i); size: 4; property ID |
| 1398 | - $id = self::_GetInt4d($this->_documentSummaryInformation, ($secOffset+8) + (8 * $i)); |
|
| 1398 | + $id = self::_GetInt4d($this->_documentSummaryInformation, ($secOffset + 8) + (8 * $i)); |
|
| 1399 | 1399 | // echo 'ID is ',$id,'<br />'; |
| 1400 | 1400 | |
| 1401 | 1401 | // Use value of property id as appropriate |
| 1402 | 1402 | // offset: 60 + 8 * $i; size: 4; offset from beginning of section (48) |
| 1403 | - $offset = self::_GetInt4d($this->_documentSummaryInformation, ($secOffset+12) + (8 * $i)); |
|
| 1403 | + $offset = self::_GetInt4d($this->_documentSummaryInformation, ($secOffset + 12) + (8 * $i)); |
|
| 1404 | 1404 | |
| 1405 | 1405 | $type = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + $offset); |
| 1406 | 1406 | // echo 'Type is ',$type,', '; |
@@ -1569,7 +1569,7 @@ discard block |
||
| 1569 | 1569 | } |
| 1570 | 1570 | // echo 'Note Address=',$cellAddress,'<br />'; |
| 1571 | 1571 | |
| 1572 | - $cellAddress = str_replace('$','',$cellAddress); |
|
| 1572 | + $cellAddress = str_replace('$', '', $cellAddress); |
|
| 1573 | 1573 | $noteLength = self::_GetInt2d($recordData, 4); |
| 1574 | 1574 | $noteText = trim(substr($recordData, 6)); |
| 1575 | 1575 | // echo 'Note Length=',$noteLength,'<br />'; |
@@ -1577,14 +1577,14 @@ discard block |
||
| 1577 | 1577 | |
| 1578 | 1578 | if ($extension) { |
| 1579 | 1579 | // Concatenate this extension with the currently set comment for the cell |
| 1580 | - $comment = $this->_phpSheet->getComment( $cellAddress ); |
|
| 1580 | + $comment = $this->_phpSheet->getComment($cellAddress); |
|
| 1581 | 1581 | $commentText = $comment->getText()->getPlainText(); |
| 1582 | - $comment->setText($this->_parseRichText($commentText.$noteText) ); |
|
| 1582 | + $comment->setText($this->_parseRichText($commentText.$noteText)); |
|
| 1583 | 1583 | } else { |
| 1584 | 1584 | // Set comment for the cell |
| 1585 | - $this->_phpSheet->getComment( $cellAddress ) |
|
| 1585 | + $this->_phpSheet->getComment($cellAddress) |
|
| 1586 | 1586 | // ->setAuthor( $author ) |
| 1587 | - ->setText($this->_parseRichText($noteText) ); |
|
| 1587 | + ->setText($this->_parseRichText($noteText)); |
|
| 1588 | 1588 | } |
| 1589 | 1589 | } |
| 1590 | 1590 | |
@@ -1612,15 +1612,15 @@ discard block |
||
| 1612 | 1612 | // cchText: 2 bytes; length of the text (in the first continue record) |
| 1613 | 1613 | // cbRuns: 2 bytes; length of the formatting (in the second continue record) |
| 1614 | 1614 | // followed by the continuation records containing the actual text and formatting |
| 1615 | - $grbitOpts = self::_GetInt2d($recordData, 0); |
|
| 1616 | - $rot = self::_GetInt2d($recordData, 2); |
|
| 1615 | + $grbitOpts = self::_GetInt2d($recordData, 0); |
|
| 1616 | + $rot = self::_GetInt2d($recordData, 2); |
|
| 1617 | 1617 | $cchText = self::_GetInt2d($recordData, 10); |
| 1618 | 1618 | $cbRuns = self::_GetInt2d($recordData, 12); |
| 1619 | - $text = $this->_getSplicedRecordData(); |
|
| 1619 | + $text = $this->_getSplicedRecordData(); |
|
| 1620 | 1620 | |
| 1621 | 1621 | $this->_textObjects[$this->textObjRef] = array( |
| 1622 | - 'text' => substr($text["recordData"],$text["spliceOffsets"][0]+1,$cchText), |
|
| 1623 | - 'format' => substr($text["recordData"],$text["spliceOffsets"][1],$cbRuns), |
|
| 1622 | + 'text' => substr($text["recordData"], $text["spliceOffsets"][0] + 1, $cchText), |
|
| 1623 | + 'format' => substr($text["recordData"], $text["spliceOffsets"][1], $cbRuns), |
|
| 1624 | 1624 | 'alignment' => $grbitOpts, |
| 1625 | 1625 | 'rotation' => $rot |
| 1626 | 1626 | ); |
@@ -1757,7 +1757,7 @@ discard block |
||
| 1757 | 1757 | // move stream pointer to next record |
| 1758 | 1758 | $this->_pos += 4 + $length; |
| 1759 | 1759 | |
| 1760 | - if (!$this->_readDataOnly) { |
|
| 1760 | + if ( ! $this->_readDataOnly) { |
|
| 1761 | 1761 | $objFont = new PHPExcel_Style_Font(); |
| 1762 | 1762 | |
| 1763 | 1763 | // offset: 0; size: 2; height of the font (in twips = 1/20 of a point) |
@@ -1855,7 +1855,7 @@ discard block |
||
| 1855 | 1855 | // move stream pointer to next record |
| 1856 | 1856 | $this->_pos += 4 + $length; |
| 1857 | 1857 | |
| 1858 | - if (!$this->_readDataOnly) { |
|
| 1858 | + if ( ! $this->_readDataOnly) { |
|
| 1859 | 1859 | $indexCode = self::_GetInt2d($recordData, 0); |
| 1860 | 1860 | |
| 1861 | 1861 | if ($this->_version == self::XLS_BIFF8) { |
@@ -1895,7 +1895,7 @@ discard block |
||
| 1895 | 1895 | |
| 1896 | 1896 | $objStyle = new PHPExcel_Style(); |
| 1897 | 1897 | |
| 1898 | - if (!$this->_readDataOnly) { |
|
| 1898 | + if ( ! $this->_readDataOnly) { |
|
| 1899 | 1899 | // offset: 0; size: 2; Index to FONT record |
| 1900 | 1900 | if (self::_GetInt2d($recordData, 0) < 4) { |
| 1901 | 1901 | $fontIndex = self::_GetInt2d($recordData, 0); |
@@ -2176,7 +2176,7 @@ discard block |
||
| 2176 | 2176 | // move stream pointer to next record |
| 2177 | 2177 | $this->_pos += 4 + $length; |
| 2178 | 2178 | |
| 2179 | - if (!$this->_readDataOnly) { |
|
| 2179 | + if ( ! $this->_readDataOnly) { |
|
| 2180 | 2180 | // offset: 0; size: 2; 0x087D = repeated header |
| 2181 | 2181 | |
| 2182 | 2182 | // offset: 2; size: 2 |
@@ -2214,7 +2214,7 @@ discard block |
||
| 2214 | 2214 | $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
| 2215 | 2215 | |
| 2216 | 2216 | // modify the relevant style property |
| 2217 | - if ( isset($this->_mapCellXfIndex[$ixfe]) ) { |
|
| 2217 | + if (isset($this->_mapCellXfIndex[$ixfe])) { |
|
| 2218 | 2218 | $fill = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getFill(); |
| 2219 | 2219 | $fill->getStartColor()->setRGB($rgb); |
| 2220 | 2220 | unset($fill->startcolorIndex); // normal color index does not apply, discard |
@@ -2230,7 +2230,7 @@ discard block |
||
| 2230 | 2230 | $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
| 2231 | 2231 | |
| 2232 | 2232 | // modify the relevant style property |
| 2233 | - if ( isset($this->_mapCellXfIndex[$ixfe]) ) { |
|
| 2233 | + if (isset($this->_mapCellXfIndex[$ixfe])) { |
|
| 2234 | 2234 | $fill = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getFill(); |
| 2235 | 2235 | $fill->getEndColor()->setRGB($rgb); |
| 2236 | 2236 | unset($fill->endcolorIndex); // normal color index does not apply, discard |
@@ -2246,7 +2246,7 @@ discard block |
||
| 2246 | 2246 | $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
| 2247 | 2247 | |
| 2248 | 2248 | // modify the relevant style property |
| 2249 | - if ( isset($this->_mapCellXfIndex[$ixfe]) ) { |
|
| 2249 | + if (isset($this->_mapCellXfIndex[$ixfe])) { |
|
| 2250 | 2250 | $top = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getBorders()->getTop(); |
| 2251 | 2251 | $top->getColor()->setRGB($rgb); |
| 2252 | 2252 | unset($top->colorIndex); // normal color index does not apply, discard |
@@ -2262,7 +2262,7 @@ discard block |
||
| 2262 | 2262 | $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
| 2263 | 2263 | |
| 2264 | 2264 | // modify the relevant style property |
| 2265 | - if ( isset($this->_mapCellXfIndex[$ixfe]) ) { |
|
| 2265 | + if (isset($this->_mapCellXfIndex[$ixfe])) { |
|
| 2266 | 2266 | $bottom = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getBorders()->getBottom(); |
| 2267 | 2267 | $bottom->getColor()->setRGB($rgb); |
| 2268 | 2268 | unset($bottom->colorIndex); // normal color index does not apply, discard |
@@ -2278,7 +2278,7 @@ discard block |
||
| 2278 | 2278 | $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
| 2279 | 2279 | |
| 2280 | 2280 | // modify the relevant style property |
| 2281 | - if ( isset($this->_mapCellXfIndex[$ixfe]) ) { |
|
| 2281 | + if (isset($this->_mapCellXfIndex[$ixfe])) { |
|
| 2282 | 2282 | $left = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getBorders()->getLeft(); |
| 2283 | 2283 | $left->getColor()->setRGB($rgb); |
| 2284 | 2284 | unset($left->colorIndex); // normal color index does not apply, discard |
@@ -2294,7 +2294,7 @@ discard block |
||
| 2294 | 2294 | $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
| 2295 | 2295 | |
| 2296 | 2296 | // modify the relevant style property |
| 2297 | - if ( isset($this->_mapCellXfIndex[$ixfe]) ) { |
|
| 2297 | + if (isset($this->_mapCellXfIndex[$ixfe])) { |
|
| 2298 | 2298 | $right = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getBorders()->getRight(); |
| 2299 | 2299 | $right->getColor()->setRGB($rgb); |
| 2300 | 2300 | unset($right->colorIndex); // normal color index does not apply, discard |
@@ -2310,7 +2310,7 @@ discard block |
||
| 2310 | 2310 | $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
| 2311 | 2311 | |
| 2312 | 2312 | // modify the relevant style property |
| 2313 | - if ( isset($this->_mapCellXfIndex[$ixfe]) ) { |
|
| 2313 | + if (isset($this->_mapCellXfIndex[$ixfe])) { |
|
| 2314 | 2314 | $diagonal = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getBorders()->getDiagonal(); |
| 2315 | 2315 | $diagonal->getColor()->setRGB($rgb); |
| 2316 | 2316 | unset($diagonal->colorIndex); // normal color index does not apply, discard |
@@ -2326,7 +2326,7 @@ discard block |
||
| 2326 | 2326 | $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
| 2327 | 2327 | |
| 2328 | 2328 | // modify the relevant style property |
| 2329 | - if ( isset($this->_mapCellXfIndex[$ixfe]) ) { |
|
| 2329 | + if (isset($this->_mapCellXfIndex[$ixfe])) { |
|
| 2330 | 2330 | $font = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getFont(); |
| 2331 | 2331 | $font->getColor()->setRGB($rgb); |
| 2332 | 2332 | unset($font->colorIndex); // normal color index does not apply, discard |
@@ -2353,7 +2353,7 @@ discard block |
||
| 2353 | 2353 | // move stream pointer to next record |
| 2354 | 2354 | $this->_pos += 4 + $length; |
| 2355 | 2355 | |
| 2356 | - if (!$this->_readDataOnly) { |
|
| 2356 | + if ( ! $this->_readDataOnly) { |
|
| 2357 | 2357 | // offset: 0; size: 2; index to XF record and flag for built-in style |
| 2358 | 2358 | $ixfe = self::_GetInt2d($recordData, 0); |
| 2359 | 2359 | |
@@ -2394,7 +2394,7 @@ discard block |
||
| 2394 | 2394 | // move stream pointer to next record |
| 2395 | 2395 | $this->_pos += 4 + $length; |
| 2396 | 2396 | |
| 2397 | - if (!$this->_readDataOnly) { |
|
| 2397 | + if ( ! $this->_readDataOnly) { |
|
| 2398 | 2398 | // offset: 0; size: 2; number of following colors |
| 2399 | 2399 | $nm = self::_GetInt2d($recordData, 0); |
| 2400 | 2400 | |
@@ -2432,10 +2432,10 @@ discard block |
||
| 2432 | 2432 | |
| 2433 | 2433 | // offset: 4; size: 1; sheet state |
| 2434 | 2434 | switch (ord($recordData{4})) { |
| 2435 | - case 0x00: $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE; break; |
|
| 2436 | - case 0x01: $sheetState = PHPExcel_Worksheet::SHEETSTATE_HIDDEN; break; |
|
| 2435 | + case 0x00: $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE; break; |
|
| 2436 | + case 0x01: $sheetState = PHPExcel_Worksheet::SHEETSTATE_HIDDEN; break; |
|
| 2437 | 2437 | case 0x02: $sheetState = PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN; break; |
| 2438 | - default: $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE; break; |
|
| 2438 | + default: $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE; break; |
|
| 2439 | 2439 | } |
| 2440 | 2440 | |
| 2441 | 2441 | // offset: 5; size: 1; sheet type |
@@ -2632,7 +2632,7 @@ discard block |
||
| 2632 | 2632 | |
| 2633 | 2633 | // offset: var; size: $flen; formula data |
| 2634 | 2634 | $offset = 14 + $string['size']; |
| 2635 | - $formulaStructure = pack('v', $flen) . substr($recordData, $offset); |
|
| 2635 | + $formulaStructure = pack('v', $flen).substr($recordData, $offset); |
|
| 2636 | 2636 | |
| 2637 | 2637 | try { |
| 2638 | 2638 | $formula = $this->_getFormulaFromStructure($formulaStructure); |
@@ -2706,7 +2706,7 @@ discard block |
||
| 2706 | 2706 | ++$pos; |
| 2707 | 2707 | |
| 2708 | 2708 | // bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed |
| 2709 | - $isCompressed = (($optionFlags & 0x01) == 0) ; |
|
| 2709 | + $isCompressed = (($optionFlags & 0x01) == 0); |
|
| 2710 | 2710 | |
| 2711 | 2711 | // bit: 2; mask: 0x02; 0 = ordinary; 1 = Asian phonetic |
| 2712 | 2712 | $hasAsian = (($optionFlags & 0x04) != 0); |
@@ -2782,7 +2782,7 @@ discard block |
||
| 2782 | 2782 | $charsLeft -= $len; |
| 2783 | 2783 | $isCompressed = true; |
| 2784 | 2784 | |
| 2785 | - } elseif (!$isCompressed && ($option != 0)) { |
|
| 2785 | + } elseif ( ! $isCompressed && ($option != 0)) { |
|
| 2786 | 2786 | // 1st fragment uncompressed |
| 2787 | 2787 | // this fragment uncompressed |
| 2788 | 2788 | $len = min($charsLeft * 2, $limitpos - $pos); |
@@ -2790,12 +2790,12 @@ discard block |
||
| 2790 | 2790 | $charsLeft -= $len / 2; |
| 2791 | 2791 | $isCompressed = false; |
| 2792 | 2792 | |
| 2793 | - } elseif (!$isCompressed && ($option == 0)) { |
|
| 2793 | + } elseif ( ! $isCompressed && ($option == 0)) { |
|
| 2794 | 2794 | // 1st fragment uncompressed |
| 2795 | 2795 | // this fragment compressed |
| 2796 | 2796 | $len = min($charsLeft, $limitpos - $pos); |
| 2797 | 2797 | for ($j = 0; $j < $len; ++$j) { |
| 2798 | - $retstr .= $recordData{$pos + $j} . chr(0); |
|
| 2798 | + $retstr .= $recordData{$pos + $j}.chr(0); |
|
| 2799 | 2799 | } |
| 2800 | 2800 | $charsLeft -= $len; |
| 2801 | 2801 | $isCompressed = false; |
@@ -2805,7 +2805,7 @@ discard block |
||
| 2805 | 2805 | // this fragment uncompressed |
| 2806 | 2806 | $newstr = ''; |
| 2807 | 2807 | for ($j = 0; $j < strlen($retstr); ++$j) { |
| 2808 | - $newstr .= $retstr[$j] . chr(0); |
|
| 2808 | + $newstr .= $retstr[$j].chr(0); |
|
| 2809 | 2809 | } |
| 2810 | 2810 | $retstr = $newstr; |
| 2811 | 2811 | $len = min($charsLeft * 2, $limitpos - $pos); |
@@ -2868,7 +2868,7 @@ discard block |
||
| 2868 | 2868 | // move stream pointer to next record |
| 2869 | 2869 | $this->_pos += 4 + $length; |
| 2870 | 2870 | |
| 2871 | - if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { |
|
| 2871 | + if ($this->_version == self::XLS_BIFF8 && ! $this->_readDataOnly) { |
|
| 2872 | 2872 | // offset: 0; size: 2; 0 = do not print sheet grid lines; 1 = print sheet gridlines |
| 2873 | 2873 | $printGridlines = (bool) self::_GetInt2d($recordData, 0); |
| 2874 | 2874 | $this->_phpSheet->setPrintGridlines($printGridlines); |
@@ -2932,7 +2932,7 @@ discard block |
||
| 2932 | 2932 | // move stream pointer to next record |
| 2933 | 2933 | $this->_pos += 4 + $length; |
| 2934 | 2934 | |
| 2935 | - if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { |
|
| 2935 | + if ($this->_version == self::XLS_BIFF8 && ! $this->_readDataOnly) { |
|
| 2936 | 2936 | |
| 2937 | 2937 | // offset: 0; size: 2; number of the following row index structures |
| 2938 | 2938 | $nm = self::_GetInt2d($recordData, 0); |
@@ -2961,7 +2961,7 @@ discard block |
||
| 2961 | 2961 | // move stream pointer to next record |
| 2962 | 2962 | $this->_pos += 4 + $length; |
| 2963 | 2963 | |
| 2964 | - if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { |
|
| 2964 | + if ($this->_version == self::XLS_BIFF8 && ! $this->_readDataOnly) { |
|
| 2965 | 2965 | // offset: 0; size: 2; number of the following column index structures |
| 2966 | 2966 | $nm = self::_GetInt2d($recordData, 0); |
| 2967 | 2967 | |
@@ -2989,7 +2989,7 @@ discard block |
||
| 2989 | 2989 | // move stream pointer to next record |
| 2990 | 2990 | $this->_pos += 4 + $length; |
| 2991 | 2991 | |
| 2992 | - if (!$this->_readDataOnly) { |
|
| 2992 | + if ( ! $this->_readDataOnly) { |
|
| 2993 | 2993 | // offset: 0; size: var |
| 2994 | 2994 | // realized that $recordData can be empty even when record exists |
| 2995 | 2995 | if ($recordData) { |
@@ -3017,7 +3017,7 @@ discard block |
||
| 3017 | 3017 | // move stream pointer to next record |
| 3018 | 3018 | $this->_pos += 4 + $length; |
| 3019 | 3019 | |
| 3020 | - if (!$this->_readDataOnly) { |
|
| 3020 | + if ( ! $this->_readDataOnly) { |
|
| 3021 | 3021 | // offset: 0; size: var |
| 3022 | 3022 | // realized that $recordData can be empty even when record exists |
| 3023 | 3023 | if ($recordData) { |
@@ -3044,7 +3044,7 @@ discard block |
||
| 3044 | 3044 | // move stream pointer to next record |
| 3045 | 3045 | $this->_pos += 4 + $length; |
| 3046 | 3046 | |
| 3047 | - if (!$this->_readDataOnly) { |
|
| 3047 | + if ( ! $this->_readDataOnly) { |
|
| 3048 | 3048 | // offset: 0; size: 2; 0 = print sheet left aligned, 1 = print sheet centered horizontally |
| 3049 | 3049 | $isHorizontalCentered = (bool) self::_GetInt2d($recordData, 0); |
| 3050 | 3050 | |
@@ -3064,7 +3064,7 @@ discard block |
||
| 3064 | 3064 | // move stream pointer to next record |
| 3065 | 3065 | $this->_pos += 4 + $length; |
| 3066 | 3066 | |
| 3067 | - if (!$this->_readDataOnly) { |
|
| 3067 | + if ( ! $this->_readDataOnly) { |
|
| 3068 | 3068 | // offset: 0; size: 2; 0 = print sheet aligned at top page border, 1 = print sheet vertically centered |
| 3069 | 3069 | $isVerticalCentered = (bool) self::_GetInt2d($recordData, 0); |
| 3070 | 3070 | |
@@ -3084,7 +3084,7 @@ discard block |
||
| 3084 | 3084 | // move stream pointer to next record |
| 3085 | 3085 | $this->_pos += 4 + $length; |
| 3086 | 3086 | |
| 3087 | - if (!$this->_readDataOnly) { |
|
| 3087 | + if ( ! $this->_readDataOnly) { |
|
| 3088 | 3088 | // offset: 0; size: 8 |
| 3089 | 3089 | $this->_phpSheet->getPageMargins()->setLeft(self::_extractNumber($recordData)); |
| 3090 | 3090 | } |
@@ -3102,7 +3102,7 @@ discard block |
||
| 3102 | 3102 | // move stream pointer to next record |
| 3103 | 3103 | $this->_pos += 4 + $length; |
| 3104 | 3104 | |
| 3105 | - if (!$this->_readDataOnly) { |
|
| 3105 | + if ( ! $this->_readDataOnly) { |
|
| 3106 | 3106 | // offset: 0; size: 8 |
| 3107 | 3107 | $this->_phpSheet->getPageMargins()->setRight(self::_extractNumber($recordData)); |
| 3108 | 3108 | } |
@@ -3120,7 +3120,7 @@ discard block |
||
| 3120 | 3120 | // move stream pointer to next record |
| 3121 | 3121 | $this->_pos += 4 + $length; |
| 3122 | 3122 | |
| 3123 | - if (!$this->_readDataOnly) { |
|
| 3123 | + if ( ! $this->_readDataOnly) { |
|
| 3124 | 3124 | // offset: 0; size: 8 |
| 3125 | 3125 | $this->_phpSheet->getPageMargins()->setTop(self::_extractNumber($recordData)); |
| 3126 | 3126 | } |
@@ -3138,7 +3138,7 @@ discard block |
||
| 3138 | 3138 | // move stream pointer to next record |
| 3139 | 3139 | $this->_pos += 4 + $length; |
| 3140 | 3140 | |
| 3141 | - if (!$this->_readDataOnly) { |
|
| 3141 | + if ( ! $this->_readDataOnly) { |
|
| 3142 | 3142 | // offset: 0; size: 8 |
| 3143 | 3143 | $this->_phpSheet->getPageMargins()->setBottom(self::_extractNumber($recordData)); |
| 3144 | 3144 | } |
@@ -3156,7 +3156,7 @@ discard block |
||
| 3156 | 3156 | // move stream pointer to next record |
| 3157 | 3157 | $this->_pos += 4 + $length; |
| 3158 | 3158 | |
| 3159 | - if (!$this->_readDataOnly) { |
|
| 3159 | + if ( ! $this->_readDataOnly) { |
|
| 3160 | 3160 | // offset: 0; size: 2; paper size |
| 3161 | 3161 | $paperSize = self::_GetInt2d($recordData, 0); |
| 3162 | 3162 | |
@@ -3178,7 +3178,7 @@ discard block |
||
| 3178 | 3178 | // when this bit is set, do not use flags for those properties |
| 3179 | 3179 | $isNotInit = (0x0004 & self::_GetInt2d($recordData, 10)) >> 2; |
| 3180 | 3180 | |
| 3181 | - if (!$isNotInit) { |
|
| 3181 | + if ( ! $isNotInit) { |
|
| 3182 | 3182 | $this->_phpSheet->getPageSetup()->setPaperSize($paperSize); |
| 3183 | 3183 | switch ($isPortrait) { |
| 3184 | 3184 | case 0: $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); break; |
@@ -3222,7 +3222,7 @@ discard block |
||
| 3222 | 3222 | |
| 3223 | 3223 | // bit 0, mask 0x01; 1 = sheet is protected |
| 3224 | 3224 | $bool = (0x01 & self::_GetInt2d($recordData, 0)) >> 0; |
| 3225 | - $this->_phpSheet->getProtection()->setSheet((bool)$bool); |
|
| 3225 | + $this->_phpSheet->getProtection()->setSheet((bool) $bool); |
|
| 3226 | 3226 | } |
| 3227 | 3227 | |
| 3228 | 3228 | |
@@ -3246,7 +3246,7 @@ discard block |
||
| 3246 | 3246 | // bit: 0, mask 0x01; 1 = scenarios are protected |
| 3247 | 3247 | $bool = (0x01 & self::_GetInt2d($recordData, 0)) >> 0; |
| 3248 | 3248 | |
| 3249 | - $this->_phpSheet->getProtection()->setScenarios((bool)$bool); |
|
| 3249 | + $this->_phpSheet->getProtection()->setScenarios((bool) $bool); |
|
| 3250 | 3250 | } |
| 3251 | 3251 | |
| 3252 | 3252 | |
@@ -3270,7 +3270,7 @@ discard block |
||
| 3270 | 3270 | // bit: 0, mask 0x01; 1 = objects are protected |
| 3271 | 3271 | $bool = (0x01 & self::_GetInt2d($recordData, 0)) >> 0; |
| 3272 | 3272 | |
| 3273 | - $this->_phpSheet->getProtection()->setObjects((bool)$bool); |
|
| 3273 | + $this->_phpSheet->getProtection()->setObjects((bool) $bool); |
|
| 3274 | 3274 | } |
| 3275 | 3275 | |
| 3276 | 3276 | |
@@ -3285,7 +3285,7 @@ discard block |
||
| 3285 | 3285 | // move stream pointer to next record |
| 3286 | 3286 | $this->_pos += 4 + $length; |
| 3287 | 3287 | |
| 3288 | - if (!$this->_readDataOnly) { |
|
| 3288 | + if ( ! $this->_readDataOnly) { |
|
| 3289 | 3289 | // offset: 0; size: 2; 16-bit hash value of password |
| 3290 | 3290 | $password = strtoupper(dechex(self::_GetInt2d($recordData, 0))); // the hashed password |
| 3291 | 3291 | $this->_phpSheet->getProtection()->setPassword($password, true); |
@@ -3323,7 +3323,7 @@ discard block |
||
| 3323 | 3323 | // move stream pointer to next record |
| 3324 | 3324 | $this->_pos += 4 + $length; |
| 3325 | 3325 | |
| 3326 | - if (!$this->_readDataOnly) { |
|
| 3326 | + if ( ! $this->_readDataOnly) { |
|
| 3327 | 3327 | // offset: 0; size: 2; index to first column in range |
| 3328 | 3328 | $fc = self::_GetInt2d($recordData, 0); // first column index |
| 3329 | 3329 | |
@@ -3355,7 +3355,7 @@ discard block |
||
| 3355 | 3355 | break; |
| 3356 | 3356 | } |
| 3357 | 3357 | $this->_phpSheet->getColumnDimensionByColumn($i)->setWidth($width / 256); |
| 3358 | - $this->_phpSheet->getColumnDimensionByColumn($i)->setVisible(!$isHidden); |
|
| 3358 | + $this->_phpSheet->getColumnDimensionByColumn($i)->setVisible( ! $isHidden); |
|
| 3359 | 3359 | $this->_phpSheet->getColumnDimensionByColumn($i)->setOutlineLevel($level); |
| 3360 | 3360 | $this->_phpSheet->getColumnDimensionByColumn($i)->setCollapsed($isCollapsed); |
| 3361 | 3361 | $this->_phpSheet->getColumnDimensionByColumn($i)->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
@@ -3382,7 +3382,7 @@ discard block |
||
| 3382 | 3382 | // move stream pointer to next record |
| 3383 | 3383 | $this->_pos += 4 + $length; |
| 3384 | 3384 | |
| 3385 | - if (!$this->_readDataOnly) { |
|
| 3385 | + if ( ! $this->_readDataOnly) { |
|
| 3386 | 3386 | // offset: 0; size: 2; index of this row |
| 3387 | 3387 | $r = self::_GetInt2d($recordData, 0); |
| 3388 | 3388 | |
@@ -3398,7 +3398,7 @@ discard block |
||
| 3398 | 3398 | // bit: 15: mask: 0x8000; 0 = row has custom height; 1= row has default height |
| 3399 | 3399 | $useDefaultHeight = (0x8000 & self::_GetInt2d($recordData, 6)) >> 15; |
| 3400 | 3400 | |
| 3401 | - if (!$useDefaultHeight) { |
|
| 3401 | + if ( ! $useDefaultHeight) { |
|
| 3402 | 3402 | $this->_phpSheet->getRowDimension($r + 1)->setRowHeight($height / 20); |
| 3403 | 3403 | } |
| 3404 | 3404 | |
@@ -3418,7 +3418,7 @@ discard block |
||
| 3418 | 3418 | |
| 3419 | 3419 | // bit: 5; mask: 0x00000020; 1 = row is hidden |
| 3420 | 3420 | $isHidden = (0x00000020 & self::_GetInt4d($recordData, 12)) >> 5; |
| 3421 | - $this->_phpSheet->getRowDimension($r + 1)->setVisible(!$isHidden); |
|
| 3421 | + $this->_phpSheet->getRowDimension($r + 1)->setVisible( ! $isHidden); |
|
| 3422 | 3422 | |
| 3423 | 3423 | // bit: 7; mask: 0x00000080; 1 = row has explicit format |
| 3424 | 3424 | $hasExplicitFormat = (0x00000080 & self::_GetInt4d($recordData, 12)) >> 7; |
@@ -3460,7 +3460,7 @@ discard block |
||
| 3460 | 3460 | $columnString = PHPExcel_Cell::stringFromColumnIndex($column); |
| 3461 | 3461 | |
| 3462 | 3462 | // Read cell? |
| 3463 | - if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { |
|
| 3463 | + if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { |
|
| 3464 | 3464 | // offset: 4; size: 2; index to XF record |
| 3465 | 3465 | $xfIndex = self::_GetInt2d($recordData, 4); |
| 3466 | 3466 | |
@@ -3468,8 +3468,8 @@ discard block |
||
| 3468 | 3468 | $rknum = self::_GetInt4d($recordData, 6); |
| 3469 | 3469 | $numValue = self::_GetIEEE754($rknum); |
| 3470 | 3470 | |
| 3471 | - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); |
|
| 3472 | - if (!$this->_readDataOnly) { |
|
| 3471 | + $cell = $this->_phpSheet->getCell($columnString.($row + 1)); |
|
| 3472 | + if ( ! $this->_readDataOnly) { |
|
| 3473 | 3473 | // add style information |
| 3474 | 3474 | $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
| 3475 | 3475 | } |
@@ -3505,7 +3505,7 @@ discard block |
||
| 3505 | 3505 | $columnString = PHPExcel_Cell::stringFromColumnIndex($column); |
| 3506 | 3506 | |
| 3507 | 3507 | // Read cell? |
| 3508 | - if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { |
|
| 3508 | + if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { |
|
| 3509 | 3509 | // offset: 4; size: 2; index to XF record |
| 3510 | 3510 | $xfIndex = self::_GetInt2d($recordData, 4); |
| 3511 | 3511 | |
@@ -3513,7 +3513,7 @@ discard block |
||
| 3513 | 3513 | $index = self::_GetInt4d($recordData, 6); |
| 3514 | 3514 | |
| 3515 | 3515 | // add cell |
| 3516 | - if (($fmtRuns = $this->_sst[$index]['fmtRuns']) && !$this->_readDataOnly) { |
|
| 3516 | + if (($fmtRuns = $this->_sst[$index]['fmtRuns']) && ! $this->_readDataOnly) { |
|
| 3517 | 3517 | // then we should treat as rich text |
| 3518 | 3518 | $richText = new PHPExcel_RichText(); |
| 3519 | 3519 | $charPos = 0; |
@@ -3544,14 +3544,14 @@ discard block |
||
| 3544 | 3544 | } |
| 3545 | 3545 | } |
| 3546 | 3546 | } |
| 3547 | - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); |
|
| 3547 | + $cell = $this->_phpSheet->getCell($columnString.($row + 1)); |
|
| 3548 | 3548 | $cell->setValueExplicit($richText, PHPExcel_Cell_DataType::TYPE_STRING); |
| 3549 | 3549 | } else { |
| 3550 | - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); |
|
| 3550 | + $cell = $this->_phpSheet->getCell($columnString.($row + 1)); |
|
| 3551 | 3551 | $cell->setValueExplicit($this->_sst[$index]['value'], PHPExcel_Cell_DataType::TYPE_STRING); |
| 3552 | 3552 | } |
| 3553 | 3553 | |
| 3554 | - if (!$this->_readDataOnly) { |
|
| 3554 | + if ( ! $this->_readDataOnly) { |
|
| 3555 | 3555 | // add style information |
| 3556 | 3556 | $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
| 3557 | 3557 | } |
@@ -3592,15 +3592,15 @@ discard block |
||
| 3592 | 3592 | $columnString = PHPExcel_Cell::stringFromColumnIndex($colFirst + $i); |
| 3593 | 3593 | |
| 3594 | 3594 | // Read cell? |
| 3595 | - if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { |
|
| 3595 | + if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { |
|
| 3596 | 3596 | |
| 3597 | 3597 | // offset: var; size: 2; index to XF record |
| 3598 | 3598 | $xfIndex = self::_GetInt2d($recordData, $offset); |
| 3599 | 3599 | |
| 3600 | 3600 | // offset: var; size: 4; RK value |
| 3601 | 3601 | $numValue = self::_GetIEEE754(self::_GetInt4d($recordData, $offset + 2)); |
| 3602 | - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); |
|
| 3603 | - if (!$this->_readDataOnly) { |
|
| 3602 | + $cell = $this->_phpSheet->getCell($columnString.($row + 1)); |
|
| 3603 | + if ( ! $this->_readDataOnly) { |
|
| 3604 | 3604 | // add style |
| 3605 | 3605 | $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
| 3606 | 3606 | } |
@@ -3638,14 +3638,14 @@ discard block |
||
| 3638 | 3638 | $columnString = PHPExcel_Cell::stringFromColumnIndex($column); |
| 3639 | 3639 | |
| 3640 | 3640 | // Read cell? |
| 3641 | - if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { |
|
| 3641 | + if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { |
|
| 3642 | 3642 | // offset 4; size: 2; index to XF record |
| 3643 | 3643 | $xfIndex = self::_GetInt2d($recordData, 4); |
| 3644 | 3644 | |
| 3645 | 3645 | $numValue = self::_extractNumber(substr($recordData, 6, 8)); |
| 3646 | 3646 | |
| 3647 | - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); |
|
| 3648 | - if (!$this->_readDataOnly) { |
|
| 3647 | + $cell = $this->_phpSheet->getCell($columnString.($row + 1)); |
|
| 3648 | + if ( ! $this->_readDataOnly) { |
|
| 3649 | 3649 | // add cell style |
| 3650 | 3650 | $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
| 3651 | 3651 | } |
@@ -3701,15 +3701,15 @@ discard block |
||
| 3701 | 3701 | // get the base cell, grab tExp token |
| 3702 | 3702 | $baseRow = self::_GetInt2d($formulaStructure, 3); |
| 3703 | 3703 | $baseCol = self::_GetInt2d($formulaStructure, 5); |
| 3704 | - $this->_baseCell = PHPExcel_Cell::stringFromColumnIndex($baseCol). ($baseRow + 1); |
|
| 3704 | + $this->_baseCell = PHPExcel_Cell::stringFromColumnIndex($baseCol).($baseRow + 1); |
|
| 3705 | 3705 | } |
| 3706 | 3706 | |
| 3707 | 3707 | // Read cell? |
| 3708 | - if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { |
|
| 3708 | + if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { |
|
| 3709 | 3709 | |
| 3710 | 3710 | if ($isPartOfSharedFormula) { |
| 3711 | 3711 | // formula is added to this cell after the sheet has been read |
| 3712 | - $this->_sharedFormulaParts[$columnString . ($row + 1)] = $this->_baseCell; |
|
| 3712 | + $this->_sharedFormulaParts[$columnString.($row + 1)] = $this->_baseCell; |
|
| 3713 | 3713 | } |
| 3714 | 3714 | |
| 3715 | 3715 | // offset: 16: size: 4; not used |
@@ -3718,9 +3718,9 @@ discard block |
||
| 3718 | 3718 | $xfIndex = self::_GetInt2d($recordData, 4); |
| 3719 | 3719 | |
| 3720 | 3720 | // offset: 6; size: 8; result of the formula |
| 3721 | - if ( (ord($recordData{6}) == 0) |
|
| 3721 | + if ((ord($recordData{6}) == 0) |
|
| 3722 | 3722 | && (ord($recordData{12}) == 255) |
| 3723 | - && (ord($recordData{13}) == 255) ) { |
|
| 3723 | + && (ord($recordData{13}) == 255)) { |
|
| 3724 | 3724 | |
| 3725 | 3725 | // String formula. Result follows in appended STRING record |
| 3726 | 3726 | $dataType = PHPExcel_Cell_DataType::TYPE_STRING; |
@@ -3766,14 +3766,14 @@ discard block |
||
| 3766 | 3766 | |
| 3767 | 3767 | } |
| 3768 | 3768 | |
| 3769 | - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); |
|
| 3770 | - if (!$this->_readDataOnly) { |
|
| 3769 | + $cell = $this->_phpSheet->getCell($columnString.($row + 1)); |
|
| 3770 | + if ( ! $this->_readDataOnly) { |
|
| 3771 | 3771 | // add cell style |
| 3772 | 3772 | $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
| 3773 | 3773 | } |
| 3774 | 3774 | |
| 3775 | 3775 | // store the formula |
| 3776 | - if (!$isPartOfSharedFormula) { |
|
| 3776 | + if ( ! $isPartOfSharedFormula) { |
|
| 3777 | 3777 | // not part of shared formula |
| 3778 | 3778 | // add cell value. If we can read formula, populate with formula, otherwise just used cached value |
| 3779 | 3779 | try { |
@@ -3781,7 +3781,7 @@ discard block |
||
| 3781 | 3781 | throw new Exception('Not BIFF8. Can only read BIFF8 formulas'); |
| 3782 | 3782 | } |
| 3783 | 3783 | $formula = $this->_getFormulaFromStructure($formulaStructure); // get formula in human language |
| 3784 | - $cell->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA); |
|
| 3784 | + $cell->setValueExplicit('='.$formula, PHPExcel_Cell_DataType::TYPE_FORMULA); |
|
| 3785 | 3785 | |
| 3786 | 3786 | } catch (Exception $e) { |
| 3787 | 3787 | $cell->setValueExplicit($value, $dataType); |
@@ -3882,7 +3882,7 @@ discard block |
||
| 3882 | 3882 | $columnString = PHPExcel_Cell::stringFromColumnIndex($column); |
| 3883 | 3883 | |
| 3884 | 3884 | // Read cell? |
| 3885 | - if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { |
|
| 3885 | + if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { |
|
| 3886 | 3886 | // offset: 4; size: 2; index to XF record |
| 3887 | 3887 | $xfIndex = self::_GetInt2d($recordData, 4); |
| 3888 | 3888 | |
@@ -3892,7 +3892,7 @@ discard block |
||
| 3892 | 3892 | // offset: 7; size: 1; 0=boolean; 1=error |
| 3893 | 3893 | $isError = ord($recordData{7}); |
| 3894 | 3894 | |
| 3895 | - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); |
|
| 3895 | + $cell = $this->_phpSheet->getCell($columnString.($row + 1)); |
|
| 3896 | 3896 | switch ($isError) { |
| 3897 | 3897 | case 0: // boolean |
| 3898 | 3898 | $value = (bool) $boolErr; |
@@ -3909,7 +3909,7 @@ discard block |
||
| 3909 | 3909 | break; |
| 3910 | 3910 | } |
| 3911 | 3911 | |
| 3912 | - if (!$this->_readDataOnly) { |
|
| 3912 | + if ( ! $this->_readDataOnly) { |
|
| 3913 | 3913 | // add cell style |
| 3914 | 3914 | $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
| 3915 | 3915 | } |
@@ -3941,14 +3941,14 @@ discard block |
||
| 3941 | 3941 | |
| 3942 | 3942 | // offset: 4; size: 2 x nc; list of indexes to XF records |
| 3943 | 3943 | // add style information |
| 3944 | - if (!$this->_readDataOnly) { |
|
| 3944 | + if ( ! $this->_readDataOnly) { |
|
| 3945 | 3945 | for ($i = 0; $i < $length / 2 - 3; ++$i) { |
| 3946 | 3946 | $columnString = PHPExcel_Cell::stringFromColumnIndex($fc + $i); |
| 3947 | 3947 | |
| 3948 | 3948 | // Read cell? |
| 3949 | - if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { |
|
| 3949 | + if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { |
|
| 3950 | 3950 | $xfIndex = self::_GetInt2d($recordData, 4 + 2 * $i); |
| 3951 | - $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
|
| 3951 | + $this->_phpSheet->getCell($columnString.($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
|
| 3952 | 3952 | } |
| 3953 | 3953 | } |
| 3954 | 3954 | } |
@@ -3983,7 +3983,7 @@ discard block |
||
| 3983 | 3983 | $columnString = PHPExcel_Cell::stringFromColumnIndex($column); |
| 3984 | 3984 | |
| 3985 | 3985 | // Read cell? |
| 3986 | - if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { |
|
| 3986 | + if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { |
|
| 3987 | 3987 | // offset: 4; size: 2; XF index |
| 3988 | 3988 | $xfIndex = self::_GetInt2d($recordData, 4); |
| 3989 | 3989 | |
@@ -3996,10 +3996,10 @@ discard block |
||
| 3996 | 3996 | $string = $this->_readByteStringLong(substr($recordData, 6)); |
| 3997 | 3997 | $value = $string['value']; |
| 3998 | 3998 | } |
| 3999 | - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); |
|
| 3999 | + $cell = $this->_phpSheet->getCell($columnString.($row + 1)); |
|
| 4000 | 4000 | $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING); |
| 4001 | 4001 | |
| 4002 | - if (!$this->_readDataOnly) { |
|
| 4002 | + if ( ! $this->_readDataOnly) { |
|
| 4003 | 4003 | // add cell style |
| 4004 | 4004 | $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
| 4005 | 4005 | } |
@@ -4026,13 +4026,13 @@ discard block |
||
| 4026 | 4026 | $columnString = PHPExcel_Cell::stringFromColumnIndex($col); |
| 4027 | 4027 | |
| 4028 | 4028 | // Read cell? |
| 4029 | - if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) { |
|
| 4029 | + if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { |
|
| 4030 | 4030 | // offset: 4; size: 2; XF index |
| 4031 | 4031 | $xfIndex = self::_GetInt2d($recordData, 4); |
| 4032 | 4032 | |
| 4033 | 4033 | // add style information |
| 4034 | - if (!$this->_readDataOnly) { |
|
| 4035 | - $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
|
| 4034 | + if ( ! $this->_readDataOnly) { |
|
| 4035 | + $this->_phpSheet->getCell($columnString.($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]); |
|
| 4036 | 4036 | } |
| 4037 | 4037 | } |
| 4038 | 4038 | |
@@ -4081,7 +4081,7 @@ discard block |
||
| 4081 | 4081 | $ftCmoType = self::_GetInt2d($recordData, 0); |
| 4082 | 4082 | $cbCmoSize = self::_GetInt2d($recordData, 2); |
| 4083 | 4083 | $otObjType = self::_GetInt2d($recordData, 4); |
| 4084 | - $idObjID = self::_GetInt2d($recordData, 6); |
|
| 4084 | + $idObjID = self::_GetInt2d($recordData, 6); |
|
| 4085 | 4085 | $grbitOpts = self::_GetInt2d($recordData, 6); |
| 4086 | 4086 | |
| 4087 | 4087 | $this->_objs[] = array( |
@@ -4125,7 +4125,7 @@ discard block |
||
| 4125 | 4125 | $this->_frozen = (bool) ((0x0008 & $options) >> 3); |
| 4126 | 4126 | |
| 4127 | 4127 | // bit: 6; mask: 0x0040; 0 = columns from left to right, 1 = columns from right to left |
| 4128 | - $this->_phpSheet->setRightToLeft((bool)((0x0040 & $options) >> 6)); |
|
| 4128 | + $this->_phpSheet->setRightToLeft((bool) ((0x0040 & $options) >> 6)); |
|
| 4129 | 4129 | |
| 4130 | 4130 | // bit: 10; mask: 0x0400; 0 = sheet not active, 1 = sheet active |
| 4131 | 4131 | $isActive = (bool) ((0x0400 & $options) >> 10); |
@@ -4168,7 +4168,7 @@ discard block |
||
| 4168 | 4168 | // move stream pointer to next record |
| 4169 | 4169 | $this->_pos += 4 + $length; |
| 4170 | 4170 | |
| 4171 | - if (!$this->_readDataOnly) { |
|
| 4171 | + if ( ! $this->_readDataOnly) { |
|
| 4172 | 4172 | // offset: 0; size: 2; position of vertical split |
| 4173 | 4173 | $px = self::_GetInt2d($recordData, 0); |
| 4174 | 4174 | |
@@ -4177,7 +4177,7 @@ discard block |
||
| 4177 | 4177 | |
| 4178 | 4178 | if ($this->_frozen) { |
| 4179 | 4179 | // frozen panes |
| 4180 | - $this->_phpSheet->freezePane(PHPExcel_Cell::stringFromColumnIndex($px) . ($py + 1)); |
|
| 4180 | + $this->_phpSheet->freezePane(PHPExcel_Cell::stringFromColumnIndex($px).($py + 1)); |
|
| 4181 | 4181 | } else { |
| 4182 | 4182 | // unfrozen panes; split windows; not supported by PHPExcel core |
| 4183 | 4183 | } |
@@ -4196,7 +4196,7 @@ discard block |
||
| 4196 | 4196 | // move stream pointer to next record |
| 4197 | 4197 | $this->_pos += 4 + $length; |
| 4198 | 4198 | |
| 4199 | - if (!$this->_readDataOnly) { |
|
| 4199 | + if ( ! $this->_readDataOnly) { |
|
| 4200 | 4200 | // offset: 0; size: 1; pane identifier |
| 4201 | 4201 | $paneId = ord($recordData{0}); |
| 4202 | 4202 | |
@@ -4273,7 +4273,7 @@ discard block |
||
| 4273 | 4273 | // move stream pointer to next record |
| 4274 | 4274 | $this->_pos += 4 + $length; |
| 4275 | 4275 | |
| 4276 | - if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { |
|
| 4276 | + if ($this->_version == self::XLS_BIFF8 && ! $this->_readDataOnly) { |
|
| 4277 | 4277 | $cellRangeAddressList = $this->_readBIFF8CellRangeAddressList($recordData); |
| 4278 | 4278 | foreach ($cellRangeAddressList['cellRangeAddresses'] as $cellRangeAddress) { |
| 4279 | 4279 | if ($this->_includeCellRangeFiltered($cellRangeAddress)) { |
@@ -4295,7 +4295,7 @@ discard block |
||
| 4295 | 4295 | // move stream pointer forward to next record |
| 4296 | 4296 | $this->_pos += 4 + $length; |
| 4297 | 4297 | |
| 4298 | - if (!$this->_readDataOnly) { |
|
| 4298 | + if ( ! $this->_readDataOnly) { |
|
| 4299 | 4299 | // offset: 0; size: 8; cell range address of all cells containing this hyperlink |
| 4300 | 4300 | try { |
| 4301 | 4301 | $cellRange = $this->_readBIFF8CellRangeAddressFixed($recordData, 0, 8); |
@@ -4347,7 +4347,7 @@ discard block |
||
| 4347 | 4347 | |
| 4348 | 4348 | if ($isUNC) { |
| 4349 | 4349 | $hyperlinkType = 'UNC'; |
| 4350 | - } else if (!$isFileLinkOrUrl) { |
|
| 4350 | + } else if ( ! $isFileLinkOrUrl) { |
|
| 4351 | 4351 | $hyperlinkType = 'workbook'; |
| 4352 | 4352 | } else if (ord($recordData{$offset}) == 0x03) { |
| 4353 | 4353 | $hyperlinkType = 'local'; |
@@ -4494,22 +4494,22 @@ discard block |
||
| 4494 | 4494 | // bit: 0-3; mask: 0x0000000F; type |
| 4495 | 4495 | $type = (0x0000000F & $options) >> 0; |
| 4496 | 4496 | switch ($type) { |
| 4497 | - case 0x00: $type = PHPExcel_Cell_DataValidation::TYPE_NONE; break; |
|
| 4498 | - case 0x01: $type = PHPExcel_Cell_DataValidation::TYPE_WHOLE; break; |
|
| 4499 | - case 0x02: $type = PHPExcel_Cell_DataValidation::TYPE_DECIMAL; break; |
|
| 4500 | - case 0x03: $type = PHPExcel_Cell_DataValidation::TYPE_LIST; break; |
|
| 4501 | - case 0x04: $type = PHPExcel_Cell_DataValidation::TYPE_DATE; break; |
|
| 4502 | - case 0x05: $type = PHPExcel_Cell_DataValidation::TYPE_TIME; break; |
|
| 4503 | - case 0x06: $type = PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH; break; |
|
| 4504 | - case 0x07: $type = PHPExcel_Cell_DataValidation::TYPE_CUSTOM; break; |
|
| 4497 | + case 0x00: $type = PHPExcel_Cell_DataValidation::TYPE_NONE; break; |
|
| 4498 | + case 0x01: $type = PHPExcel_Cell_DataValidation::TYPE_WHOLE; break; |
|
| 4499 | + case 0x02: $type = PHPExcel_Cell_DataValidation::TYPE_DECIMAL; break; |
|
| 4500 | + case 0x03: $type = PHPExcel_Cell_DataValidation::TYPE_LIST; break; |
|
| 4501 | + case 0x04: $type = PHPExcel_Cell_DataValidation::TYPE_DATE; break; |
|
| 4502 | + case 0x05: $type = PHPExcel_Cell_DataValidation::TYPE_TIME; break; |
|
| 4503 | + case 0x06: $type = PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH; break; |
|
| 4504 | + case 0x07: $type = PHPExcel_Cell_DataValidation::TYPE_CUSTOM; break; |
|
| 4505 | 4505 | } |
| 4506 | 4506 | |
| 4507 | 4507 | // bit: 4-6; mask: 0x00000070; error type |
| 4508 | 4508 | $errorStyle = (0x00000070 & $options) >> 4; |
| 4509 | 4509 | switch ($errorStyle) { |
| 4510 | - case 0x00: $errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; break; |
|
| 4511 | - case 0x01: $errorStyle = PHPExcel_Cell_DataValidation::STYLE_WARNING; break; |
|
| 4512 | - case 0x02: $errorStyle = PHPExcel_Cell_DataValidation::STYLE_INFORMATION; break; |
|
| 4510 | + case 0x00: $errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; break; |
|
| 4511 | + case 0x01: $errorStyle = PHPExcel_Cell_DataValidation::STYLE_WARNING; break; |
|
| 4512 | + case 0x02: $errorStyle = PHPExcel_Cell_DataValidation::STYLE_INFORMATION; break; |
|
| 4513 | 4513 | } |
| 4514 | 4514 | |
| 4515 | 4515 | // bit: 7; mask: 0x00000080; 1= formula is explicit (only applies to list) |
@@ -4531,14 +4531,14 @@ discard block |
||
| 4531 | 4531 | // bit: 20-23; mask: 0x00F00000; condition operator |
| 4532 | 4532 | $operator = (0x00F00000 & $options) >> 20; |
| 4533 | 4533 | switch ($operator) { |
| 4534 | - case 0x00: $operator = PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN ; break; |
|
| 4535 | - case 0x01: $operator = PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN ; break; |
|
| 4536 | - case 0x02: $operator = PHPExcel_Cell_DataValidation::OPERATOR_EQUAL ; break; |
|
| 4537 | - case 0x03: $operator = PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL ; break; |
|
| 4538 | - case 0x04: $operator = PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN ; break; |
|
| 4539 | - case 0x05: $operator = PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN ; break; |
|
| 4540 | - case 0x06: $operator = PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL; break; |
|
| 4541 | - case 0x07: $operator = PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL ; break; |
|
| 4534 | + case 0x00: $operator = PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN; break; |
|
| 4535 | + case 0x01: $operator = PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN; break; |
|
| 4536 | + case 0x02: $operator = PHPExcel_Cell_DataValidation::OPERATOR_EQUAL; break; |
|
| 4537 | + case 0x03: $operator = PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL; break; |
|
| 4538 | + case 0x04: $operator = PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN; break; |
|
| 4539 | + case 0x05: $operator = PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN; break; |
|
| 4540 | + case 0x06: $operator = PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL; break; |
|
| 4541 | + case 0x07: $operator = PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL; break; |
|
| 4542 | 4542 | } |
| 4543 | 4543 | |
| 4544 | 4544 | // offset: 4; size: var; title of the prompt box |
@@ -4575,7 +4575,7 @@ discard block |
||
| 4575 | 4575 | |
| 4576 | 4576 | // offset: var; size: $sz1; formula data for first condition (without size field) |
| 4577 | 4577 | $formula1 = substr($recordData, $offset, $sz1); |
| 4578 | - $formula1 = pack('v', $sz1) . $formula1; // prepend the length |
|
| 4578 | + $formula1 = pack('v', $sz1).$formula1; // prepend the length |
|
| 4579 | 4579 | try { |
| 4580 | 4580 | $formula1 = $this->_getFormulaFromStructure($formula1); |
| 4581 | 4581 | |
@@ -4597,7 +4597,7 @@ discard block |
||
| 4597 | 4597 | |
| 4598 | 4598 | // offset: var; size: $sz2; formula data for second condition (without size field) |
| 4599 | 4599 | $formula2 = substr($recordData, $offset, $sz2); |
| 4600 | - $formula2 = pack('v', $sz2) . $formula2; // prepend the length |
|
| 4600 | + $formula2 = pack('v', $sz2).$formula2; // prepend the length |
|
| 4601 | 4601 | try { |
| 4602 | 4602 | $formula2 = $this->_getFormulaFromStructure($formula2); |
| 4603 | 4603 | } catch (Exception $e) { |
@@ -4616,10 +4616,10 @@ discard block |
||
| 4616 | 4616 | $objValidation = $this->_phpSheet->getCell($coordinate)->getDataValidation(); |
| 4617 | 4617 | $objValidation->setType($type); |
| 4618 | 4618 | $objValidation->setErrorStyle($errorStyle); |
| 4619 | - $objValidation->setAllowBlank((bool)$allowBlank); |
|
| 4620 | - $objValidation->setShowInputMessage((bool)$showInputMessage); |
|
| 4621 | - $objValidation->setShowErrorMessage((bool)$showErrorMessage); |
|
| 4622 | - $objValidation->setShowDropDown(!$suppressDropDown); |
|
| 4619 | + $objValidation->setAllowBlank((bool) $allowBlank); |
|
| 4620 | + $objValidation->setShowInputMessage((bool) $showInputMessage); |
|
| 4621 | + $objValidation->setShowErrorMessage((bool) $showErrorMessage); |
|
| 4622 | + $objValidation->setShowDropDown( ! $suppressDropDown); |
|
| 4623 | 4623 | $objValidation->setOperator($operator); |
| 4624 | 4624 | $objValidation->setErrorTitle($errorTitle); |
| 4625 | 4625 | $objValidation->setError($error); |
@@ -4647,7 +4647,7 @@ discard block |
||
| 4647 | 4647 | // local pointer in record data |
| 4648 | 4648 | $offset = 0; |
| 4649 | 4649 | |
| 4650 | - if (!$this->_readDataOnly) { |
|
| 4650 | + if ( ! $this->_readDataOnly) { |
|
| 4651 | 4651 | // offset: 0; size: 2; repeated record identifier 0x0862 |
| 4652 | 4652 | |
| 4653 | 4653 | // offset: 2; size: 10; not used |
@@ -4660,7 +4660,7 @@ discard block |
||
| 4660 | 4660 | case 0x14: |
| 4661 | 4661 | // offset: 16; size: 2; color index for sheet tab |
| 4662 | 4662 | $colorIndex = self::_GetInt2d($recordData, 16); |
| 4663 | - $color = self::_readColor($colorIndex,$this->_palette,$this->_version); |
|
| 4663 | + $color = self::_readColor($colorIndex, $this->_palette, $this->_version); |
|
| 4664 | 4664 | $this->_phpSheet->getTabColor()->setRGB($color['rgb']); |
| 4665 | 4665 | break; |
| 4666 | 4666 | |
@@ -4710,63 +4710,63 @@ discard block |
||
| 4710 | 4710 | |
| 4711 | 4711 | // bit: 0; mask 0x0001; 1 = user may edit objects, 0 = users must not edit objects |
| 4712 | 4712 | $bool = (0x0001 & $options) >> 0; |
| 4713 | - $this->_phpSheet->getProtection()->setObjects(!$bool); |
|
| 4713 | + $this->_phpSheet->getProtection()->setObjects( ! $bool); |
|
| 4714 | 4714 | |
| 4715 | 4715 | // bit: 1; mask 0x0002; edit scenarios |
| 4716 | 4716 | $bool = (0x0002 & $options) >> 1; |
| 4717 | - $this->_phpSheet->getProtection()->setScenarios(!$bool); |
|
| 4717 | + $this->_phpSheet->getProtection()->setScenarios( ! $bool); |
|
| 4718 | 4718 | |
| 4719 | 4719 | // bit: 2; mask 0x0004; format cells |
| 4720 | 4720 | $bool = (0x0004 & $options) >> 2; |
| 4721 | - $this->_phpSheet->getProtection()->setFormatCells(!$bool); |
|
| 4721 | + $this->_phpSheet->getProtection()->setFormatCells( ! $bool); |
|
| 4722 | 4722 | |
| 4723 | 4723 | // bit: 3; mask 0x0008; format columns |
| 4724 | 4724 | $bool = (0x0008 & $options) >> 3; |
| 4725 | - $this->_phpSheet->getProtection()->setFormatColumns(!$bool); |
|
| 4725 | + $this->_phpSheet->getProtection()->setFormatColumns( ! $bool); |
|
| 4726 | 4726 | |
| 4727 | 4727 | // bit: 4; mask 0x0010; format rows |
| 4728 | 4728 | $bool = (0x0010 & $options) >> 4; |
| 4729 | - $this->_phpSheet->getProtection()->setFormatRows(!$bool); |
|
| 4729 | + $this->_phpSheet->getProtection()->setFormatRows( ! $bool); |
|
| 4730 | 4730 | |
| 4731 | 4731 | // bit: 5; mask 0x0020; insert columns |
| 4732 | 4732 | $bool = (0x0020 & $options) >> 5; |
| 4733 | - $this->_phpSheet->getProtection()->setInsertColumns(!$bool); |
|
| 4733 | + $this->_phpSheet->getProtection()->setInsertColumns( ! $bool); |
|
| 4734 | 4734 | |
| 4735 | 4735 | // bit: 6; mask 0x0040; insert rows |
| 4736 | 4736 | $bool = (0x0040 & $options) >> 6; |
| 4737 | - $this->_phpSheet->getProtection()->setInsertRows(!$bool); |
|
| 4737 | + $this->_phpSheet->getProtection()->setInsertRows( ! $bool); |
|
| 4738 | 4738 | |
| 4739 | 4739 | // bit: 7; mask 0x0080; insert hyperlinks |
| 4740 | 4740 | $bool = (0x0080 & $options) >> 7; |
| 4741 | - $this->_phpSheet->getProtection()->setInsertHyperlinks(!$bool); |
|
| 4741 | + $this->_phpSheet->getProtection()->setInsertHyperlinks( ! $bool); |
|
| 4742 | 4742 | |
| 4743 | 4743 | // bit: 8; mask 0x0100; delete columns |
| 4744 | 4744 | $bool = (0x0100 & $options) >> 8; |
| 4745 | - $this->_phpSheet->getProtection()->setDeleteColumns(!$bool); |
|
| 4745 | + $this->_phpSheet->getProtection()->setDeleteColumns( ! $bool); |
|
| 4746 | 4746 | |
| 4747 | 4747 | // bit: 9; mask 0x0200; delete rows |
| 4748 | 4748 | $bool = (0x0200 & $options) >> 9; |
| 4749 | - $this->_phpSheet->getProtection()->setDeleteRows(!$bool); |
|
| 4749 | + $this->_phpSheet->getProtection()->setDeleteRows( ! $bool); |
|
| 4750 | 4750 | |
| 4751 | 4751 | // bit: 10; mask 0x0400; select locked cells |
| 4752 | 4752 | $bool = (0x0400 & $options) >> 10; |
| 4753 | - $this->_phpSheet->getProtection()->setSelectLockedCells(!$bool); |
|
| 4753 | + $this->_phpSheet->getProtection()->setSelectLockedCells( ! $bool); |
|
| 4754 | 4754 | |
| 4755 | 4755 | // bit: 11; mask 0x0800; sort cell range |
| 4756 | 4756 | $bool = (0x0800 & $options) >> 11; |
| 4757 | - $this->_phpSheet->getProtection()->setSort(!$bool); |
|
| 4757 | + $this->_phpSheet->getProtection()->setSort( ! $bool); |
|
| 4758 | 4758 | |
| 4759 | 4759 | // bit: 12; mask 0x1000; auto filter |
| 4760 | 4760 | $bool = (0x1000 & $options) >> 12; |
| 4761 | - $this->_phpSheet->getProtection()->setAutoFilter(!$bool); |
|
| 4761 | + $this->_phpSheet->getProtection()->setAutoFilter( ! $bool); |
|
| 4762 | 4762 | |
| 4763 | 4763 | // bit: 13; mask 0x2000; pivot tables |
| 4764 | 4764 | $bool = (0x2000 & $options) >> 13; |
| 4765 | - $this->_phpSheet->getProtection()->setPivotTables(!$bool); |
|
| 4765 | + $this->_phpSheet->getProtection()->setPivotTables( ! $bool); |
|
| 4766 | 4766 | |
| 4767 | 4767 | // bit: 14; mask 0x4000; select unlocked cells |
| 4768 | 4768 | $bool = (0x4000 & $options) >> 14; |
| 4769 | - $this->_phpSheet->getProtection()->setSelectUnlockedCells(!$bool); |
|
| 4769 | + $this->_phpSheet->getProtection()->setSelectUnlockedCells( ! $bool); |
|
| 4770 | 4770 | |
| 4771 | 4771 | // offset: 21; size: 2; not used |
| 4772 | 4772 | } |
@@ -4788,7 +4788,7 @@ discard block |
||
| 4788 | 4788 | // local pointer in record data |
| 4789 | 4789 | $offset = 0; |
| 4790 | 4790 | |
| 4791 | - if (!$this->_readDataOnly) { |
|
| 4791 | + if ( ! $this->_readDataOnly) { |
|
| 4792 | 4792 | $offset += 12; |
| 4793 | 4793 | |
| 4794 | 4794 | // offset: 12; size: 2; shared feature type, 2 = enhanced protection, 4 = smart tag |
@@ -5055,7 +5055,7 @@ discard block |
||
| 5055 | 5055 | * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas |
| 5056 | 5056 | * @return string Human readable formula |
| 5057 | 5057 | */ |
| 5058 | - private function _getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1') |
|
| 5058 | + private function _getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1') |
|
| 5059 | 5059 | { |
| 5060 | 5060 | // start parsing the formula data |
| 5061 | 5061 | $tokens = array(); |
@@ -5175,7 +5175,7 @@ discard block |
||
| 5175 | 5175 | $ops[] = array_pop($formulaStrings); |
| 5176 | 5176 | } |
| 5177 | 5177 | $ops = array_reverse($ops); |
| 5178 | - $formulaStrings[] = "$space1$space0{$token['data']['function']}(" . implode(',', $ops) . ")"; |
|
| 5178 | + $formulaStrings[] = "$space1$space0{$token['data']['function']}(".implode(',', $ops).")"; |
|
| 5179 | 5179 | unset($space0, $space1); |
| 5180 | 5180 | } else { |
| 5181 | 5181 | // add-in function |
@@ -5185,7 +5185,7 @@ discard block |
||
| 5185 | 5185 | } |
| 5186 | 5186 | $ops = array_reverse($ops); |
| 5187 | 5187 | $function = array_pop($formulaStrings); |
| 5188 | - $formulaStrings[] = "$space1$space0$function(" . implode(',', $ops) . ")"; |
|
| 5188 | + $formulaStrings[] = "$space1$space0$function(".implode(',', $ops).")"; |
|
| 5189 | 5189 | unset($space0, $space1); |
| 5190 | 5190 | } |
| 5191 | 5191 | break; |
@@ -5196,7 +5196,7 @@ discard block |
||
| 5196 | 5196 | break; |
| 5197 | 5197 | case 'tArray': // array constant |
| 5198 | 5198 | $constantArray = self::_readBIFF8ConstantArray($additionalData); |
| 5199 | - $formulaStrings[] = $space1 . $space0 . $constantArray['value']; |
|
| 5199 | + $formulaStrings[] = $space1.$space0.$constantArray['value']; |
|
| 5200 | 5200 | $additionalData = substr($additionalData, $constantArray['size']); // bite of chunk of additional data |
| 5201 | 5201 | unset($space0, $space1); |
| 5202 | 5202 | break; |
@@ -5253,24 +5253,24 @@ discard block |
||
| 5253 | 5253 | $name = false; // initialize token name |
| 5254 | 5254 | |
| 5255 | 5255 | switch ($id) { |
| 5256 | - case 0x03: $name = 'tAdd'; $size = 1; $data = '+'; break; |
|
| 5257 | - case 0x04: $name = 'tSub'; $size = 1; $data = '-'; break; |
|
| 5258 | - case 0x05: $name = 'tMul'; $size = 1; $data = '*'; break; |
|
| 5259 | - case 0x06: $name = 'tDiv'; $size = 1; $data = '/'; break; |
|
| 5260 | - case 0x07: $name = 'tPower'; $size = 1; $data = '^'; break; |
|
| 5261 | - case 0x08: $name = 'tConcat'; $size = 1; $data = '&'; break; |
|
| 5262 | - case 0x09: $name = 'tLT'; $size = 1; $data = '<'; break; |
|
| 5263 | - case 0x0A: $name = 'tLE'; $size = 1; $data = '<='; break; |
|
| 5264 | - case 0x0B: $name = 'tEQ'; $size = 1; $data = '='; break; |
|
| 5265 | - case 0x0C: $name = 'tGE'; $size = 1; $data = '>='; break; |
|
| 5266 | - case 0x0D: $name = 'tGT'; $size = 1; $data = '>'; break; |
|
| 5267 | - case 0x0E: $name = 'tNE'; $size = 1; $data = '<>'; break; |
|
| 5268 | - case 0x0F: $name = 'tIsect'; $size = 1; $data = ' '; break; |
|
| 5269 | - case 0x10: $name = 'tList'; $size = 1; $data = ','; break; |
|
| 5270 | - case 0x11: $name = 'tRange'; $size = 1; $data = ':'; break; |
|
| 5271 | - case 0x12: $name = 'tUplus'; $size = 1; $data = '+'; break; |
|
| 5272 | - case 0x13: $name = 'tUminus'; $size = 1; $data = '-'; break; |
|
| 5273 | - case 0x14: $name = 'tPercent'; $size = 1; $data = '%'; break; |
|
| 5256 | + case 0x03: $name = 'tAdd'; $size = 1; $data = '+'; break; |
|
| 5257 | + case 0x04: $name = 'tSub'; $size = 1; $data = '-'; break; |
|
| 5258 | + case 0x05: $name = 'tMul'; $size = 1; $data = '*'; break; |
|
| 5259 | + case 0x06: $name = 'tDiv'; $size = 1; $data = '/'; break; |
|
| 5260 | + case 0x07: $name = 'tPower'; $size = 1; $data = '^'; break; |
|
| 5261 | + case 0x08: $name = 'tConcat'; $size = 1; $data = '&'; break; |
|
| 5262 | + case 0x09: $name = 'tLT'; $size = 1; $data = '<'; break; |
|
| 5263 | + case 0x0A: $name = 'tLE'; $size = 1; $data = '<='; break; |
|
| 5264 | + case 0x0B: $name = 'tEQ'; $size = 1; $data = '='; break; |
|
| 5265 | + case 0x0C: $name = 'tGE'; $size = 1; $data = '>='; break; |
|
| 5266 | + case 0x0D: $name = 'tGT'; $size = 1; $data = '>'; break; |
|
| 5267 | + case 0x0E: $name = 'tNE'; $size = 1; $data = '<>'; break; |
|
| 5268 | + case 0x0F: $name = 'tIsect'; $size = 1; $data = ' '; break; |
|
| 5269 | + case 0x10: $name = 'tList'; $size = 1; $data = ','; break; |
|
| 5270 | + case 0x11: $name = 'tRange'; $size = 1; $data = ':'; break; |
|
| 5271 | + case 0x12: $name = 'tUplus'; $size = 1; $data = '+'; break; |
|
| 5272 | + case 0x13: $name = 'tUminus'; $size = 1; $data = '-'; break; |
|
| 5273 | + case 0x14: $name = 'tPercent'; $size = 1; $data = '%'; break; |
|
| 5274 | 5274 | case 0x15: // parenthesis |
| 5275 | 5275 | $name = 'tParen'; |
| 5276 | 5276 | $size = 1; |
@@ -5381,7 +5381,7 @@ discard block |
||
| 5381 | 5381 | $name = 'tNum'; |
| 5382 | 5382 | $size = 9; |
| 5383 | 5383 | $data = self::_extractNumber(substr($formulaData, 1)); |
| 5384 | - $data = str_replace(',', '.', (string)$data); // in case non-English locale |
|
| 5384 | + $data = str_replace(',', '.', (string) $data); // in case non-English locale |
|
| 5385 | 5385 | break; |
| 5386 | 5386 | case 0x20: // array constant |
| 5387 | 5387 | case 0x40: |
@@ -5398,166 +5398,166 @@ discard block |
||
| 5398 | 5398 | $size = 3; |
| 5399 | 5399 | // offset: 1; size: 2; index to built-in sheet function |
| 5400 | 5400 | switch (self::_GetInt2d($formulaData, 1)) { |
| 5401 | - case 2: $function = 'ISNA'; $args = 1; break; |
|
| 5402 | - case 3: $function = 'ISERROR'; $args = 1; break; |
|
| 5403 | - case 10: $function = 'NA'; $args = 0; break; |
|
| 5404 | - case 15: $function = 'SIN'; $args = 1; break; |
|
| 5405 | - case 16: $function = 'COS'; $args = 1; break; |
|
| 5406 | - case 17: $function = 'TAN'; $args = 1; break; |
|
| 5407 | - case 18: $function = 'ATAN'; $args = 1; break; |
|
| 5408 | - case 19: $function = 'PI'; $args = 0; break; |
|
| 5409 | - case 20: $function = 'SQRT'; $args = 1; break; |
|
| 5410 | - case 21: $function = 'EXP'; $args = 1; break; |
|
| 5411 | - case 22: $function = 'LN'; $args = 1; break; |
|
| 5412 | - case 23: $function = 'LOG10'; $args = 1; break; |
|
| 5413 | - case 24: $function = 'ABS'; $args = 1; break; |
|
| 5414 | - case 25: $function = 'INT'; $args = 1; break; |
|
| 5415 | - case 26: $function = 'SIGN'; $args = 1; break; |
|
| 5416 | - case 27: $function = 'ROUND'; $args = 2; break; |
|
| 5417 | - case 30: $function = 'REPT'; $args = 2; break; |
|
| 5418 | - case 31: $function = 'MID'; $args = 3; break; |
|
| 5419 | - case 32: $function = 'LEN'; $args = 1; break; |
|
| 5420 | - case 33: $function = 'VALUE'; $args = 1; break; |
|
| 5421 | - case 34: $function = 'TRUE'; $args = 0; break; |
|
| 5422 | - case 35: $function = 'FALSE'; $args = 0; break; |
|
| 5423 | - case 38: $function = 'NOT'; $args = 1; break; |
|
| 5424 | - case 39: $function = 'MOD'; $args = 2; break; |
|
| 5425 | - case 40: $function = 'DCOUNT'; $args = 3; break; |
|
| 5426 | - case 41: $function = 'DSUM'; $args = 3; break; |
|
| 5427 | - case 42: $function = 'DAVERAGE'; $args = 3; break; |
|
| 5428 | - case 43: $function = 'DMIN'; $args = 3; break; |
|
| 5429 | - case 44: $function = 'DMAX'; $args = 3; break; |
|
| 5430 | - case 45: $function = 'DSTDEV'; $args = 3; break; |
|
| 5431 | - case 48: $function = 'TEXT'; $args = 2; break; |
|
| 5432 | - case 61: $function = 'MIRR'; $args = 3; break; |
|
| 5433 | - case 63: $function = 'RAND'; $args = 0; break; |
|
| 5434 | - case 65: $function = 'DATE'; $args = 3; break; |
|
| 5435 | - case 66: $function = 'TIME'; $args = 3; break; |
|
| 5436 | - case 67: $function = 'DAY'; $args = 1; break; |
|
| 5437 | - case 68: $function = 'MONTH'; $args = 1; break; |
|
| 5438 | - case 69: $function = 'YEAR'; $args = 1; break; |
|
| 5439 | - case 71: $function = 'HOUR'; $args = 1; break; |
|
| 5440 | - case 72: $function = 'MINUTE'; $args = 1; break; |
|
| 5441 | - case 73: $function = 'SECOND'; $args = 1; break; |
|
| 5442 | - case 74: $function = 'NOW'; $args = 0; break; |
|
| 5443 | - case 75: $function = 'AREAS'; $args = 1; break; |
|
| 5444 | - case 76: $function = 'ROWS'; $args = 1; break; |
|
| 5445 | - case 77: $function = 'COLUMNS'; $args = 1; break; |
|
| 5446 | - case 83: $function = 'TRANSPOSE'; $args = 1; break; |
|
| 5447 | - case 86: $function = 'TYPE'; $args = 1; break; |
|
| 5448 | - case 97: $function = 'ATAN2'; $args = 2; break; |
|
| 5449 | - case 98: $function = 'ASIN'; $args = 1; break; |
|
| 5450 | - case 99: $function = 'ACOS'; $args = 1; break; |
|
| 5451 | - case 105: $function = 'ISREF'; $args = 1; break; |
|
| 5452 | - case 111: $function = 'CHAR'; $args = 1; break; |
|
| 5453 | - case 112: $function = 'LOWER'; $args = 1; break; |
|
| 5454 | - case 113: $function = 'UPPER'; $args = 1; break; |
|
| 5455 | - case 114: $function = 'PROPER'; $args = 1; break; |
|
| 5456 | - case 117: $function = 'EXACT'; $args = 2; break; |
|
| 5457 | - case 118: $function = 'TRIM'; $args = 1; break; |
|
| 5458 | - case 119: $function = 'REPLACE'; $args = 4; break; |
|
| 5459 | - case 121: $function = 'CODE'; $args = 1; break; |
|
| 5460 | - case 126: $function = 'ISERR'; $args = 1; break; |
|
| 5461 | - case 127: $function = 'ISTEXT'; $args = 1; break; |
|
| 5462 | - case 128: $function = 'ISNUMBER'; $args = 1; break; |
|
| 5463 | - case 129: $function = 'ISBLANK'; $args = 1; break; |
|
| 5464 | - case 130: $function = 'T'; $args = 1; break; |
|
| 5465 | - case 131: $function = 'N'; $args = 1; break; |
|
| 5466 | - case 140: $function = 'DATEVALUE'; $args = 1; break; |
|
| 5467 | - case 141: $function = 'TIMEVALUE'; $args = 1; break; |
|
| 5468 | - case 142: $function = 'SLN'; $args = 3; break; |
|
| 5469 | - case 143: $function = 'SYD'; $args = 4; break; |
|
| 5470 | - case 162: $function = 'CLEAN'; $args = 1; break; |
|
| 5471 | - case 163: $function = 'MDETERM'; $args = 1; break; |
|
| 5472 | - case 164: $function = 'MINVERSE'; $args = 1; break; |
|
| 5473 | - case 165: $function = 'MMULT'; $args = 2; break; |
|
| 5474 | - case 184: $function = 'FACT'; $args = 1; break; |
|
| 5475 | - case 189: $function = 'DPRODUCT'; $args = 3; break; |
|
| 5476 | - case 190: $function = 'ISNONTEXT'; $args = 1; break; |
|
| 5477 | - case 195: $function = 'DSTDEVP'; $args = 3; break; |
|
| 5478 | - case 196: $function = 'DVARP'; $args = 3; break; |
|
| 5479 | - case 198: $function = 'ISLOGICAL'; $args = 1; break; |
|
| 5480 | - case 199: $function = 'DCOUNTA'; $args = 3; break; |
|
| 5481 | - case 207: $function = 'REPLACEB'; $args = 4; break; |
|
| 5482 | - case 210: $function = 'MIDB'; $args = 3; break; |
|
| 5483 | - case 211: $function = 'LENB'; $args = 1; break; |
|
| 5484 | - case 212: $function = 'ROUNDUP'; $args = 2; break; |
|
| 5485 | - case 213: $function = 'ROUNDDOWN'; $args = 2; break; |
|
| 5486 | - case 214: $function = 'ASC'; $args = 1; break; |
|
| 5487 | - case 215: $function = 'DBCS'; $args = 1; break; |
|
| 5488 | - case 221: $function = 'TODAY'; $args = 0; break; |
|
| 5489 | - case 229: $function = 'SINH'; $args = 1; break; |
|
| 5490 | - case 230: $function = 'COSH'; $args = 1; break; |
|
| 5491 | - case 231: $function = 'TANH'; $args = 1; break; |
|
| 5492 | - case 232: $function = 'ASINH'; $args = 1; break; |
|
| 5493 | - case 233: $function = 'ACOSH'; $args = 1; break; |
|
| 5494 | - case 234: $function = 'ATANH'; $args = 1; break; |
|
| 5495 | - case 235: $function = 'DGET'; $args = 3; break; |
|
| 5496 | - case 244: $function = 'INFO'; $args = 1; break; |
|
| 5497 | - case 252: $function = 'FREQUENCY'; $args = 2; break; |
|
| 5498 | - case 261: $function = 'ERROR.TYPE'; $args = 1; break; |
|
| 5499 | - case 271: $function = 'GAMMALN'; $args = 1; break; |
|
| 5500 | - case 273: $function = 'BINOMDIST'; $args = 4; break; |
|
| 5501 | - case 274: $function = 'CHIDIST'; $args = 2; break; |
|
| 5502 | - case 275: $function = 'CHIINV'; $args = 2; break; |
|
| 5503 | - case 276: $function = 'COMBIN'; $args = 2; break; |
|
| 5504 | - case 277: $function = 'CONFIDENCE'; $args = 3; break; |
|
| 5505 | - case 278: $function = 'CRITBINOM'; $args = 3; break; |
|
| 5506 | - case 279: $function = 'EVEN'; $args = 1; break; |
|
| 5507 | - case 280: $function = 'EXPONDIST'; $args = 3; break; |
|
| 5508 | - case 281: $function = 'FDIST'; $args = 3; break; |
|
| 5509 | - case 282: $function = 'FINV'; $args = 3; break; |
|
| 5510 | - case 283: $function = 'FISHER'; $args = 1; break; |
|
| 5511 | - case 284: $function = 'FISHERINV'; $args = 1; break; |
|
| 5512 | - case 285: $function = 'FLOOR'; $args = 2; break; |
|
| 5513 | - case 286: $function = 'GAMMADIST'; $args = 4; break; |
|
| 5514 | - case 287: $function = 'GAMMAINV'; $args = 3; break; |
|
| 5515 | - case 288: $function = 'CEILING'; $args = 2; break; |
|
| 5516 | - case 289: $function = 'HYPGEOMDIST'; $args = 4; break; |
|
| 5517 | - case 290: $function = 'LOGNORMDIST'; $args = 3; break; |
|
| 5518 | - case 291: $function = 'LOGINV'; $args = 3; break; |
|
| 5519 | - case 292: $function = 'NEGBINOMDIST'; $args = 3; break; |
|
| 5520 | - case 293: $function = 'NORMDIST'; $args = 4; break; |
|
| 5521 | - case 294: $function = 'NORMSDIST'; $args = 1; break; |
|
| 5522 | - case 295: $function = 'NORMINV'; $args = 3; break; |
|
| 5523 | - case 296: $function = 'NORMSINV'; $args = 1; break; |
|
| 5524 | - case 297: $function = 'STANDARDIZE'; $args = 3; break; |
|
| 5525 | - case 298: $function = 'ODD'; $args = 1; break; |
|
| 5526 | - case 299: $function = 'PERMUT'; $args = 2; break; |
|
| 5527 | - case 300: $function = 'POISSON'; $args = 3; break; |
|
| 5528 | - case 301: $function = 'TDIST'; $args = 3; break; |
|
| 5529 | - case 302: $function = 'WEIBULL'; $args = 4; break; |
|
| 5530 | - case 303: $function = 'SUMXMY2'; $args = 2; break; |
|
| 5531 | - case 304: $function = 'SUMX2MY2'; $args = 2; break; |
|
| 5532 | - case 305: $function = 'SUMX2PY2'; $args = 2; break; |
|
| 5533 | - case 306: $function = 'CHITEST'; $args = 2; break; |
|
| 5534 | - case 307: $function = 'CORREL'; $args = 2; break; |
|
| 5535 | - case 308: $function = 'COVAR'; $args = 2; break; |
|
| 5536 | - case 309: $function = 'FORECAST'; $args = 3; break; |
|
| 5537 | - case 310: $function = 'FTEST'; $args = 2; break; |
|
| 5538 | - case 311: $function = 'INTERCEPT'; $args = 2; break; |
|
| 5539 | - case 312: $function = 'PEARSON'; $args = 2; break; |
|
| 5540 | - case 313: $function = 'RSQ'; $args = 2; break; |
|
| 5541 | - case 314: $function = 'STEYX'; $args = 2; break; |
|
| 5542 | - case 315: $function = 'SLOPE'; $args = 2; break; |
|
| 5543 | - case 316: $function = 'TTEST'; $args = 4; break; |
|
| 5544 | - case 325: $function = 'LARGE'; $args = 2; break; |
|
| 5545 | - case 326: $function = 'SMALL'; $args = 2; break; |
|
| 5546 | - case 327: $function = 'QUARTILE'; $args = 2; break; |
|
| 5547 | - case 328: $function = 'PERCENTILE'; $args = 2; break; |
|
| 5548 | - case 331: $function = 'TRIMMEAN'; $args = 2; break; |
|
| 5549 | - case 332: $function = 'TINV'; $args = 2; break; |
|
| 5550 | - case 337: $function = 'POWER'; $args = 2; break; |
|
| 5551 | - case 342: $function = 'RADIANS'; $args = 1; break; |
|
| 5552 | - case 343: $function = 'DEGREES'; $args = 1; break; |
|
| 5553 | - case 346: $function = 'COUNTIF'; $args = 2; break; |
|
| 5554 | - case 347: $function = 'COUNTBLANK'; $args = 1; break; |
|
| 5555 | - case 350: $function = 'ISPMT'; $args = 4; break; |
|
| 5556 | - case 351: $function = 'DATEDIF'; $args = 3; break; |
|
| 5557 | - case 352: $function = 'DATESTRING'; $args = 1; break; |
|
| 5558 | - case 353: $function = 'NUMBERSTRING'; $args = 2; break; |
|
| 5559 | - case 360: $function = 'PHONETIC'; $args = 1; break; |
|
| 5560 | - case 368: $function = 'BAHTTEXT'; $args = 1; break; |
|
| 5401 | + case 2: $function = 'ISNA'; $args = 1; break; |
|
| 5402 | + case 3: $function = 'ISERROR'; $args = 1; break; |
|
| 5403 | + case 10: $function = 'NA'; $args = 0; break; |
|
| 5404 | + case 15: $function = 'SIN'; $args = 1; break; |
|
| 5405 | + case 16: $function = 'COS'; $args = 1; break; |
|
| 5406 | + case 17: $function = 'TAN'; $args = 1; break; |
|
| 5407 | + case 18: $function = 'ATAN'; $args = 1; break; |
|
| 5408 | + case 19: $function = 'PI'; $args = 0; break; |
|
| 5409 | + case 20: $function = 'SQRT'; $args = 1; break; |
|
| 5410 | + case 21: $function = 'EXP'; $args = 1; break; |
|
| 5411 | + case 22: $function = 'LN'; $args = 1; break; |
|
| 5412 | + case 23: $function = 'LOG10'; $args = 1; break; |
|
| 5413 | + case 24: $function = 'ABS'; $args = 1; break; |
|
| 5414 | + case 25: $function = 'INT'; $args = 1; break; |
|
| 5415 | + case 26: $function = 'SIGN'; $args = 1; break; |
|
| 5416 | + case 27: $function = 'ROUND'; $args = 2; break; |
|
| 5417 | + case 30: $function = 'REPT'; $args = 2; break; |
|
| 5418 | + case 31: $function = 'MID'; $args = 3; break; |
|
| 5419 | + case 32: $function = 'LEN'; $args = 1; break; |
|
| 5420 | + case 33: $function = 'VALUE'; $args = 1; break; |
|
| 5421 | + case 34: $function = 'TRUE'; $args = 0; break; |
|
| 5422 | + case 35: $function = 'FALSE'; $args = 0; break; |
|
| 5423 | + case 38: $function = 'NOT'; $args = 1; break; |
|
| 5424 | + case 39: $function = 'MOD'; $args = 2; break; |
|
| 5425 | + case 40: $function = 'DCOUNT'; $args = 3; break; |
|
| 5426 | + case 41: $function = 'DSUM'; $args = 3; break; |
|
| 5427 | + case 42: $function = 'DAVERAGE'; $args = 3; break; |
|
| 5428 | + case 43: $function = 'DMIN'; $args = 3; break; |
|
| 5429 | + case 44: $function = 'DMAX'; $args = 3; break; |
|
| 5430 | + case 45: $function = 'DSTDEV'; $args = 3; break; |
|
| 5431 | + case 48: $function = 'TEXT'; $args = 2; break; |
|
| 5432 | + case 61: $function = 'MIRR'; $args = 3; break; |
|
| 5433 | + case 63: $function = 'RAND'; $args = 0; break; |
|
| 5434 | + case 65: $function = 'DATE'; $args = 3; break; |
|
| 5435 | + case 66: $function = 'TIME'; $args = 3; break; |
|
| 5436 | + case 67: $function = 'DAY'; $args = 1; break; |
|
| 5437 | + case 68: $function = 'MONTH'; $args = 1; break; |
|
| 5438 | + case 69: $function = 'YEAR'; $args = 1; break; |
|
| 5439 | + case 71: $function = 'HOUR'; $args = 1; break; |
|
| 5440 | + case 72: $function = 'MINUTE'; $args = 1; break; |
|
| 5441 | + case 73: $function = 'SECOND'; $args = 1; break; |
|
| 5442 | + case 74: $function = 'NOW'; $args = 0; break; |
|
| 5443 | + case 75: $function = 'AREAS'; $args = 1; break; |
|
| 5444 | + case 76: $function = 'ROWS'; $args = 1; break; |
|
| 5445 | + case 77: $function = 'COLUMNS'; $args = 1; break; |
|
| 5446 | + case 83: $function = 'TRANSPOSE'; $args = 1; break; |
|
| 5447 | + case 86: $function = 'TYPE'; $args = 1; break; |
|
| 5448 | + case 97: $function = 'ATAN2'; $args = 2; break; |
|
| 5449 | + case 98: $function = 'ASIN'; $args = 1; break; |
|
| 5450 | + case 99: $function = 'ACOS'; $args = 1; break; |
|
| 5451 | + case 105: $function = 'ISREF'; $args = 1; break; |
|
| 5452 | + case 111: $function = 'CHAR'; $args = 1; break; |
|
| 5453 | + case 112: $function = 'LOWER'; $args = 1; break; |
|
| 5454 | + case 113: $function = 'UPPER'; $args = 1; break; |
|
| 5455 | + case 114: $function = 'PROPER'; $args = 1; break; |
|
| 5456 | + case 117: $function = 'EXACT'; $args = 2; break; |
|
| 5457 | + case 118: $function = 'TRIM'; $args = 1; break; |
|
| 5458 | + case 119: $function = 'REPLACE'; $args = 4; break; |
|
| 5459 | + case 121: $function = 'CODE'; $args = 1; break; |
|
| 5460 | + case 126: $function = 'ISERR'; $args = 1; break; |
|
| 5461 | + case 127: $function = 'ISTEXT'; $args = 1; break; |
|
| 5462 | + case 128: $function = 'ISNUMBER'; $args = 1; break; |
|
| 5463 | + case 129: $function = 'ISBLANK'; $args = 1; break; |
|
| 5464 | + case 130: $function = 'T'; $args = 1; break; |
|
| 5465 | + case 131: $function = 'N'; $args = 1; break; |
|
| 5466 | + case 140: $function = 'DATEVALUE'; $args = 1; break; |
|
| 5467 | + case 141: $function = 'TIMEVALUE'; $args = 1; break; |
|
| 5468 | + case 142: $function = 'SLN'; $args = 3; break; |
|
| 5469 | + case 143: $function = 'SYD'; $args = 4; break; |
|
| 5470 | + case 162: $function = 'CLEAN'; $args = 1; break; |
|
| 5471 | + case 163: $function = 'MDETERM'; $args = 1; break; |
|
| 5472 | + case 164: $function = 'MINVERSE'; $args = 1; break; |
|
| 5473 | + case 165: $function = 'MMULT'; $args = 2; break; |
|
| 5474 | + case 184: $function = 'FACT'; $args = 1; break; |
|
| 5475 | + case 189: $function = 'DPRODUCT'; $args = 3; break; |
|
| 5476 | + case 190: $function = 'ISNONTEXT'; $args = 1; break; |
|
| 5477 | + case 195: $function = 'DSTDEVP'; $args = 3; break; |
|
| 5478 | + case 196: $function = 'DVARP'; $args = 3; break; |
|
| 5479 | + case 198: $function = 'ISLOGICAL'; $args = 1; break; |
|
| 5480 | + case 199: $function = 'DCOUNTA'; $args = 3; break; |
|
| 5481 | + case 207: $function = 'REPLACEB'; $args = 4; break; |
|
| 5482 | + case 210: $function = 'MIDB'; $args = 3; break; |
|
| 5483 | + case 211: $function = 'LENB'; $args = 1; break; |
|
| 5484 | + case 212: $function = 'ROUNDUP'; $args = 2; break; |
|
| 5485 | + case 213: $function = 'ROUNDDOWN'; $args = 2; break; |
|
| 5486 | + case 214: $function = 'ASC'; $args = 1; break; |
|
| 5487 | + case 215: $function = 'DBCS'; $args = 1; break; |
|
| 5488 | + case 221: $function = 'TODAY'; $args = 0; break; |
|
| 5489 | + case 229: $function = 'SINH'; $args = 1; break; |
|
| 5490 | + case 230: $function = 'COSH'; $args = 1; break; |
|
| 5491 | + case 231: $function = 'TANH'; $args = 1; break; |
|
| 5492 | + case 232: $function = 'ASINH'; $args = 1; break; |
|
| 5493 | + case 233: $function = 'ACOSH'; $args = 1; break; |
|
| 5494 | + case 234: $function = 'ATANH'; $args = 1; break; |
|
| 5495 | + case 235: $function = 'DGET'; $args = 3; break; |
|
| 5496 | + case 244: $function = 'INFO'; $args = 1; break; |
|
| 5497 | + case 252: $function = 'FREQUENCY'; $args = 2; break; |
|
| 5498 | + case 261: $function = 'ERROR.TYPE'; $args = 1; break; |
|
| 5499 | + case 271: $function = 'GAMMALN'; $args = 1; break; |
|
| 5500 | + case 273: $function = 'BINOMDIST'; $args = 4; break; |
|
| 5501 | + case 274: $function = 'CHIDIST'; $args = 2; break; |
|
| 5502 | + case 275: $function = 'CHIINV'; $args = 2; break; |
|
| 5503 | + case 276: $function = 'COMBIN'; $args = 2; break; |
|
| 5504 | + case 277: $function = 'CONFIDENCE'; $args = 3; break; |
|
| 5505 | + case 278: $function = 'CRITBINOM'; $args = 3; break; |
|
| 5506 | + case 279: $function = 'EVEN'; $args = 1; break; |
|
| 5507 | + case 280: $function = 'EXPONDIST'; $args = 3; break; |
|
| 5508 | + case 281: $function = 'FDIST'; $args = 3; break; |
|
| 5509 | + case 282: $function = 'FINV'; $args = 3; break; |
|
| 5510 | + case 283: $function = 'FISHER'; $args = 1; break; |
|
| 5511 | + case 284: $function = 'FISHERINV'; $args = 1; break; |
|
| 5512 | + case 285: $function = 'FLOOR'; $args = 2; break; |
|
| 5513 | + case 286: $function = 'GAMMADIST'; $args = 4; break; |
|
| 5514 | + case 287: $function = 'GAMMAINV'; $args = 3; break; |
|
| 5515 | + case 288: $function = 'CEILING'; $args = 2; break; |
|
| 5516 | + case 289: $function = 'HYPGEOMDIST'; $args = 4; break; |
|
| 5517 | + case 290: $function = 'LOGNORMDIST'; $args = 3; break; |
|
| 5518 | + case 291: $function = 'LOGINV'; $args = 3; break; |
|
| 5519 | + case 292: $function = 'NEGBINOMDIST'; $args = 3; break; |
|
| 5520 | + case 293: $function = 'NORMDIST'; $args = 4; break; |
|
| 5521 | + case 294: $function = 'NORMSDIST'; $args = 1; break; |
|
| 5522 | + case 295: $function = 'NORMINV'; $args = 3; break; |
|
| 5523 | + case 296: $function = 'NORMSINV'; $args = 1; break; |
|
| 5524 | + case 297: $function = 'STANDARDIZE'; $args = 3; break; |
|
| 5525 | + case 298: $function = 'ODD'; $args = 1; break; |
|
| 5526 | + case 299: $function = 'PERMUT'; $args = 2; break; |
|
| 5527 | + case 300: $function = 'POISSON'; $args = 3; break; |
|
| 5528 | + case 301: $function = 'TDIST'; $args = 3; break; |
|
| 5529 | + case 302: $function = 'WEIBULL'; $args = 4; break; |
|
| 5530 | + case 303: $function = 'SUMXMY2'; $args = 2; break; |
|
| 5531 | + case 304: $function = 'SUMX2MY2'; $args = 2; break; |
|
| 5532 | + case 305: $function = 'SUMX2PY2'; $args = 2; break; |
|
| 5533 | + case 306: $function = 'CHITEST'; $args = 2; break; |
|
| 5534 | + case 307: $function = 'CORREL'; $args = 2; break; |
|
| 5535 | + case 308: $function = 'COVAR'; $args = 2; break; |
|
| 5536 | + case 309: $function = 'FORECAST'; $args = 3; break; |
|
| 5537 | + case 310: $function = 'FTEST'; $args = 2; break; |
|
| 5538 | + case 311: $function = 'INTERCEPT'; $args = 2; break; |
|
| 5539 | + case 312: $function = 'PEARSON'; $args = 2; break; |
|
| 5540 | + case 313: $function = 'RSQ'; $args = 2; break; |
|
| 5541 | + case 314: $function = 'STEYX'; $args = 2; break; |
|
| 5542 | + case 315: $function = 'SLOPE'; $args = 2; break; |
|
| 5543 | + case 316: $function = 'TTEST'; $args = 4; break; |
|
| 5544 | + case 325: $function = 'LARGE'; $args = 2; break; |
|
| 5545 | + case 326: $function = 'SMALL'; $args = 2; break; |
|
| 5546 | + case 327: $function = 'QUARTILE'; $args = 2; break; |
|
| 5547 | + case 328: $function = 'PERCENTILE'; $args = 2; break; |
|
| 5548 | + case 331: $function = 'TRIMMEAN'; $args = 2; break; |
|
| 5549 | + case 332: $function = 'TINV'; $args = 2; break; |
|
| 5550 | + case 337: $function = 'POWER'; $args = 2; break; |
|
| 5551 | + case 342: $function = 'RADIANS'; $args = 1; break; |
|
| 5552 | + case 343: $function = 'DEGREES'; $args = 1; break; |
|
| 5553 | + case 346: $function = 'COUNTIF'; $args = 2; break; |
|
| 5554 | + case 347: $function = 'COUNTBLANK'; $args = 1; break; |
|
| 5555 | + case 350: $function = 'ISPMT'; $args = 4; break; |
|
| 5556 | + case 351: $function = 'DATEDIF'; $args = 3; break; |
|
| 5557 | + case 352: $function = 'DATESTRING'; $args = 1; break; |
|
| 5558 | + case 353: $function = 'NUMBERSTRING'; $args = 2; break; |
|
| 5559 | + case 360: $function = 'PHONETIC'; $args = 1; break; |
|
| 5560 | + case 368: $function = 'BAHTTEXT'; $args = 1; break; |
|
| 5561 | 5561 | default: |
| 5562 | 5562 | throw new Exception('Unrecognized function in formula'); |
| 5563 | 5563 | break; |
@@ -5574,94 +5574,94 @@ discard block |
||
| 5574 | 5574 | // offset: 2: size: 2; index to built-in sheet function |
| 5575 | 5575 | $index = self::_GetInt2d($formulaData, 2); |
| 5576 | 5576 | switch ($index) { |
| 5577 | - case 0: $function = 'COUNT'; break; |
|
| 5578 | - case 1: $function = 'IF'; break; |
|
| 5579 | - case 4: $function = 'SUM'; break; |
|
| 5580 | - case 5: $function = 'AVERAGE'; break; |
|
| 5581 | - case 6: $function = 'MIN'; break; |
|
| 5582 | - case 7: $function = 'MAX'; break; |
|
| 5583 | - case 8: $function = 'ROW'; break; |
|
| 5584 | - case 9: $function = 'COLUMN'; break; |
|
| 5585 | - case 11: $function = 'NPV'; break; |
|
| 5586 | - case 12: $function = 'STDEV'; break; |
|
| 5587 | - case 13: $function = 'DOLLAR'; break; |
|
| 5588 | - case 14: $function = 'FIXED'; break; |
|
| 5589 | - case 28: $function = 'LOOKUP'; break; |
|
| 5590 | - case 29: $function = 'INDEX'; break; |
|
| 5591 | - case 36: $function = 'AND'; break; |
|
| 5592 | - case 37: $function = 'OR'; break; |
|
| 5593 | - case 46: $function = 'VAR'; break; |
|
| 5594 | - case 49: $function = 'LINEST'; break; |
|
| 5595 | - case 50: $function = 'TREND'; break; |
|
| 5596 | - case 51: $function = 'LOGEST'; break; |
|
| 5597 | - case 52: $function = 'GROWTH'; break; |
|
| 5598 | - case 56: $function = 'PV'; break; |
|
| 5599 | - case 57: $function = 'FV'; break; |
|
| 5600 | - case 58: $function = 'NPER'; break; |
|
| 5601 | - case 59: $function = 'PMT'; break; |
|
| 5602 | - case 60: $function = 'RATE'; break; |
|
| 5603 | - case 62: $function = 'IRR'; break; |
|
| 5604 | - case 64: $function = 'MATCH'; break; |
|
| 5605 | - case 70: $function = 'WEEKDAY'; break; |
|
| 5606 | - case 78: $function = 'OFFSET'; break; |
|
| 5607 | - case 82: $function = 'SEARCH'; break; |
|
| 5608 | - case 100: $function = 'CHOOSE'; break; |
|
| 5609 | - case 101: $function = 'HLOOKUP'; break; |
|
| 5610 | - case 102: $function = 'VLOOKUP'; break; |
|
| 5611 | - case 109: $function = 'LOG'; break; |
|
| 5612 | - case 115: $function = 'LEFT'; break; |
|
| 5613 | - case 116: $function = 'RIGHT'; break; |
|
| 5614 | - case 120: $function = 'SUBSTITUTE'; break; |
|
| 5615 | - case 124: $function = 'FIND'; break; |
|
| 5616 | - case 125: $function = 'CELL'; break; |
|
| 5617 | - case 144: $function = 'DDB'; break; |
|
| 5618 | - case 148: $function = 'INDIRECT'; break; |
|
| 5619 | - case 167: $function = 'IPMT'; break; |
|
| 5620 | - case 168: $function = 'PPMT'; break; |
|
| 5621 | - case 169: $function = 'COUNTA'; break; |
|
| 5622 | - case 183: $function = 'PRODUCT'; break; |
|
| 5623 | - case 193: $function = 'STDEVP'; break; |
|
| 5624 | - case 194: $function = 'VARP'; break; |
|
| 5625 | - case 197: $function = 'TRUNC'; break; |
|
| 5626 | - case 204: $function = 'USDOLLAR'; break; |
|
| 5627 | - case 205: $function = 'FINDB'; break; |
|
| 5628 | - case 206: $function = 'SEARCHB'; break; |
|
| 5629 | - case 208: $function = 'LEFTB'; break; |
|
| 5630 | - case 209: $function = 'RIGHTB'; break; |
|
| 5631 | - case 216: $function = 'RANK'; break; |
|
| 5632 | - case 219: $function = 'ADDRESS'; break; |
|
| 5633 | - case 220: $function = 'DAYS360'; break; |
|
| 5634 | - case 222: $function = 'VDB'; break; |
|
| 5635 | - case 227: $function = 'MEDIAN'; break; |
|
| 5636 | - case 228: $function = 'SUMPRODUCT'; break; |
|
| 5637 | - case 247: $function = 'DB'; break; |
|
| 5638 | - case 255: $function = ''; break; |
|
| 5639 | - case 269: $function = 'AVEDEV'; break; |
|
| 5640 | - case 270: $function = 'BETADIST'; break; |
|
| 5641 | - case 272: $function = 'BETAINV'; break; |
|
| 5642 | - case 317: $function = 'PROB'; break; |
|
| 5643 | - case 318: $function = 'DEVSQ'; break; |
|
| 5644 | - case 319: $function = 'GEOMEAN'; break; |
|
| 5645 | - case 320: $function = 'HARMEAN'; break; |
|
| 5646 | - case 321: $function = 'SUMSQ'; break; |
|
| 5647 | - case 322: $function = 'KURT'; break; |
|
| 5648 | - case 323: $function = 'SKEW'; break; |
|
| 5649 | - case 324: $function = 'ZTEST'; break; |
|
| 5650 | - case 329: $function = 'PERCENTRANK'; break; |
|
| 5651 | - case 330: $function = 'MODE'; break; |
|
| 5652 | - case 336: $function = 'CONCATENATE'; break; |
|
| 5653 | - case 344: $function = 'SUBTOTAL'; break; |
|
| 5654 | - case 345: $function = 'SUMIF'; break; |
|
| 5655 | - case 354: $function = 'ROMAN'; break; |
|
| 5656 | - case 358: $function = 'GETPIVOTDATA'; break; |
|
| 5657 | - case 359: $function = 'HYPERLINK'; break; |
|
| 5658 | - case 361: $function = 'AVERAGEA'; break; |
|
| 5659 | - case 362: $function = 'MAXA'; break; |
|
| 5660 | - case 363: $function = 'MINA'; break; |
|
| 5661 | - case 364: $function = 'STDEVPA'; break; |
|
| 5662 | - case 365: $function = 'VARPA'; break; |
|
| 5663 | - case 366: $function = 'STDEVA'; break; |
|
| 5664 | - case 367: $function = 'VARA'; break; |
|
| 5577 | + case 0: $function = 'COUNT'; break; |
|
| 5578 | + case 1: $function = 'IF'; break; |
|
| 5579 | + case 4: $function = 'SUM'; break; |
|
| 5580 | + case 5: $function = 'AVERAGE'; break; |
|
| 5581 | + case 6: $function = 'MIN'; break; |
|
| 5582 | + case 7: $function = 'MAX'; break; |
|
| 5583 | + case 8: $function = 'ROW'; break; |
|
| 5584 | + case 9: $function = 'COLUMN'; break; |
|
| 5585 | + case 11: $function = 'NPV'; break; |
|
| 5586 | + case 12: $function = 'STDEV'; break; |
|
| 5587 | + case 13: $function = 'DOLLAR'; break; |
|
| 5588 | + case 14: $function = 'FIXED'; break; |
|
| 5589 | + case 28: $function = 'LOOKUP'; break; |
|
| 5590 | + case 29: $function = 'INDEX'; break; |
|
| 5591 | + case 36: $function = 'AND'; break; |
|
| 5592 | + case 37: $function = 'OR'; break; |
|
| 5593 | + case 46: $function = 'VAR'; break; |
|
| 5594 | + case 49: $function = 'LINEST'; break; |
|
| 5595 | + case 50: $function = 'TREND'; break; |
|
| 5596 | + case 51: $function = 'LOGEST'; break; |
|
| 5597 | + case 52: $function = 'GROWTH'; break; |
|
| 5598 | + case 56: $function = 'PV'; break; |
|
| 5599 | + case 57: $function = 'FV'; break; |
|
| 5600 | + case 58: $function = 'NPER'; break; |
|
| 5601 | + case 59: $function = 'PMT'; break; |
|
| 5602 | + case 60: $function = 'RATE'; break; |
|
| 5603 | + case 62: $function = 'IRR'; break; |
|
| 5604 | + case 64: $function = 'MATCH'; break; |
|
| 5605 | + case 70: $function = 'WEEKDAY'; break; |
|
| 5606 | + case 78: $function = 'OFFSET'; break; |
|
| 5607 | + case 82: $function = 'SEARCH'; break; |
|
| 5608 | + case 100: $function = 'CHOOSE'; break; |
|
| 5609 | + case 101: $function = 'HLOOKUP'; break; |
|
| 5610 | + case 102: $function = 'VLOOKUP'; break; |
|
| 5611 | + case 109: $function = 'LOG'; break; |
|
| 5612 | + case 115: $function = 'LEFT'; break; |
|
| 5613 | + case 116: $function = 'RIGHT'; break; |
|
| 5614 | + case 120: $function = 'SUBSTITUTE'; break; |
|
| 5615 | + case 124: $function = 'FIND'; break; |
|
| 5616 | + case 125: $function = 'CELL'; break; |
|
| 5617 | + case 144: $function = 'DDB'; break; |
|
| 5618 | + case 148: $function = 'INDIRECT'; break; |
|
| 5619 | + case 167: $function = 'IPMT'; break; |
|
| 5620 | + case 168: $function = 'PPMT'; break; |
|
| 5621 | + case 169: $function = 'COUNTA'; break; |
|
| 5622 | + case 183: $function = 'PRODUCT'; break; |
|
| 5623 | + case 193: $function = 'STDEVP'; break; |
|
| 5624 | + case 194: $function = 'VARP'; break; |
|
| 5625 | + case 197: $function = 'TRUNC'; break; |
|
| 5626 | + case 204: $function = 'USDOLLAR'; break; |
|
| 5627 | + case 205: $function = 'FINDB'; break; |
|
| 5628 | + case 206: $function = 'SEARCHB'; break; |
|
| 5629 | + case 208: $function = 'LEFTB'; break; |
|
| 5630 | + case 209: $function = 'RIGHTB'; break; |
|
| 5631 | + case 216: $function = 'RANK'; break; |
|
| 5632 | + case 219: $function = 'ADDRESS'; break; |
|
| 5633 | + case 220: $function = 'DAYS360'; break; |
|
| 5634 | + case 222: $function = 'VDB'; break; |
|
| 5635 | + case 227: $function = 'MEDIAN'; break; |
|
| 5636 | + case 228: $function = 'SUMPRODUCT'; break; |
|
| 5637 | + case 247: $function = 'DB'; break; |
|
| 5638 | + case 255: $function = ''; break; |
|
| 5639 | + case 269: $function = 'AVEDEV'; break; |
|
| 5640 | + case 270: $function = 'BETADIST'; break; |
|
| 5641 | + case 272: $function = 'BETAINV'; break; |
|
| 5642 | + case 317: $function = 'PROB'; break; |
|
| 5643 | + case 318: $function = 'DEVSQ'; break; |
|
| 5644 | + case 319: $function = 'GEOMEAN'; break; |
|
| 5645 | + case 320: $function = 'HARMEAN'; break; |
|
| 5646 | + case 321: $function = 'SUMSQ'; break; |
|
| 5647 | + case 322: $function = 'KURT'; break; |
|
| 5648 | + case 323: $function = 'SKEW'; break; |
|
| 5649 | + case 324: $function = 'ZTEST'; break; |
|
| 5650 | + case 329: $function = 'PERCENTRANK'; break; |
|
| 5651 | + case 330: $function = 'MODE'; break; |
|
| 5652 | + case 336: $function = 'CONCATENATE'; break; |
|
| 5653 | + case 344: $function = 'SUBTOTAL'; break; |
|
| 5654 | + case 345: $function = 'SUMIF'; break; |
|
| 5655 | + case 354: $function = 'ROMAN'; break; |
|
| 5656 | + case 358: $function = 'GETPIVOTDATA'; break; |
|
| 5657 | + case 359: $function = 'HYPERLINK'; break; |
|
| 5658 | + case 361: $function = 'AVERAGEA'; break; |
|
| 5659 | + case 362: $function = 'MAXA'; break; |
|
| 5660 | + case 363: $function = 'MINA'; break; |
|
| 5661 | + case 364: $function = 'STDEVPA'; break; |
|
| 5662 | + case 365: $function = 'VARPA'; break; |
|
| 5663 | + case 366: $function = 'STDEVA'; break; |
|
| 5664 | + case 367: $function = 'VARA'; break; |
|
| 5665 | 5665 | default: |
| 5666 | 5666 | throw new Exception('Unrecognized function in formula'); |
| 5667 | 5667 | break; |
@@ -5791,7 +5791,7 @@ discard block |
||
| 5791 | 5791 | break; |
| 5792 | 5792 | // Unknown cases // don't know how to deal with |
| 5793 | 5793 | default: |
| 5794 | - throw new Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula'); |
|
| 5794 | + throw new Exception('Unrecognized token '.sprintf('%02X', $id).' in formula'); |
|
| 5795 | 5795 | break; |
| 5796 | 5796 | } |
| 5797 | 5797 | |
@@ -5822,15 +5822,15 @@ discard block |
||
| 5822 | 5822 | $column = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($cellAddressStructure, 2)); |
| 5823 | 5823 | |
| 5824 | 5824 | // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) |
| 5825 | - if (!(0x4000 & self::_GetInt2d($cellAddressStructure, 2))) { |
|
| 5826 | - $column = '$' . $column; |
|
| 5825 | + if ( ! (0x4000 & self::_GetInt2d($cellAddressStructure, 2))) { |
|
| 5826 | + $column = '$'.$column; |
|
| 5827 | 5827 | } |
| 5828 | 5828 | // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) |
| 5829 | - if (!(0x8000 & self::_GetInt2d($cellAddressStructure, 2))) { |
|
| 5830 | - $row = '$' . $row; |
|
| 5829 | + if ( ! (0x8000 & self::_GetInt2d($cellAddressStructure, 2))) { |
|
| 5830 | + $row = '$'.$row; |
|
| 5831 | 5831 | } |
| 5832 | 5832 | |
| 5833 | - return $column . $row; |
|
| 5833 | + return $column.$row; |
|
| 5834 | 5834 | } |
| 5835 | 5835 | |
| 5836 | 5836 | |
@@ -5858,23 +5858,23 @@ discard block |
||
| 5858 | 5858 | $colIndex = 0x00FF & self::_GetInt2d($cellAddressStructure, 2); |
| 5859 | 5859 | |
| 5860 | 5860 | // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) |
| 5861 | - if (!(0x4000 & self::_GetInt2d($cellAddressStructure, 2))) { |
|
| 5861 | + if ( ! (0x4000 & self::_GetInt2d($cellAddressStructure, 2))) { |
|
| 5862 | 5862 | $column = PHPExcel_Cell::stringFromColumnIndex($colIndex); |
| 5863 | - $column = '$' . $column; |
|
| 5863 | + $column = '$'.$column; |
|
| 5864 | 5864 | } else { |
| 5865 | 5865 | $colIndex = ($colIndex <= 127) ? $colIndex : $colIndex - 256; |
| 5866 | 5866 | $column = PHPExcel_Cell::stringFromColumnIndex($baseCol + $colIndex); |
| 5867 | 5867 | } |
| 5868 | 5868 | |
| 5869 | 5869 | // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) |
| 5870 | - if (!(0x8000 & self::_GetInt2d($cellAddressStructure, 2))) { |
|
| 5871 | - $row = '$' . $row; |
|
| 5870 | + if ( ! (0x8000 & self::_GetInt2d($cellAddressStructure, 2))) { |
|
| 5871 | + $row = '$'.$row; |
|
| 5872 | 5872 | } else { |
| 5873 | 5873 | $rowIndex = ($rowIndex <= 32767) ? $rowIndex : $rowIndex - 65536; |
| 5874 | 5874 | $row = $baseRow + $rowIndex; |
| 5875 | 5875 | } |
| 5876 | 5876 | |
| 5877 | - return $column . $row; |
|
| 5877 | + return $column.$row; |
|
| 5878 | 5878 | } |
| 5879 | 5879 | |
| 5880 | 5880 | |
@@ -5981,13 +5981,13 @@ discard block |
||
| 5981 | 5981 | $fc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($subData, 4)); |
| 5982 | 5982 | |
| 5983 | 5983 | // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) |
| 5984 | - if (!(0x4000 & self::_GetInt2d($subData, 4))) { |
|
| 5985 | - $fc = '$' . $fc; |
|
| 5984 | + if ( ! (0x4000 & self::_GetInt2d($subData, 4))) { |
|
| 5985 | + $fc = '$'.$fc; |
|
| 5986 | 5986 | } |
| 5987 | 5987 | |
| 5988 | 5988 | // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) |
| 5989 | - if (!(0x8000 & self::_GetInt2d($subData, 4))) { |
|
| 5990 | - $fr = '$' . $fr; |
|
| 5989 | + if ( ! (0x8000 & self::_GetInt2d($subData, 4))) { |
|
| 5990 | + $fr = '$'.$fr; |
|
| 5991 | 5991 | } |
| 5992 | 5992 | |
| 5993 | 5993 | // offset: 6; size: 2; index to last column or column offset + relative flags |
@@ -5996,13 +5996,13 @@ discard block |
||
| 5996 | 5996 | $lc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($subData, 6)); |
| 5997 | 5997 | |
| 5998 | 5998 | // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) |
| 5999 | - if (!(0x4000 & self::_GetInt2d($subData, 6))) { |
|
| 6000 | - $lc = '$' . $lc; |
|
| 5999 | + if ( ! (0x4000 & self::_GetInt2d($subData, 6))) { |
|
| 6000 | + $lc = '$'.$lc; |
|
| 6001 | 6001 | } |
| 6002 | 6002 | |
| 6003 | 6003 | // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) |
| 6004 | - if (!(0x8000 & self::_GetInt2d($subData, 6))) { |
|
| 6005 | - $lr = '$' . $lr; |
|
| 6004 | + if ( ! (0x8000 & self::_GetInt2d($subData, 6))) { |
|
| 6005 | + $lr = '$'.$lr; |
|
| 6006 | 6006 | } |
| 6007 | 6007 | |
| 6008 | 6008 | return "$fc$fr:$lc$lr"; |
@@ -6038,10 +6038,10 @@ discard block |
||
| 6038 | 6038 | $fcIndex = 0x00FF & self::_GetInt2d($subData, 4); |
| 6039 | 6039 | |
| 6040 | 6040 | // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) |
| 6041 | - if (!(0x4000 & self::_GetInt2d($subData, 4))) { |
|
| 6041 | + if ( ! (0x4000 & self::_GetInt2d($subData, 4))) { |
|
| 6042 | 6042 | // absolute column index |
| 6043 | 6043 | $fc = PHPExcel_Cell::stringFromColumnIndex($fcIndex); |
| 6044 | - $fc = '$' . $fc; |
|
| 6044 | + $fc = '$'.$fc; |
|
| 6045 | 6045 | } else { |
| 6046 | 6046 | // column offset |
| 6047 | 6047 | $fcIndex = ($fcIndex <= 127) ? $fcIndex : $fcIndex - 256; |
@@ -6049,10 +6049,10 @@ discard block |
||
| 6049 | 6049 | } |
| 6050 | 6050 | |
| 6051 | 6051 | // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) |
| 6052 | - if (!(0x8000 & self::_GetInt2d($subData, 4))) { |
|
| 6052 | + if ( ! (0x8000 & self::_GetInt2d($subData, 4))) { |
|
| 6053 | 6053 | // absolute row index |
| 6054 | 6054 | $fr = $frIndex + 1; |
| 6055 | - $fr = '$' . $fr; |
|
| 6055 | + $fr = '$'.$fr; |
|
| 6056 | 6056 | } else { |
| 6057 | 6057 | // row offset |
| 6058 | 6058 | $frIndex = ($frIndex <= 32767) ? $frIndex : $frIndex - 65536; |
@@ -6067,10 +6067,10 @@ discard block |
||
| 6067 | 6067 | $lc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $lcIndex); |
| 6068 | 6068 | |
| 6069 | 6069 | // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) |
| 6070 | - if (!(0x4000 & self::_GetInt2d($subData, 6))) { |
|
| 6070 | + if ( ! (0x4000 & self::_GetInt2d($subData, 6))) { |
|
| 6071 | 6071 | // absolute column index |
| 6072 | 6072 | $lc = PHPExcel_Cell::stringFromColumnIndex($lcIndex); |
| 6073 | - $lc = '$' . $lc; |
|
| 6073 | + $lc = '$'.$lc; |
|
| 6074 | 6074 | } else { |
| 6075 | 6075 | // column offset |
| 6076 | 6076 | $lcIndex = ($lcIndex <= 127) ? $lcIndex : $lcIndex - 256; |
@@ -6078,10 +6078,10 @@ discard block |
||
| 6078 | 6078 | } |
| 6079 | 6079 | |
| 6080 | 6080 | // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) |
| 6081 | - if (!(0x8000 & self::_GetInt2d($subData, 6))) { |
|
| 6081 | + if ( ! (0x8000 & self::_GetInt2d($subData, 6))) { |
|
| 6082 | 6082 | // absolute row index |
| 6083 | 6083 | $lr = $lrIndex + 1; |
| 6084 | - $lr = '$' . $lr; |
|
| 6084 | + $lr = '$'.$lr; |
|
| 6085 | 6085 | } else { |
| 6086 | 6086 | // row offset |
| 6087 | 6087 | $lrIndex = ($lrIndex <= 32767) ? $lrIndex : $lrIndex - 65536; |
@@ -6236,7 +6236,7 @@ discard block |
||
| 6236 | 6236 | } |
| 6237 | 6237 | $matrixChunks[] = implode(',', $items); // looks like e.g. '1,"hello"' |
| 6238 | 6238 | } |
| 6239 | - $matrix = '{' . implode(';', $matrixChunks) . '}'; |
|
| 6239 | + $matrix = '{'.implode(';', $matrixChunks).'}'; |
|
| 6240 | 6240 | |
| 6241 | 6241 | return array( |
| 6242 | 6242 | 'value' => $matrix, |
@@ -6271,7 +6271,7 @@ discard block |
||
| 6271 | 6271 | case 0x02: // string value |
| 6272 | 6272 | // offset: 1; size: var; Unicode string, 16-bit string length |
| 6273 | 6273 | $string = self::_readUnicodeStringLong(substr($valueData, 1)); |
| 6274 | - $value = '"' . $string['value'] . '"'; |
|
| 6274 | + $value = '"'.$string['value'].'"'; |
|
| 6275 | 6275 | $size = 1 + $string['size']; |
| 6276 | 6276 | break; |
| 6277 | 6277 | case 0x04: // boolean |
@@ -6430,7 +6430,7 @@ discard block |
||
| 6430 | 6430 | // offset: 0: size: 1; option flags |
| 6431 | 6431 | |
| 6432 | 6432 | // bit: 0; mask: 0x01; character compression (0 = compressed 8-bit, 1 = uncompressed 16-bit) |
| 6433 | - $isCompressed = !((0x01 & ord($subData[0])) >> 0); |
|
| 6433 | + $isCompressed = ! ((0x01 & ord($subData[0])) >> 0); |
|
| 6434 | 6434 | |
| 6435 | 6435 | // bit: 2; mask: 0x04; Asian phonetic settings |
| 6436 | 6436 | $hasAsian = (0x04) & ord($subData[0]) >> 2; |
@@ -6459,7 +6459,7 @@ discard block |
||
| 6459 | 6459 | */ |
| 6460 | 6460 | private static function _UTF8toExcelDoubleQuoted($value) |
| 6461 | 6461 | { |
| 6462 | - return '"' . str_replace('"', '""', $value) . '"'; |
|
| 6462 | + return '"'.str_replace('"', '""', $value).'"'; |
|
| 6463 | 6463 | } |
| 6464 | 6464 | |
| 6465 | 6465 | |
@@ -6478,13 +6478,13 @@ discard block |
||
| 6478 | 6478 | $mantissa = (0x100000 | ($rknumhigh & 0x000fffff)); |
| 6479 | 6479 | $mantissalow1 = ($rknumlow & 0x80000000) >> 31; |
| 6480 | 6480 | $mantissalow2 = ($rknumlow & 0x7fffffff); |
| 6481 | - $value = $mantissa / pow( 2 , (20 - $exp)); |
|
| 6481 | + $value = $mantissa / pow(2, (20 - $exp)); |
|
| 6482 | 6482 | |
| 6483 | 6483 | if ($mantissalow1 != 0) { |
| 6484 | - $value += 1 / pow (2 , (21 - $exp)); |
|
| 6484 | + $value += 1 / pow(2, (21 - $exp)); |
|
| 6485 | 6485 | } |
| 6486 | 6486 | |
| 6487 | - $value += $mantissalow2 / pow (2 , (52 - $exp)); |
|
| 6487 | + $value += $mantissalow2 / pow(2, (52 - $exp)); |
|
| 6488 | 6488 | if ($sign) { |
| 6489 | 6489 | $value *= -1; |
| 6490 | 6490 | } |
@@ -6506,7 +6506,7 @@ discard block |
||
| 6506 | 6506 | $sign = ($rknum & 0x80000000) >> 31; |
| 6507 | 6507 | $exp = ($rknum & 0x7ff00000) >> 20; |
| 6508 | 6508 | $mantissa = (0x100000 | ($rknum & 0x000ffffc)); |
| 6509 | - $value = $mantissa / pow( 2 , (20- ($exp - 1023))); |
|
| 6509 | + $value = $mantissa / pow(2, (20 - ($exp - 1023))); |
|
| 6510 | 6510 | if ($sign) { |
| 6511 | 6511 | $value = -1 * $value; |
| 6512 | 6512 | } |
@@ -6547,7 +6547,7 @@ discard block |
||
| 6547 | 6547 | $uncompressedString = ''; |
| 6548 | 6548 | $strLen = strlen($string); |
| 6549 | 6549 | for ($i = 0; $i < $strLen; ++$i) { |
| 6550 | - $uncompressedString .= $string[$i] . "\0"; |
|
| 6550 | + $uncompressedString .= $string[$i]."\0"; |
|
| 6551 | 6551 | } |
| 6552 | 6552 | |
| 6553 | 6553 | return $uncompressedString; |
@@ -6575,7 +6575,7 @@ discard block |
||
| 6575 | 6575 | */ |
| 6576 | 6576 | public static function _GetInt2d($data, $pos) |
| 6577 | 6577 | { |
| 6578 | - return ord($data[$pos]) | (ord($data[$pos+1]) << 8); |
|
| 6578 | + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8); |
|
| 6579 | 6579 | } |
| 6580 | 6580 | |
| 6581 | 6581 | |
@@ -6598,7 +6598,7 @@ discard block |
||
| 6598 | 6598 | } else { |
| 6599 | 6599 | $_ord_24 = ($_or_24 & 127) << 24; |
| 6600 | 6600 | } |
| 6601 | - return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24; |
|
| 6601 | + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24; |
|
| 6602 | 6602 | } |
| 6603 | 6603 | |
| 6604 | 6604 | |
@@ -6609,7 +6609,7 @@ discard block |
||
| 6609 | 6609 | * @param array $palette Color palette |
| 6610 | 6610 | * @return array RGB color value, example: array('rgb' => 'FF0000') |
| 6611 | 6611 | */ |
| 6612 | - private static function _readColor($color,$palette,$version) |
|
| 6612 | + private static function _readColor($color, $palette, $version) |
|
| 6613 | 6613 | { |
| 6614 | 6614 | if ($color <= 0x07 || $color >= 0x40) { |
| 6615 | 6615 | // special built-in color |
@@ -6703,13 +6703,13 @@ discard block |
||
| 6703 | 6703 | private static function _mapErrorCode($subData) |
| 6704 | 6704 | { |
| 6705 | 6705 | switch ($subData) { |
| 6706 | - case 0x00: return '#NULL!'; break; |
|
| 6707 | - case 0x07: return '#DIV/0!'; break; |
|
| 6708 | - case 0x0F: return '#VALUE!'; break; |
|
| 6709 | - case 0x17: return '#REF!'; break; |
|
| 6710 | - case 0x1D: return '#NAME?'; break; |
|
| 6711 | - case 0x24: return '#NUM!'; break; |
|
| 6712 | - case 0x2A: return '#N/A'; break; |
|
| 6706 | + case 0x00: return '#NULL!'; break; |
|
| 6707 | + case 0x07: return '#DIV/0!'; break; |
|
| 6708 | + case 0x0F: return '#VALUE!'; break; |
|
| 6709 | + case 0x17: return '#REF!'; break; |
|
| 6710 | + case 0x1D: return '#NAME?'; break; |
|
| 6711 | + case 0x24: return '#NUM!'; break; |
|
| 6712 | + case 0x2A: return '#N/A'; break; |
|
| 6713 | 6713 | default: return false; |
| 6714 | 6714 | } |
| 6715 | 6715 | } |
@@ -1768,12 +1768,16 @@ |
||
| 1768 | 1768 | // bit: 0; mask 0x0001; bold (redundant in BIFF5-BIFF8) |
| 1769 | 1769 | // bit: 1; mask 0x0002; italic |
| 1770 | 1770 | $isItalic = (0x0002 & self::_GetInt2d($recordData, 2)) >> 1; |
| 1771 | - if ($isItalic) $objFont->setItalic(true); |
|
| 1771 | + if ($isItalic) { |
|
| 1772 | + $objFont->setItalic(true); |
|
| 1773 | + } |
|
| 1772 | 1774 | |
| 1773 | 1775 | // bit: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8) |
| 1774 | 1776 | // bit: 3; mask 0x0008; strike |
| 1775 | 1777 | $isStrike = (0x0008 & self::_GetInt2d($recordData, 2)) >> 3; |
| 1776 | - if ($isStrike) $objFont->setStrikethrough(true); |
|
| 1778 | + if ($isStrike) { |
|
| 1779 | + $objFont->setStrikethrough(true); |
|
| 1780 | + } |
|
| 1777 | 1781 | |
| 1778 | 1782 | // offset: 4; size: 2; colour index |
| 1779 | 1783 | $colorIndex = self::_GetInt2d($recordData, 4); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | /** |
| 190 | 190 | * Can the current PHPExcel_Reader_IReader read the file? |
| 191 | 191 | * |
| 192 | - * @param string $pFileName |
|
| 192 | + * @param string $pFilename |
|
| 193 | 193 | * @return boolean |
| 194 | 194 | * @throws Exception |
| 195 | 195 | */ |
@@ -268,6 +268,9 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | |
| 271 | + /** |
|
| 272 | + * @param string $filename |
|
| 273 | + */ |
|
| 271 | 274 | private function _gzfileGetContents($filename) { |
| 272 | 275 | $file = @gzopen($filename, 'rb'); |
| 273 | 276 | if ($file !== false) { |
@@ -363,7 +363,7 @@ |
||
| 363 | 363 | // Document Properties are held differently, depending on the version of Gnumeric |
| 364 | 364 | if (isset($namespacesMeta['office'])) { |
| 365 | 365 | $officeXML = $xml->children($namespacesMeta['office']); |
| 366 | - $officeDocXML = $officeXML->{'document-meta'}; |
|
| 366 | + $officeDocXML = $officeXML->{'document-meta'}; |
|
| 367 | 367 | $officeDocMetaXML = $officeDocXML->meta; |
| 368 | 368 | |
| 369 | 369 | foreach($officeDocMetaXML as $officePropertyData) { |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | /** PHPExcel root directory */ |
| 30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
| 30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
| 31 | 31 | /** |
| 32 | 32 | * @ignore |
| 33 | 33 | */ |
| 34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
| 35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
| 34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
| 35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * Create a new PHPExcel_Reader_Gnumeric |
| 90 | 90 | */ |
| 91 | 91 | public function __construct() { |
| 92 | - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
| 92 | + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
| 93 | 93 | $this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance(); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -196,12 +196,12 @@ discard block |
||
| 196 | 196 | public function canRead($pFilename) |
| 197 | 197 | { |
| 198 | 198 | // Check if file exists |
| 199 | - if (!file_exists($pFilename)) { |
|
| 200 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 199 | + if ( ! file_exists($pFilename)) { |
|
| 200 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | // Check if gzlib functions are available |
| 204 | - if (!function_exists('gzread')) { |
|
| 204 | + if ( ! function_exists('gzread')) { |
|
| 205 | 205 | throw new Exception("gzlib library is not enabled"); |
| 206 | 206 | } |
| 207 | 207 | |
@@ -227,8 +227,8 @@ discard block |
||
| 227 | 227 | public function listWorksheetInfo($pFilename) |
| 228 | 228 | { |
| 229 | 229 | // Check if file exists |
| 230 | - if (!file_exists($pFilename)) { |
|
| 231 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 230 | + if ( ! file_exists($pFilename)) { |
|
| 231 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | $gFileData = $this->_gzfileGetContents($pFilename); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $file = @gzopen($filename, 'rb'); |
| 273 | 273 | if ($file !== false) { |
| 274 | 274 | $data = ''; |
| 275 | - while (!gzeof($file)) { |
|
| 275 | + while ( ! gzeof($file)) { |
|
| 276 | 276 | $data .= gzread($file, 1024); |
| 277 | 277 | } |
| 278 | 278 | gzclose($file); |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | public function listWorksheetNames($pFilename) |
| 308 | 308 | { |
| 309 | 309 | // Check if file exists |
| 310 | - if (!file_exists($pFilename)) { |
|
| 311 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 310 | + if ( ! file_exists($pFilename)) { |
|
| 311 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $gFileData = $this->_gzfileGetContents($pFilename); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $worksheetNames = array(); |
| 322 | 322 | |
| 323 | - foreach($gnmXML->Sheets->Sheet as $sheet) { |
|
| 323 | + foreach ($gnmXML->Sheets->Sheet as $sheet) { |
|
| 324 | 324 | $worksheetNames[] = (string) $sheet->Name; |
| 325 | 325 | } |
| 326 | 326 | |
@@ -339,8 +339,8 @@ discard block |
||
| 339 | 339 | public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) |
| 340 | 340 | { |
| 341 | 341 | // Check if file exists |
| 342 | - if (!file_exists($pFilename)) { |
|
| 343 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
| 342 | + if ( ! file_exists($pFilename)) { |
|
| 343 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | $timezoneObj = new DateTimeZone('Europe/London'); |
@@ -366,13 +366,13 @@ discard block |
||
| 366 | 366 | $officeDocXML = $officeXML->{'document-meta'}; |
| 367 | 367 | $officeDocMetaXML = $officeDocXML->meta; |
| 368 | 368 | |
| 369 | - foreach($officeDocMetaXML as $officePropertyData) { |
|
| 369 | + foreach ($officeDocMetaXML as $officePropertyData) { |
|
| 370 | 370 | |
| 371 | 371 | $officePropertyDC = array(); |
| 372 | 372 | if (isset($namespacesMeta['dc'])) { |
| 373 | 373 | $officePropertyDC = $officePropertyData->children($namespacesMeta['dc']); |
| 374 | 374 | } |
| 375 | - foreach($officePropertyDC as $propertyName => $propertyValue) { |
|
| 375 | + foreach ($officePropertyDC as $propertyName => $propertyValue) { |
|
| 376 | 376 | $propertyValue = (string) $propertyValue; |
| 377 | 377 | switch ($propertyName) { |
| 378 | 378 | case 'title' : |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | if (isset($namespacesMeta['meta'])) { |
| 400 | 400 | $officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']); |
| 401 | 401 | } |
| 402 | - foreach($officePropertyMeta as $propertyName => $propertyValue) { |
|
| 402 | + foreach ($officePropertyMeta as $propertyName => $propertyValue) { |
|
| 403 | 403 | $attributes = $propertyValue->attributes($namespacesMeta['meta']); |
| 404 | 404 | $propertyValue = (string) $propertyValue; |
| 405 | 405 | switch ($propertyName) { |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $docProps->setModified($creationDate); |
| 417 | 417 | break; |
| 418 | 418 | case 'user-defined' : |
| 419 | - list(,$attrName) = explode(':',$attributes['name']); |
|
| 419 | + list(,$attrName) = explode(':', $attributes['name']); |
|
| 420 | 420 | switch ($attrName) { |
| 421 | 421 | case 'publisher' : |
| 422 | 422 | $docProps->setCompany(trim($propertyValue)); |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | 435 | } elseif (isset($gnmXML->Summary)) { |
| 436 | - foreach($gnmXML->Summary->Item as $summaryItem) { |
|
| 436 | + foreach ($gnmXML->Summary->Item as $summaryItem) { |
|
| 437 | 437 | $propertyName = $summaryItem->name; |
| 438 | 438 | $propertyValue = $summaryItem->{'val-string'}; |
| 439 | 439 | switch ($propertyName) { |
@@ -464,10 +464,10 @@ discard block |
||
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | $worksheetID = 0; |
| 467 | - foreach($gnmXML->Sheets->Sheet as $sheet) { |
|
| 467 | + foreach ($gnmXML->Sheets->Sheet as $sheet) { |
|
| 468 | 468 | $worksheetName = (string) $sheet->Name; |
| 469 | 469 | // echo '<b>Worksheet: ',$worksheetName,'</b><br />'; |
| 470 | - if ((isset($this->_loadSheetsOnly)) && (!in_array($worksheetName, $this->_loadSheetsOnly))) { |
|
| 470 | + if ((isset($this->_loadSheetsOnly)) && ( ! in_array($worksheetName, $this->_loadSheetsOnly))) { |
|
| 471 | 471 | continue; |
| 472 | 472 | } |
| 473 | 473 | |
@@ -479,19 +479,19 @@ discard block |
||
| 479 | 479 | // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula |
| 480 | 480 | // cells... during the load, all formulae should be correct, and we're simply bringing the worksheet |
| 481 | 481 | // name in line with the formula, not the reverse |
| 482 | - $objPHPExcel->getActiveSheet()->setTitle($worksheetName,false); |
|
| 482 | + $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false); |
|
| 483 | 483 | |
| 484 | - if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) { |
|
| 484 | + if (( ! $this->_readDataOnly) && (isset($sheet->PrintInformation))) { |
|
| 485 | 485 | if (isset($sheet->PrintInformation->Margins)) { |
| 486 | - foreach($sheet->PrintInformation->Margins->children('gnm',TRUE) as $key => $margin) { |
|
| 486 | + foreach ($sheet->PrintInformation->Margins->children('gnm', TRUE) as $key => $margin) { |
|
| 487 | 487 | $marginAttributes = $margin->attributes(); |
| 488 | - $marginSize = 72 / 100; // Default |
|
| 489 | - switch($marginAttributes['PrefUnit']) { |
|
| 488 | + $marginSize = 72 / 100; // Default |
|
| 489 | + switch ($marginAttributes['PrefUnit']) { |
|
| 490 | 490 | case 'mm' : |
| 491 | 491 | $marginSize = intval($marginAttributes['Points']) / 100; |
| 492 | 492 | break; |
| 493 | 493 | } |
| 494 | - switch($key) { |
|
| 494 | + switch ($key) { |
|
| 495 | 495 | case 'top' : |
| 496 | 496 | $objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize); |
| 497 | 497 | break; |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | } |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | - foreach($sheet->Cells->Cell as $cell) { |
|
| 518 | + foreach ($sheet->Cells->Cell as $cell) { |
|
| 519 | 519 | $cellAttributes = $cell->attributes(); |
| 520 | 520 | $row = (int) $cellAttributes->Row + 1; |
| 521 | 521 | $column = (int) $cellAttributes->Col; |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | // Read cell? |
| 529 | 529 | if ($this->getReadFilter() !== NULL) { |
| 530 | - if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) { |
|
| 530 | + if ( ! $this->getReadFilter()->readCell($column, $row, $worksheetName)) { |
|
| 531 | 531 | continue; |
| 532 | 532 | } |
| 533 | 533 | } |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | if ($ExprID > '') { |
| 542 | 542 | if (((string) $cell) > '') { |
| 543 | 543 | |
| 544 | - $this->_expressions[$ExprID] = array( 'column' => $cellAttributes->Col, |
|
| 544 | + $this->_expressions[$ExprID] = array('column' => $cellAttributes->Col, |
|
| 545 | 545 | 'row' => $cellAttributes->Row, |
| 546 | 546 | 'formula' => (string) $cell |
| 547 | 547 | ); |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | } else { |
| 550 | 550 | $expression = $this->_expressions[$ExprID]; |
| 551 | 551 | |
| 552 | - $cell = $this->_referenceHelper->updateFormulaReferences( $expression['formula'], |
|
| 552 | + $cell = $this->_referenceHelper->updateFormulaReferences($expression['formula'], |
|
| 553 | 553 | 'A1', |
| 554 | 554 | $cellAttributes->Col - $expression['column'], |
| 555 | 555 | $cellAttributes->Row - $expression['row'], |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | } |
| 561 | 561 | $type = PHPExcel_Cell_DataType::TYPE_FORMULA; |
| 562 | 562 | } else { |
| 563 | - switch($ValueType) { |
|
| 563 | + switch ($ValueType) { |
|
| 564 | 564 | case '10' : // NULL |
| 565 | 565 | $type = PHPExcel_Cell_DataType::TYPE_NULL; |
| 566 | 566 | break; |
@@ -583,23 +583,23 @@ discard block |
||
| 583 | 583 | case '80' : // Array |
| 584 | 584 | } |
| 585 | 585 | } |
| 586 | - $objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell,$type); |
|
| 586 | + $objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell, $type); |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - if ((!$this->_readDataOnly) && (isset($sheet->Objects))) { |
|
| 590 | - foreach($sheet->Objects->children('gnm',TRUE) as $key => $comment) { |
|
| 589 | + if (( ! $this->_readDataOnly) && (isset($sheet->Objects))) { |
|
| 590 | + foreach ($sheet->Objects->children('gnm', TRUE) as $key => $comment) { |
|
| 591 | 591 | $commentAttributes = $comment->attributes(); |
| 592 | 592 | // Only comment objects are handled at the moment |
| 593 | 593 | if ($commentAttributes->Text) { |
| 594 | - $objPHPExcel->getActiveSheet()->getComment( (string)$commentAttributes->ObjectBound ) |
|
| 595 | - ->setAuthor( (string)$commentAttributes->Author ) |
|
| 596 | - ->setText($this->_parseRichText((string)$commentAttributes->Text) ); |
|
| 594 | + $objPHPExcel->getActiveSheet()->getComment((string) $commentAttributes->ObjectBound) |
|
| 595 | + ->setAuthor((string) $commentAttributes->Author) |
|
| 596 | + ->setText($this->_parseRichText((string) $commentAttributes->Text)); |
|
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | 599 | } |
| 600 | 600 | // echo '$maxCol=',$maxCol,'; $maxRow=',$maxRow,'<br />'; |
| 601 | 601 | // |
| 602 | - foreach($sheet->Styles->StyleRegion as $styleRegion) { |
|
| 602 | + foreach ($sheet->Styles->StyleRegion as $styleRegion) { |
|
| 603 | 603 | $styleAttributes = $styleRegion->attributes(); |
| 604 | 604 | if (($styleAttributes['startRow'] <= $maxRow) && |
| 605 | 605 | ($styleAttributes['startCol'] <= $maxCol)) { |
@@ -619,13 +619,13 @@ discard block |
||
| 619 | 619 | // echo '<br />'; |
| 620 | 620 | |
| 621 | 621 | // We still set the number format mask for date/time values, even if _readDataOnly is true |
| 622 | - if ((!$this->_readDataOnly) || |
|
| 622 | + if (( ! $this->_readDataOnly) || |
|
| 623 | 623 | (PHPExcel_Shared_Date::isDateTimeFormatCode($styleArray['numberformat']['code']))) { |
| 624 | 624 | $styleArray = array(); |
| 625 | 625 | $styleArray['numberformat']['code'] = (string) $styleAttributes['Format']; |
| 626 | 626 | // If _readDataOnly is false, we set all formatting information |
| 627 | - if (!$this->_readDataOnly) { |
|
| 628 | - switch($styleAttributes['HAlign']) { |
|
| 627 | + if ( ! $this->_readDataOnly) { |
|
| 628 | + switch ($styleAttributes['HAlign']) { |
|
| 629 | 629 | case '1' : |
| 630 | 630 | $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; |
| 631 | 631 | break; |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | break; |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - switch($styleAttributes['VAlign']) { |
|
| 650 | + switch ($styleAttributes['VAlign']) { |
|
| 651 | 651 | case '1' : |
| 652 | 652 | $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP; |
| 653 | 653 | break; |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | $styleArray['fill']['color']['rgb'] = $styleArray['fill']['startcolor']['rgb'] = $RGB; |
| 675 | 675 | $RGB2 = self::_parseGnumericColour($styleAttributes["PatternColor"]); |
| 676 | 676 | $styleArray['fill']['endcolor']['rgb'] = $RGB2; |
| 677 | - switch($shade) { |
|
| 677 | + switch ($shade) { |
|
| 678 | 678 | case '1' : |
| 679 | 679 | $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID; |
| 680 | 680 | break; |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | $styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? True : False; |
| 747 | 747 | $styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? True : False; |
| 748 | 748 | $styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? True : False; |
| 749 | - switch($fontAttributes['Underline']) { |
|
| 749 | + switch ($fontAttributes['Underline']) { |
|
| 750 | 750 | case '1' : |
| 751 | 751 | $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE; |
| 752 | 752 | break; |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE; |
| 764 | 764 | break; |
| 765 | 765 | } |
| 766 | - switch($fontAttributes['Script']) { |
|
| 766 | + switch ($fontAttributes['Script']) { |
|
| 767 | 767 | case '1' : |
| 768 | 768 | $styleArray['font']['superScript'] = True; |
| 769 | 769 | break; |
@@ -808,22 +808,22 @@ discard block |
||
| 808 | 808 | } |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | - if ((!$this->_readDataOnly) && (isset($sheet->Cols))) { |
|
| 811 | + if (( ! $this->_readDataOnly) && (isset($sheet->Cols))) { |
|
| 812 | 812 | // Column Widths |
| 813 | 813 | $columnAttributes = $sheet->Cols->attributes(); |
| 814 | - $defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4; |
|
| 814 | + $defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4; |
|
| 815 | 815 | $c = 0; |
| 816 | - foreach($sheet->Cols->ColInfo as $columnOverride) { |
|
| 816 | + foreach ($sheet->Cols->ColInfo as $columnOverride) { |
|
| 817 | 817 | $columnAttributes = $columnOverride->attributes(); |
| 818 | 818 | $column = $columnAttributes['No']; |
| 819 | - $columnWidth = $columnAttributes['Unit'] / 5.4; |
|
| 819 | + $columnWidth = $columnAttributes['Unit'] / 5.4; |
|
| 820 | 820 | $hidden = ((isset($columnAttributes['Hidden'])) && ($columnAttributes['Hidden'] == '1')) ? true : false; |
| 821 | 821 | $columnCount = (isset($columnAttributes['Count'])) ? $columnAttributes['Count'] : 1; |
| 822 | 822 | while ($c < $column) { |
| 823 | 823 | $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth); |
| 824 | 824 | ++$c; |
| 825 | 825 | } |
| 826 | - while (($c < ($column+$columnCount)) && ($c <= $maxCol)) { |
|
| 826 | + while (($c < ($column + $columnCount)) && ($c <= $maxCol)) { |
|
| 827 | 827 | $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($columnWidth); |
| 828 | 828 | if ($hidden) { |
| 829 | 829 | $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setVisible(false); |
@@ -837,13 +837,13 @@ discard block |
||
| 837 | 837 | } |
| 838 | 838 | } |
| 839 | 839 | |
| 840 | - if ((!$this->_readDataOnly) && (isset($sheet->Rows))) { |
|
| 840 | + if (( ! $this->_readDataOnly) && (isset($sheet->Rows))) { |
|
| 841 | 841 | // Row Heights |
| 842 | 842 | $rowAttributes = $sheet->Rows->attributes(); |
| 843 | 843 | $defaultHeight = $rowAttributes['DefaultSizePts']; |
| 844 | 844 | $r = 0; |
| 845 | 845 | |
| 846 | - foreach($sheet->Rows->RowInfo as $rowOverride) { |
|
| 846 | + foreach ($sheet->Rows->RowInfo as $rowOverride) { |
|
| 847 | 847 | $rowAttributes = $rowOverride->attributes(); |
| 848 | 848 | $row = $rowAttributes['No']; |
| 849 | 849 | $rowHeight = $rowAttributes['Unit']; |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | ++$r; |
| 854 | 854 | $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight); |
| 855 | 855 | } |
| 856 | - while (($r < ($row+$rowCount)) && ($r < $maxRow)) { |
|
| 856 | + while (($r < ($row + $rowCount)) && ($r < $maxRow)) { |
|
| 857 | 857 | ++$r; |
| 858 | 858 | $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($rowHeight); |
| 859 | 859 | if ($hidden) { |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | |
| 870 | 870 | // Handle Merged Cells in this worksheet |
| 871 | 871 | if (isset($sheet->MergedRegions)) { |
| 872 | - foreach($sheet->MergedRegions->Merge as $mergeCells) { |
|
| 872 | + foreach ($sheet->MergedRegions->Merge as $mergeCells) { |
|
| 873 | 873 | $objPHPExcel->getActiveSheet()->mergeCells($mergeCells); |
| 874 | 874 | } |
| 875 | 875 | } |
@@ -879,18 +879,18 @@ discard block |
||
| 879 | 879 | |
| 880 | 880 | // Loop through definedNames (global named ranges) |
| 881 | 881 | if (isset($gnmXML->Names)) { |
| 882 | - foreach($gnmXML->Names->Name as $namedRange) { |
|
| 882 | + foreach ($gnmXML->Names->Name as $namedRange) { |
|
| 883 | 883 | $name = (string) $namedRange->name; |
| 884 | 884 | $range = (string) $namedRange->value; |
| 885 | 885 | if (stripos($range, '#REF!') !== false) { |
| 886 | 886 | continue; |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | - $range = explode('!',$range); |
|
| 890 | - $range[0] = trim($range[0],"'");; |
|
| 889 | + $range = explode('!', $range); |
|
| 890 | + $range[0] = trim($range[0], "'"); ; |
|
| 891 | 891 | if ($worksheet = $objPHPExcel->getSheetByName($range[0])) { |
| 892 | 892 | $extractedRange = str_replace('$', '', $range[1]); |
| 893 | - $objPHPExcel->addNamedRange( new PHPExcel_NamedRange($name, $worksheet, $extractedRange) ); |
|
| 893 | + $objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $worksheet, $extractedRange)); |
|
| 894 | 894 | } |
| 895 | 895 | } |
| 896 | 896 | } |
@@ -967,10 +967,10 @@ discard block |
||
| 967 | 967 | |
| 968 | 968 | |
| 969 | 969 | private static function _parseGnumericColour($gnmColour) { |
| 970 | - list($gnmR,$gnmG,$gnmB) = explode(':',$gnmColour); |
|
| 971 | - $gnmR = substr(str_pad($gnmR,4,'0',STR_PAD_RIGHT),0,2); |
|
| 972 | - $gnmG = substr(str_pad($gnmG,4,'0',STR_PAD_RIGHT),0,2); |
|
| 973 | - $gnmB = substr(str_pad($gnmB,4,'0',STR_PAD_RIGHT),0,2); |
|
| 970 | + list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour); |
|
| 971 | + $gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2); |
|
| 972 | + $gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2); |
|
| 973 | + $gnmB = substr(str_pad($gnmB, 4, '0', STR_PAD_RIGHT), 0, 2); |
|
| 974 | 974 | $RGB = $gnmR.$gnmG.$gnmB; |
| 975 | 975 | // echo 'Excel Colour: ',$RGB,'<br />'; |
| 976 | 976 | return $RGB; |
@@ -520,8 +520,12 @@ |
||
| 520 | 520 | $row = (int) $cellAttributes->Row + 1; |
| 521 | 521 | $column = (int) $cellAttributes->Col; |
| 522 | 522 | |
| 523 | - if ($row > $maxRow) $maxRow = $row; |
|
| 524 | - if ($column > $maxCol) $maxCol = $column; |
|
| 523 | + if ($row > $maxRow) { |
|
| 524 | + $maxRow = $row; |
|
| 525 | + } |
|
| 526 | + if ($column > $maxCol) { |
|
| 527 | + $maxCol = $column; |
|
| 528 | + } |
|
| 525 | 529 | |
| 526 | 530 | $column = PHPExcel_Cell::stringFromColumnIndex($column); |
| 527 | 531 | |