@@ -62,6 +62,9 @@ discard block |
||
62 | 62 | private static $plotMark = 0; |
63 | 63 | |
64 | 64 | |
65 | + /** |
|
66 | + * @param string $markerID |
|
67 | + */ |
|
65 | 68 | private function formatPointMarker($seriesPlot, $markerID) |
66 | 69 | { |
67 | 70 | $plotMarkKeys = array_keys(self::$markSet); |
@@ -90,6 +93,9 @@ discard block |
||
90 | 93 | } |
91 | 94 | |
92 | 95 | |
96 | + /** |
|
97 | + * @param integer $labelCount |
|
98 | + */ |
|
93 | 99 | private function formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation = '') |
94 | 100 | { |
95 | 101 | $datasetLabelFormatCode = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode(); |
@@ -120,6 +126,9 @@ discard block |
||
120 | 126 | } |
121 | 127 | |
122 | 128 | |
129 | + /** |
|
130 | + * @param integer $seriesCount |
|
131 | + */ |
|
123 | 132 | private function percentageSumCalculation($groupID, $seriesCount) |
124 | 133 | { |
125 | 134 | // Adjust our values to a percentage value across all series in the group |
@@ -152,6 +161,9 @@ discard block |
||
152 | 161 | } |
153 | 162 | |
154 | 163 | |
164 | + /** |
|
165 | + * @param \PhpSpreadsheet\Chart\Title $captionElement |
|
166 | + */ |
|
155 | 167 | private function getCaption($captionElement) |
156 | 168 | { |
157 | 169 | // Read any caption |
@@ -264,6 +276,9 @@ discard block |
||
264 | 276 | } |
265 | 277 | |
266 | 278 | |
279 | + /** |
|
280 | + * @param integer $groupID |
|
281 | + */ |
|
267 | 282 | private function renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d') |
268 | 283 | { |
269 | 284 | $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); |
@@ -328,6 +343,9 @@ discard block |
||
328 | 343 | } |
329 | 344 | |
330 | 345 | |
346 | + /** |
|
347 | + * @param integer $groupID |
|
348 | + */ |
|
331 | 349 | private function renderPlotBar($groupID, $dimensions = '2d') |
332 | 350 | { |
333 | 351 | $rotation = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection(); |
@@ -414,6 +432,10 @@ discard block |
||
414 | 432 | } |
415 | 433 | |
416 | 434 | |
435 | + /** |
|
436 | + * @param integer $groupID |
|
437 | + * @param boolean $bubble |
|
438 | + */ |
|
417 | 439 | private function renderPlotScatter($groupID, $bubble) |
418 | 440 | { |
419 | 441 | $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); |
@@ -460,6 +482,9 @@ discard block |
||
460 | 482 | } |
461 | 483 | |
462 | 484 | |
485 | + /** |
|
486 | + * @param integer $groupID |
|
487 | + */ |
|
463 | 488 | private function renderPlotRadar($groupID) |
464 | 489 | { |
465 | 490 | $radarStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); |
@@ -499,6 +524,9 @@ discard block |
||
499 | 524 | } |
500 | 525 | |
501 | 526 | |
527 | + /** |
|
528 | + * @param integer $groupID |
|
529 | + */ |
|
502 | 530 | private function renderPlotContour($groupID) |
503 | 531 | { |
504 | 532 | $contourStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); |
@@ -520,6 +548,9 @@ discard block |
||
520 | 548 | } |
521 | 549 | |
522 | 550 | |
551 | + /** |
|
552 | + * @param integer $groupID |
|
553 | + */ |
|
523 | 554 | private function renderPlotStock($groupID) |
524 | 555 | { |
525 | 556 | $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); |
@@ -560,6 +591,9 @@ discard block |
||
560 | 591 | } |
561 | 592 | |
562 | 593 | |
594 | + /** |
|
595 | + * @param integer $groupCount |
|
596 | + */ |
|
563 | 597 | private function renderAreaChart($groupCount, $dimensions = '2d') |
564 | 598 | { |
565 | 599 | require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_line.php'); |
@@ -572,6 +606,9 @@ discard block |
||
572 | 606 | } |
573 | 607 | |
574 | 608 | |
609 | + /** |
|
610 | + * @param integer $groupCount |
|
611 | + */ |
|
575 | 612 | private function renderLineChart($groupCount, $dimensions = '2d') |
576 | 613 | { |
577 | 614 | require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_line.php'); |
@@ -584,6 +621,9 @@ discard block |
||
584 | 621 | } |
585 | 622 | |
586 | 623 | |
624 | + /** |
|
625 | + * @param integer $groupCount |
|
626 | + */ |
|
587 | 627 | private function renderBarChart($groupCount, $dimensions = '2d') |
588 | 628 | { |
589 | 629 | require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_bar.php'); |
@@ -596,6 +636,9 @@ discard block |
||
596 | 636 | } |
597 | 637 | |
598 | 638 | |
639 | + /** |
|
640 | + * @param integer $groupCount |
|
641 | + */ |
|
599 | 642 | private function renderScatterChart($groupCount) |
600 | 643 | { |
601 | 644 | require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_scatter.php'); |
@@ -610,6 +653,9 @@ discard block |
||
610 | 653 | } |
611 | 654 | |
612 | 655 | |
656 | + /** |
|
657 | + * @param integer $groupCount |
|
658 | + */ |
|
613 | 659 | private function renderBubbleChart($groupCount) |
614 | 660 | { |
615 | 661 | require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_scatter.php'); |
@@ -622,6 +668,9 @@ discard block |
||
622 | 668 | } |
623 | 669 | |
624 | 670 | |
671 | + /** |
|
672 | + * @param integer $groupCount |
|
673 | + */ |
|
625 | 674 | private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false) |
626 | 675 | { |
627 | 676 | require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_pie.php'); |
@@ -699,6 +748,9 @@ discard block |
||
699 | 748 | } |
700 | 749 | |
701 | 750 | |
751 | + /** |
|
752 | + * @param integer $groupCount |
|
753 | + */ |
|
702 | 754 | private function renderRadarChart($groupCount) |
703 | 755 | { |
704 | 756 | require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_radar.php'); |
@@ -711,6 +763,9 @@ discard block |
||
711 | 763 | } |
712 | 764 | |
713 | 765 | |
766 | + /** |
|
767 | + * @param integer $groupCount |
|
768 | + */ |
|
714 | 769 | private function renderStockChart($groupCount) |
715 | 770 | { |
716 | 771 | require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_stock.php'); |
@@ -723,6 +778,10 @@ discard block |
||
723 | 778 | } |
724 | 779 | |
725 | 780 | |
781 | + /** |
|
782 | + * @param integer $groupCount |
|
783 | + * @param string|null $dimensions |
|
784 | + */ |
|
726 | 785 | private function renderContourChart($groupCount, $dimensions) |
727 | 786 | { |
728 | 787 | require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_contour.php'); |
@@ -735,6 +794,9 @@ discard block |
||
735 | 794 | } |
736 | 795 | |
737 | 796 | |
797 | + /** |
|
798 | + * @param integer $groupCount |
|
799 | + */ |
|
738 | 800 | private function renderCombinationChart($groupCount, $dimensions, $outputDestination) |
739 | 801 | { |
740 | 802 | require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_line.php'); |
@@ -101,7 +101,7 @@ |
||
101 | 101 | /** |
102 | 102 | * Set Row Height |
103 | 103 | * |
104 | - * @param float $pValue |
|
104 | + * @param integer $pValue |
|
105 | 105 | * @return RowDimension |
106 | 106 | */ |
107 | 107 | public function setRowHeight($pValue = -1) |
@@ -266,7 +266,7 @@ |
||
266 | 266 | public function _readPpsWks($blockId) |
267 | 267 | { |
268 | 268 | $fh = $this->getStream($blockId); |
269 | - for ($pos = 0;; $pos += 128) { |
|
269 | + for ($pos = 0; ; $pos += 128) { |
|
270 | 270 | fseek($fh, $pos, SEEK_SET); |
271 | 271 | $nameUtf16 = fread($fh, 64); |
272 | 272 | $nameLength = self::_readInt2($fh); |
@@ -101,7 +101,7 @@ |
||
101 | 101 | /** |
102 | 102 | * Set Row Height |
103 | 103 | * |
104 | - * @param float $pValue |
|
104 | + * @param integer $pValue |
|
105 | 105 | * @return RowDimension |
106 | 106 | */ |
107 | 107 | public function setRowHeight($pValue = -1) |
@@ -101,7 +101,7 @@ |
||
101 | 101 | /** |
102 | 102 | * Set Row Height |
103 | 103 | * |
104 | - * @param float $pValue |
|
104 | + * @param integer $pValue |
|
105 | 105 | * @return RowDimension |
106 | 106 | */ |
107 | 107 | public function setRowHeight($pValue = -1) |
@@ -45,12 +45,12 @@ |
||
45 | 45 | echo date('H:i:s') , " Set document properties" , EOL; |
46 | 46 | $objPHPExcel->getProperties() |
47 | 47 | ->setCreator("Maarten Balliauw") |
48 | - ->setLastModifiedBy("Maarten Balliauw") |
|
49 | - ->setTitle("Office 2007 XLSX Test Document") |
|
50 | - ->setSubject("Office 2007 XLSX Test Document") |
|
51 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
52 | - ->setKeywords("office 2007 openxml php") |
|
53 | - ->setCategory("Test result file"); |
|
48 | + ->setLastModifiedBy("Maarten Balliauw") |
|
49 | + ->setTitle("Office 2007 XLSX Test Document") |
|
50 | + ->setSubject("Office 2007 XLSX Test Document") |
|
51 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
52 | + ->setKeywords("office 2007 openxml php") |
|
53 | + ->setCategory("Test result file"); |
|
54 | 54 | |
55 | 55 | // Set default font |
56 | 56 | echo date('H:i:s') , " Set default font" , EOL; |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | date_default_timezone_set('Europe/London'); |
33 | 33 | |
34 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
35 | 35 | |
36 | 36 | /** Include PhpSpreadsheet */ |
37 | 37 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
38 | 38 | |
39 | 39 | |
40 | 40 | // Create new PhpSpreadsheet object |
41 | -echo date('H:i:s') , " Create new PhpSpreadsheet object" , EOL; |
|
41 | +echo date('H:i:s'), " Create new PhpSpreadsheet object", EOL; |
|
42 | 42 | $objPhpSpreadsheet = new \PhpSpreadsheet\Spreadsheet(); |
43 | 43 | |
44 | 44 | // Set document properties |
45 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
45 | +echo date('H:i:s'), " Set document properties", EOL; |
|
46 | 46 | $objPhpSpreadsheet->getProperties()->setCreator("Maarten Balliauw") |
47 | 47 | ->setLastModifiedBy("Maarten Balliauw") |
48 | 48 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | |
55 | 55 | // Add some data, we will use some formulas here |
56 | -echo date('H:i:s') , " Add some data" , EOL; |
|
56 | +echo date('H:i:s'), " Add some data", EOL; |
|
57 | 57 | $objPhpSpreadsheet->getActiveSheet() |
58 | 58 | ->setCellValue('A5', 'Sum:'); |
59 | 59 | |
@@ -62,55 +62,55 @@ discard block |
||
62 | 62 | ->setCellValue('B3', 7) |
63 | 63 | ->setCellValue('B4', 13) |
64 | 64 | ->setCellValue('B5', '=SUM(B2:B4)'); |
65 | -echo date('H:i:s') , " Sum of Range #1 is " , |
|
65 | +echo date('H:i:s'), " Sum of Range #1 is ", |
|
66 | 66 | $objPhpSpreadsheet->getActiveSheet() |
67 | 67 | ->getCell('B5') |
68 | - ->getCalculatedValue() , EOL; |
|
68 | + ->getCalculatedValue(), EOL; |
|
69 | 69 | |
70 | 70 | $objPhpSpreadsheet->getActiveSheet()->setCellValue('C1', 'Range #2') |
71 | 71 | ->setCellValue('C2', 5) |
72 | 72 | ->setCellValue('C3', 11) |
73 | 73 | ->setCellValue('C4', 17) |
74 | 74 | ->setCellValue('C5', '=SUM(C2:C4)'); |
75 | -echo date('H:i:s') , " Sum of Range #2 is " , |
|
75 | +echo date('H:i:s'), " Sum of Range #2 is ", |
|
76 | 76 | $objPhpSpreadsheet->getActiveSheet() |
77 | 77 | ->getCell('C5') |
78 | - ->getCalculatedValue() , EOL; |
|
78 | + ->getCalculatedValue(), EOL; |
|
79 | 79 | |
80 | 80 | $objPhpSpreadsheet->getActiveSheet() |
81 | 81 | ->setCellValue('A7', 'Total of both ranges:'); |
82 | 82 | $objPhpSpreadsheet->getActiveSheet() |
83 | 83 | ->setCellValue('B7', '=SUM(B5:C5)'); |
84 | -echo date('H:i:s') , " Sum of both Ranges is " , |
|
84 | +echo date('H:i:s'), " Sum of both Ranges is ", |
|
85 | 85 | $objPhpSpreadsheet->getActiveSheet() |
86 | 86 | ->getCell('B7') |
87 | - ->getCalculatedValue() , EOL; |
|
87 | + ->getCalculatedValue(), EOL; |
|
88 | 88 | |
89 | 89 | $objPhpSpreadsheet->getActiveSheet() |
90 | 90 | ->setCellValue('A8', 'Minimum of both ranges:'); |
91 | 91 | $objPhpSpreadsheet->getActiveSheet() |
92 | 92 | ->setCellValue('B8', '=MIN(B2:C4)'); |
93 | -echo date('H:i:s') , " Minimum value in either Range is " , |
|
93 | +echo date('H:i:s'), " Minimum value in either Range is ", |
|
94 | 94 | $objPhpSpreadsheet->getActiveSheet() |
95 | 95 | ->getCell('B8') |
96 | - ->getCalculatedValue() , EOL; |
|
96 | + ->getCalculatedValue(), EOL; |
|
97 | 97 | |
98 | 98 | $objPhpSpreadsheet->getActiveSheet() |
99 | 99 | ->setCellValue('A9', 'Maximum of both ranges:'); |
100 | 100 | $objPhpSpreadsheet->getActiveSheet() |
101 | 101 | ->setCellValue('B9', '=MAX(B2:C4)'); |
102 | -echo date('H:i:s') , " Maximum value in either Range is " , |
|
102 | +echo date('H:i:s'), " Maximum value in either Range is ", |
|
103 | 103 | $objPhpSpreadsheet->getActiveSheet() |
104 | 104 | ->getCell('B9') |
105 | - ->getCalculatedValue() , EOL; |
|
105 | + ->getCalculatedValue(), EOL; |
|
106 | 106 | |
107 | 107 | $objPhpSpreadsheet->getActiveSheet() |
108 | 108 | ->setCellValue('A10', 'Average of both ranges:'); |
109 | 109 | $objPhpSpreadsheet->getActiveSheet() |
110 | 110 | ->setCellValue('B10', '=AVERAGE(B2:C4)'); |
111 | -echo date('H:i:s') , " Average value of both Ranges is " , |
|
111 | +echo date('H:i:s'), " Average value of both Ranges is ", |
|
112 | 112 | $objPhpSpreadsheet->getActiveSheet() |
113 | - ->getCell('B10')->getCalculatedValue() , EOL; |
|
113 | + ->getCell('B10')->getCalculatedValue(), EOL; |
|
114 | 114 | |
115 | 115 | |
116 | 116 | $objPhpSpreadsheet->getActiveSheet() |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | |
121 | 121 | // Rename worksheet |
122 | -echo date('H:i:s') , " Rename worksheet" , EOL; |
|
122 | +echo date('H:i:s'), " Rename worksheet", EOL; |
|
123 | 123 | $objPhpSpreadsheet->getActiveSheet() |
124 | 124 | ->setTitle('Formulas'); |
125 | 125 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | |
131 | 131 | // Save Excel 2007 file |
132 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
132 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
133 | 133 | $callStartTime = microtime(true); |
134 | 134 | |
135 | 135 | $objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel2007'); |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | $callEndTime = microtime(true); |
147 | 147 | $callTime = $callEndTime - $callStartTime; |
148 | 148 | |
149 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
150 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
149 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
150 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
151 | 151 | // Echo memory usage |
152 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
152 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
153 | 153 | |
154 | 154 | |
155 | 155 | // Save Excel 95 file |
156 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
156 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
157 | 157 | $callStartTime = microtime(true); |
158 | 158 | |
159 | 159 | $objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel5'); |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | $callEndTime = microtime(true); |
162 | 162 | $callTime = $callEndTime - $callStartTime; |
163 | 163 | |
164 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
165 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
164 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
165 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
166 | 166 | // Echo memory usage |
167 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
167 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
168 | 168 | |
169 | 169 | |
170 | 170 | // Echo memory peak usage |
171 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
171 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
172 | 172 | |
173 | 173 | // Echo done |
174 | -echo date('H:i:s') , " Done writing files" , EOL; |
|
175 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
174 | +echo date('H:i:s'), " Done writing files", EOL; |
|
175 | +echo 'Files have been created in ', getcwd(), EOL; |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | ini_set('display_startup_errors', TRUE); |
31 | 31 | date_default_timezone_set('Europe/London'); |
32 | 32 | |
33 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
33 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | 34 | |
35 | 35 | /** Include PhpSpreadsheet */ |
36 | 36 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
37 | 37 | |
38 | 38 | |
39 | 39 | // Create new Spreadsheet object |
40 | -echo date('H:i:s') , " Create new Spreadsheet object" , EOL; |
|
40 | +echo date('H:i:s'), " Create new Spreadsheet object", EOL; |
|
41 | 41 | $objPhpSpreadsheet = new \PhpSpreadsheet\Spreadsheet(); |
42 | 42 | |
43 | 43 | // Set document properties |
44 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
44 | +echo date('H:i:s'), " Set document properties", EOL; |
|
45 | 45 | $objPhpSpreadsheet->getProperties() |
46 | 46 | ->setCreator("Maarten Balliauw") |
47 | 47 | ->setLastModifiedBy("Maarten Balliauw") |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | |
55 | 55 | // Add some data |
56 | -echo date('H:i:s') , " Add some data" , EOL; |
|
56 | +echo date('H:i:s'), " Add some data", EOL; |
|
57 | 57 | $objPhpSpreadsheet->setActiveSheetIndex(0) |
58 | 58 | ->setCellValue('A1', 'Hello') |
59 | 59 | ->setCellValue('B2', 'world!') |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | |
69 | 69 | $objPhpSpreadsheet->getActiveSheet() |
70 | - ->setCellValue('A8',"Hello\nWorld"); |
|
70 | + ->setCellValue('A8', "Hello\nWorld"); |
|
71 | 71 | $objPhpSpreadsheet->getActiveSheet() |
72 | 72 | ->getRowDimension(8) |
73 | 73 | ->setRowHeight(-1); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | |
95 | 95 | // Rename worksheet |
96 | -echo date('H:i:s') , " Rename worksheet" , EOL; |
|
96 | +echo date('H:i:s'), " Rename worksheet", EOL; |
|
97 | 97 | $objPhpSpreadsheet->getActiveSheet() |
98 | 98 | ->setTitle('Simple'); |
99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | |
105 | 105 | // Save Excel 2007 file |
106 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
106 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
107 | 107 | $callStartTime = microtime(true); |
108 | 108 | |
109 | 109 | $objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel2007'); |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | $callEndTime = microtime(true); |
112 | 112 | $callTime = $callEndTime - $callStartTime; |
113 | 113 | |
114 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
115 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
114 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
115 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
116 | 116 | // Echo memory usage |
117 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
117 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
118 | 118 | |
119 | 119 | |
120 | 120 | // Save Excel 95 file |
121 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
121 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
122 | 122 | $callStartTime = microtime(true); |
123 | 123 | |
124 | 124 | $objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel5'); |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | $callEndTime = microtime(true); |
127 | 127 | $callTime = $callEndTime - $callStartTime; |
128 | 128 | |
129 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
130 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
129 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
130 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
131 | 131 | // Echo memory usage |
132 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
132 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
133 | 133 | |
134 | 134 | |
135 | 135 | // Echo memory peak usage |
136 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
136 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
137 | 137 | |
138 | 138 | // Echo done |
139 | -echo date('H:i:s') , " Done writing files" , EOL; |
|
140 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
139 | +echo date('H:i:s'), " Done writing files", EOL; |
|
140 | +echo 'Files have been created in ', getcwd(), EOL; |
@@ -43,12 +43,12 @@ |
||
43 | 43 | // Set document properties |
44 | 44 | echo date('H:i:s') , " Set document properties" , EOL; |
45 | 45 | $objPhpSpreadsheet->getProperties()->setCreator("Maarten Balliauw") |
46 | - ->setLastModifiedBy("Maarten Balliauw") |
|
47 | - ->setTitle("PhpSpreadsheet Test Document") |
|
48 | - ->setSubject("PhpSpreadsheet Test Document") |
|
49 | - ->setDescription("Test document for PhpSpreadsheet, generated using PHP classes.") |
|
50 | - ->setKeywords("office PhpSpreadsheet php") |
|
51 | - ->setCategory("Test result file"); |
|
46 | + ->setLastModifiedBy("Maarten Balliauw") |
|
47 | + ->setTitle("PhpSpreadsheet Test Document") |
|
48 | + ->setSubject("PhpSpreadsheet Test Document") |
|
49 | + ->setDescription("Test document for PhpSpreadsheet, generated using PHP classes.") |
|
50 | + ->setKeywords("office PhpSpreadsheet php") |
|
51 | + ->setCategory("Test result file"); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | // Add some data |
@@ -43,12 +43,12 @@ |
||
43 | 43 | // Set document properties |
44 | 44 | echo date('H:i:s') , " Set document properties" , EOL; |
45 | 45 | $objPhpSpreadsheet->getProperties()->setCreator("Maarten Balliauw") |
46 | - ->setLastModifiedBy("Maarten Balliauw") |
|
47 | - ->setTitle("PhpSpreadsheet Test Document") |
|
48 | - ->setSubject("PhpSpreadsheet Test Document") |
|
49 | - ->setDescription("Test document for PhpSpreadsheet, generated using PHP classes.") |
|
50 | - ->setKeywords("office PhpSpreadsheet php") |
|
51 | - ->setCategory("Test result file"); |
|
46 | + ->setLastModifiedBy("Maarten Balliauw") |
|
47 | + ->setTitle("PhpSpreadsheet Test Document") |
|
48 | + ->setSubject("PhpSpreadsheet Test Document") |
|
49 | + ->setDescription("Test document for PhpSpreadsheet, generated using PHP classes.") |
|
50 | + ->setKeywords("office PhpSpreadsheet php") |
|
51 | + ->setCategory("Test result file"); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | // Add some data |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | ini_set('display_startup_errors', TRUE); |
31 | 31 | date_default_timezone_set('Europe/London'); |
32 | 32 | |
33 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
33 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | 34 | |
35 | 35 | /** Include PhpSpreadsheet */ |
36 | 36 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
37 | 37 | |
38 | 38 | |
39 | 39 | // Create new PhpSpreadsheet object |
40 | -echo date('H:i:s') , " Create new PhpSpreadsheet object" , EOL; |
|
40 | +echo date('H:i:s'), " Create new PhpSpreadsheet object", EOL; |
|
41 | 41 | $objPhpSpreadsheet = new \PhpSpreadsheet\Spreadsheet(); |
42 | 42 | |
43 | 43 | // Set document properties |
44 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
44 | +echo date('H:i:s'), " Set document properties", EOL; |
|
45 | 45 | $objPhpSpreadsheet->getProperties()->setCreator("Maarten Balliauw") |
46 | 46 | ->setLastModifiedBy("Maarten Balliauw") |
47 | 47 | ->setTitle("PhpSpreadsheet Test Document") |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | |
54 | 54 | // Add some data |
55 | -echo date('H:i:s') , " Add some data" , EOL; |
|
55 | +echo date('H:i:s'), " Add some data", EOL; |
|
56 | 56 | $objPhpSpreadsheet->setActiveSheetIndex(0) |
57 | 57 | ->setCellValue('A1', 'Hello') |
58 | 58 | ->setCellValue('B2', 'world!') |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); |
66 | 66 | |
67 | 67 | |
68 | -$objPhpSpreadsheet->getActiveSheet()->setCellValue('A8',"Hello\nWorld"); |
|
68 | +$objPhpSpreadsheet->getActiveSheet()->setCellValue('A8', "Hello\nWorld"); |
|
69 | 69 | $objPhpSpreadsheet->getActiveSheet()->getRowDimension(8)->setRowHeight(-1); |
70 | 70 | $objPhpSpreadsheet->getActiveSheet()->getStyle('A8')->getAlignment()->setWrapText(true); |
71 | 71 | |
72 | 72 | |
73 | 73 | // Rename worksheet |
74 | -echo date('H:i:s') , " Rename worksheet" , EOL; |
|
74 | +echo date('H:i:s'), " Rename worksheet", EOL; |
|
75 | 75 | $objPhpSpreadsheet->getActiveSheet()->setTitle('Simple'); |
76 | 76 | |
77 | 77 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | |
82 | 82 | // Save Excel 2007 file |
83 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
83 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
84 | 84 | $callStartTime = microtime(true); |
85 | 85 | |
86 | 86 | // Use PCLZip rather than ZipArchive to create the Excel2007 OfficeOpenXML file |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | $callEndTime = microtime(true); |
92 | 92 | $callTime = $callEndTime - $callStartTime; |
93 | 93 | |
94 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
95 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
94 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
95 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
96 | 96 | // Echo memory usage |
97 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
97 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
98 | 98 | |
99 | 99 | |
100 | 100 | // Echo memory peak usage |
101 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
101 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
102 | 102 | |
103 | 103 | // Echo done |
104 | -echo date('H:i:s') , " Done writing files" , EOL; |
|
105 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
104 | +echo date('H:i:s'), " Done writing files", EOL; |
|
105 | +echo 'Files have been created in ', getcwd(), EOL; |
@@ -46,18 +46,18 @@ |
||
46 | 46 | echo date('H:i:s') , " Set document properties" , EOL; |
47 | 47 | $objPhpSpreadsheet->getProperties()->setCreator("Maarten Balliauw") |
48 | 48 | ->setLastModifiedBy("Maarten Balliauw") |
49 | - ->setTitle("Office 2007 XLSX Test Document") |
|
50 | - ->setSubject("Office 2007 XLSX Test Document") |
|
51 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
52 | - ->setKeywords("office 2007 openxml php") |
|
53 | - ->setCategory("Test result file"); |
|
49 | + ->setTitle("Office 2007 XLSX Test Document") |
|
50 | + ->setSubject("Office 2007 XLSX Test Document") |
|
51 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
52 | + ->setKeywords("office 2007 openxml php") |
|
53 | + ->setCategory("Test result file"); |
|
54 | 54 | |
55 | 55 | |
56 | 56 | // Add some data, we will use printing features |
57 | 57 | echo date('H:i:s') , " Add some data" , EOL; |
58 | 58 | for ($i = 1; $i < 200; $i++) { |
59 | - $objPhpSpreadsheet->getActiveSheet()->setCellValue('A' . $i, $i); |
|
60 | - $objPhpSpreadsheet->getActiveSheet()->setCellValue('B' . $i, 'Test value'); |
|
59 | + $objPhpSpreadsheet->getActiveSheet()->setCellValue('A' . $i, $i); |
|
60 | + $objPhpSpreadsheet->getActiveSheet()->setCellValue('B' . $i, 'Test value'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Set header and footer. When no different headers for odd/even are used, odd header is assumed. |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | ini_set('display_errors', TRUE); |
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | |
33 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
33 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | 34 | |
35 | 35 | date_default_timezone_set('Europe/London'); |
36 | 36 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | // Create new PhpSpreadsheet object |
42 | -echo date('H:i:s') , " Create new PhpSpreadsheet object" , EOL; |
|
42 | +echo date('H:i:s'), " Create new PhpSpreadsheet object", EOL; |
|
43 | 43 | $objPhpSpreadsheet = new \PhpSpreadsheet\Spreadsheet(); |
44 | 44 | |
45 | 45 | // Set document properties |
46 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
46 | +echo date('H:i:s'), " Set document properties", EOL; |
|
47 | 47 | $objPhpSpreadsheet->getProperties()->setCreator("Maarten Balliauw") |
48 | 48 | ->setLastModifiedBy("Maarten Balliauw") |
49 | 49 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | |
55 | 55 | |
56 | 56 | // Add some data, we will use printing features |
57 | -echo date('H:i:s') , " Add some data" , EOL; |
|
57 | +echo date('H:i:s'), " Add some data", EOL; |
|
58 | 58 | for ($i = 1; $i < 200; $i++) { |
59 | 59 | $objPhpSpreadsheet->getActiveSheet()->setCellValue('A' . $i, $i); |
60 | 60 | $objPhpSpreadsheet->getActiveSheet()->setCellValue('B' . $i, 'Test value'); |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Set header and footer. When no different headers for odd/even are used, odd header is assumed. |
64 | -echo date('H:i:s') , " Set header/footer" , EOL; |
|
64 | +echo date('H:i:s'), " Set header/footer", EOL; |
|
65 | 65 | $objPhpSpreadsheet->getActiveSheet() |
66 | 66 | ->getHeaderFooter() |
67 | 67 | ->setOddHeader('&L&G&C&HPlease treat this document as confidential!'); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ->setOddFooter('&L&B' . $objPhpSpreadsheet->getProperties()->getTitle() . '&RPage &P of &N'); |
71 | 71 | |
72 | 72 | // Add a drawing to the header |
73 | -echo date('H:i:s') , " Add a drawing to the header" , EOL; |
|
73 | +echo date('H:i:s'), " Add a drawing to the header", EOL; |
|
74 | 74 | $objDrawing = new \PhpSpreadsheet\Worksheet\HeaderFooterDrawing(); |
75 | 75 | $objDrawing->setName('PhpSpreadsheet logo'); |
76 | 76 | $objDrawing->setPath('./images/PhpSpreadsheet_logo.gif'); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | ->addImage($objDrawing, \PhpSpreadsheet\Worksheet\HeaderFooter::IMAGE_HEADER_LEFT); |
81 | 81 | |
82 | 82 | // Set page orientation and size |
83 | -echo date('H:i:s') , " Set page orientation and size" , EOL; |
|
83 | +echo date('H:i:s'), " Set page orientation and size", EOL; |
|
84 | 84 | $objPhpSpreadsheet->getActiveSheet() |
85 | 85 | ->getPageSetup() |
86 | 86 | ->setOrientation(\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ->setPaperSize(\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4); |
90 | 90 | |
91 | 91 | // Rename worksheet |
92 | -echo date('H:i:s') , " Rename worksheet" , EOL; |
|
92 | +echo date('H:i:s'), " Rename worksheet", EOL; |
|
93 | 93 | $objPhpSpreadsheet->getActiveSheet()->setTitle('Printing'); |
94 | 94 | |
95 | 95 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | |
100 | 100 | // Save Excel 2007 file |
101 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
101 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
102 | 102 | $callStartTime = microtime(true); |
103 | 103 | |
104 | 104 | $objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel2007'); |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | $callEndTime = microtime(true); |
107 | 107 | $callTime = $callEndTime - $callStartTime; |
108 | 108 | |
109 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
110 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
109 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
110 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
111 | 111 | // Echo memory usage |
112 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
112 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
113 | 113 | |
114 | 114 | |
115 | 115 | // Save Excel 95 file |
116 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
116 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
117 | 117 | $callStartTime = microtime(true); |
118 | 118 | |
119 | 119 | $objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel5'); |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | $callEndTime = microtime(true); |
122 | 122 | $callTime = $callEndTime - $callStartTime; |
123 | 123 | |
124 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
125 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
124 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
125 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
126 | 126 | // Echo memory usage |
127 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
127 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
128 | 128 | |
129 | 129 | |
130 | 130 | // Echo memory peak usage |
131 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
131 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
132 | 132 | |
133 | 133 | // Echo done |
134 | -echo date('H:i:s') , " Done writing files" , EOL; |
|
135 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
134 | +echo date('H:i:s'), " Done writing files", EOL; |
|
135 | +echo 'Files have been created in ', getcwd(), EOL; |