@@ -47,30 +47,30 @@ |
||
47 | 47 | // Set document properties |
48 | 48 | echo date('H:i:s') , " Set document properties" , EOL; |
49 | 49 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
50 | - ->setLastModifiedBy("Maarten Balliauw") |
|
51 | - ->setTitle("Office 2007 XLSX Test Document") |
|
52 | - ->setSubject("Office 2007 XLSX Test Document") |
|
53 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
54 | - ->setKeywords("office 2007 openxml php") |
|
55 | - ->setCategory("Test result file"); |
|
50 | + ->setLastModifiedBy("Maarten Balliauw") |
|
51 | + ->setTitle("Office 2007 XLSX Test Document") |
|
52 | + ->setSubject("Office 2007 XLSX Test Document") |
|
53 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
54 | + ->setKeywords("office 2007 openxml php") |
|
55 | + ->setCategory("Test result file"); |
|
56 | 56 | |
57 | 57 | |
58 | 58 | // Create a first sheet |
59 | 59 | echo date('H:i:s') , " Add data" , EOL; |
60 | 60 | $objPHPExcel->setActiveSheetIndex(0); |
61 | 61 | $objPHPExcel->getActiveSheet()->setCellValue('A1', "Cell B3 and B5 contain data validation...") |
62 | - ->setCellValue('A3', "Number:") |
|
63 | - ->setCellValue('B3', "10") |
|
64 | - ->setCellValue('A5', "List:") |
|
65 | - ->setCellValue('B5', "Item A") |
|
66 | - ->setCellValue('A7', "List #2:") |
|
67 | - ->setCellValue('B7', "Item #2") |
|
68 | - ->setCellValue('D2', "Item #1") |
|
69 | - ->setCellValue('D3', "Item #2") |
|
70 | - ->setCellValue('D4', "Item #3") |
|
71 | - ->setCellValue('D5', "Item #4") |
|
72 | - ->setCellValue('D6', "Item #5") |
|
73 | - ; |
|
62 | + ->setCellValue('A3', "Number:") |
|
63 | + ->setCellValue('B3', "10") |
|
64 | + ->setCellValue('A5', "List:") |
|
65 | + ->setCellValue('B5', "Item A") |
|
66 | + ->setCellValue('A7', "List #2:") |
|
67 | + ->setCellValue('B7', "Item #2") |
|
68 | + ->setCellValue('D2', "Item #1") |
|
69 | + ->setCellValue('D3', "Item #2") |
|
70 | + ->setCellValue('D4', "Item #3") |
|
71 | + ->setCellValue('D5', "Item #4") |
|
72 | + ->setCellValue('D6', "Item #5") |
|
73 | + ; |
|
74 | 74 | |
75 | 75 | |
76 | 76 | // Set data validation |
@@ -31,7 +31,7 @@ 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 | date_default_timezone_set('Europe/London'); |
37 | 37 | |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | // Create new PHPExcel object |
43 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
43 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
44 | 44 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
45 | 45 | |
46 | 46 | |
47 | 47 | // Set document properties |
48 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
48 | +echo date('H:i:s'), " Set document properties", EOL; |
|
49 | 49 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
50 | 50 | ->setLastModifiedBy("Maarten Balliauw") |
51 | 51 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | |
58 | 58 | // Create a first sheet |
59 | -echo date('H:i:s') , " Add data" , EOL; |
|
59 | +echo date('H:i:s'), " Add data", EOL; |
|
60 | 60 | $objPHPExcel->setActiveSheetIndex(0); |
61 | 61 | $objPHPExcel->getActiveSheet()->setCellValue('A1', "Cell B3 and B5 contain data validation...") |
62 | 62 | ->setCellValue('A3', "Number:") |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | |
75 | 75 | |
76 | 76 | // Set data validation |
77 | -echo date('H:i:s') , " Set data validation" , EOL; |
|
77 | +echo date('H:i:s'), " Set data validation", EOL; |
|
78 | 78 | $objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation(); |
79 | -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_WHOLE ); |
|
80 | -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_STOP ); |
|
79 | +$objValidation->setType(\PHPExcel\Cell\DataValidation::TYPE_WHOLE); |
|
80 | +$objValidation->setErrorStyle(\PHPExcel\Cell\DataValidation::STYLE_STOP); |
|
81 | 81 | $objValidation->setAllowBlank(true); |
82 | 82 | $objValidation->setShowInputMessage(true); |
83 | 83 | $objValidation->setShowErrorMessage(true); |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | $objValidation->setFormula2(20); |
90 | 90 | |
91 | 91 | $objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation(); |
92 | -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST ); |
|
93 | -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION ); |
|
92 | +$objValidation->setType(\PHPExcel\Cell\DataValidation::TYPE_LIST); |
|
93 | +$objValidation->setErrorStyle(\PHPExcel\Cell\DataValidation::STYLE_INFORMATION); |
|
94 | 94 | $objValidation->setAllowBlank(false); |
95 | 95 | $objValidation->setShowInputMessage(true); |
96 | 96 | $objValidation->setShowErrorMessage(true); |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | $objValidation->setError('Value is not in list.'); |
100 | 100 | $objValidation->setPromptTitle('Pick from list'); |
101 | 101 | $objValidation->setPrompt('Please pick a value from the drop-down list.'); |
102 | -$objValidation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " if your list is simply a comma-separated list of values !!! |
|
102 | +$objValidation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " if your list is simply a comma-separated list of values !!! |
|
103 | 103 | |
104 | 104 | |
105 | 105 | $objValidation = $objPHPExcel->getActiveSheet()->getCell('B7')->getDataValidation(); |
106 | -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST ); |
|
107 | -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION ); |
|
106 | +$objValidation->setType(\PHPExcel\Cell\DataValidation::TYPE_LIST); |
|
107 | +$objValidation->setErrorStyle(\PHPExcel\Cell\DataValidation::STYLE_INFORMATION); |
|
108 | 108 | $objValidation->setAllowBlank(false); |
109 | 109 | $objValidation->setShowInputMessage(true); |
110 | 110 | $objValidation->setShowErrorMessage(true); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $objValidation->setError('Value is not in list.'); |
114 | 114 | $objValidation->setPromptTitle('Pick from list'); |
115 | 115 | $objValidation->setPrompt('Please pick a value from the drop-down list.'); |
116 | -$objValidation->setFormula1('$D$2:$D$6'); // Make sure NOT to put a range of cells or a formula between " and " !!! |
|
116 | +$objValidation->setFormula1('$D$2:$D$6'); // Make sure NOT to put a range of cells or a formula between " and " !!! |
|
117 | 117 | |
118 | 118 | |
119 | 119 | // Set active sheet index to the first sheet, so Excel opens this as the first sheet |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | // Save Excel 2007 file |
124 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
124 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
125 | 125 | $callStartTime = microtime(true); |
126 | 126 | |
127 | 127 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | $callEndTime = microtime(true); |
130 | 130 | $callTime = $callEndTime - $callStartTime; |
131 | 131 | |
132 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
133 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
132 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
133 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
134 | 134 | // Echo memory usage |
135 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
135 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
136 | 136 | |
137 | 137 | |
138 | 138 | // Echo memory peak usage |
139 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
139 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
140 | 140 | |
141 | 141 | // Echo done |
142 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
143 | -echo 'File has been created in ' , getcwd() , EOL; |
|
142 | +echo date('H:i:s'), " Done writing file", EOL; |
|
143 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | |
27 | 27 | |
28 | 28 | if (!PHPExcel\Settings::setPdfRenderer( |
29 | - $rendererName, |
|
30 | - $rendererLibraryPath |
|
31 | - )) { |
|
32 | - die( |
|
33 | - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
34 | - EOL . |
|
35 | - 'at the top of this script as appropriate for your directory structure' |
|
36 | - ); |
|
29 | + $rendererName, |
|
30 | + $rendererLibraryPath |
|
31 | + )) { |
|
32 | + die( |
|
33 | + 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
34 | + EOL . |
|
35 | + 'at the top of this script as appropriate for your directory structure' |
|
36 | + ); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | |
46 | 46 | |
47 | 47 | if (!PHPExcel\Settings::setChartRenderer( |
48 | - $rendererName, |
|
49 | - $rendererLibraryPath |
|
50 | - )) { |
|
51 | - die( |
|
52 | - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
53 | - EOL . |
|
54 | - 'at the top of this script as appropriate for your directory structure' |
|
55 | - ); |
|
48 | + $rendererName, |
|
49 | + $rendererLibraryPath |
|
50 | + )) { |
|
51 | + die( |
|
52 | + 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
53 | + EOL . |
|
54 | + 'at the top of this script as appropriate for your directory structure' |
|
55 | + ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -60,81 +60,81 @@ discard block |
||
60 | 60 | $inputFileNames = 'templates/36write*.xlsx'; |
61 | 61 | |
62 | 62 | if ((isset($argc)) && ($argc > 1)) { |
63 | - $inputFileNames = array(); |
|
64 | - for($i = 1; $i < $argc; ++$i) { |
|
65 | - $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i]; |
|
66 | - } |
|
63 | + $inputFileNames = array(); |
|
64 | + for($i = 1; $i < $argc; ++$i) { |
|
65 | + $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i]; |
|
66 | + } |
|
67 | 67 | } else { |
68 | - $inputFileNames = glob($inputFileNames); |
|
68 | + $inputFileNames = glob($inputFileNames); |
|
69 | 69 | } |
70 | 70 | foreach($inputFileNames as $inputFileName) { |
71 | - $inputFileNameShort = basename($inputFileName); |
|
72 | - |
|
73 | - if (!file_exists($inputFileName)) { |
|
74 | - echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL; |
|
75 | - continue; |
|
76 | - } |
|
77 | - |
|
78 | - echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL; |
|
79 | - |
|
80 | - $objReader = \PHPExcel\IOFactory::createReader($inputFileType); |
|
81 | - $objReader->setIncludeCharts(TRUE); |
|
82 | - $objPHPExcel = $objReader->load($inputFileName); |
|
83 | - |
|
84 | - |
|
85 | - echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL; |
|
86 | - foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { |
|
87 | - $sheetName = $worksheet->getTitle(); |
|
88 | - echo 'Worksheet: ' , $sheetName , EOL; |
|
89 | - |
|
90 | - $chartNames = $worksheet->getChartNames(); |
|
91 | - if(empty($chartNames)) { |
|
92 | - echo ' There are no charts in this worksheet' , EOL; |
|
93 | - } else { |
|
94 | - natsort($chartNames); |
|
95 | - foreach($chartNames as $i => $chartName) { |
|
96 | - $chart = $worksheet->getChartByName($chartName); |
|
97 | - if (!is_null($chart->getTitle())) { |
|
98 | - $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"'; |
|
99 | - } else { |
|
100 | - $caption = 'Untitled'; |
|
101 | - } |
|
102 | - echo ' ' , $chartName , ' - ' , $caption , EOL; |
|
103 | - echo str_repeat(' ',strlen($chartName)+3); |
|
104 | - $groupCount = $chart->getPlotArea()->getPlotGroupCount(); |
|
105 | - if ($groupCount == 1) { |
|
106 | - $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); |
|
107 | - echo ' ' , $chartType , EOL; |
|
108 | - } else { |
|
109 | - $chartTypes = array(); |
|
110 | - for($i = 0; $i < $groupCount; ++$i) { |
|
111 | - $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); |
|
112 | - } |
|
113 | - $chartTypes = array_unique($chartTypes); |
|
114 | - if (count($chartTypes) == 1) { |
|
115 | - $chartType = 'Multiple Plot ' . array_pop($chartTypes); |
|
116 | - echo ' ' , $chartType , EOL; |
|
117 | - } elseif (count($chartTypes) == 0) { |
|
118 | - echo ' *** Type not yet implemented' , EOL; |
|
119 | - } else { |
|
120 | - echo ' Combination Chart' , EOL; |
|
121 | - } |
|
122 | - } |
|
123 | - } |
|
124 | - } |
|
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - $outputFileName = str_replace('.xlsx', '.pdf', basename($inputFileName)); |
|
129 | - |
|
130 | - echo date('H:i:s') , " Write Tests to HTML file " , EOL; |
|
131 | - $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF'); |
|
132 | - $objWriter->setIncludeCharts(TRUE); |
|
133 | - $objWriter->save($outputFileName); |
|
134 | - echo date('H:i:s') , " File written to " , $outputFileName , EOL; |
|
135 | - |
|
136 | - $objPHPExcel->disconnectWorksheets(); |
|
137 | - unset($objPHPExcel); |
|
71 | + $inputFileNameShort = basename($inputFileName); |
|
72 | + |
|
73 | + if (!file_exists($inputFileName)) { |
|
74 | + echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL; |
|
75 | + continue; |
|
76 | + } |
|
77 | + |
|
78 | + echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL; |
|
79 | + |
|
80 | + $objReader = \PHPExcel\IOFactory::createReader($inputFileType); |
|
81 | + $objReader->setIncludeCharts(TRUE); |
|
82 | + $objPHPExcel = $objReader->load($inputFileName); |
|
83 | + |
|
84 | + |
|
85 | + echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL; |
|
86 | + foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { |
|
87 | + $sheetName = $worksheet->getTitle(); |
|
88 | + echo 'Worksheet: ' , $sheetName , EOL; |
|
89 | + |
|
90 | + $chartNames = $worksheet->getChartNames(); |
|
91 | + if(empty($chartNames)) { |
|
92 | + echo ' There are no charts in this worksheet' , EOL; |
|
93 | + } else { |
|
94 | + natsort($chartNames); |
|
95 | + foreach($chartNames as $i => $chartName) { |
|
96 | + $chart = $worksheet->getChartByName($chartName); |
|
97 | + if (!is_null($chart->getTitle())) { |
|
98 | + $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"'; |
|
99 | + } else { |
|
100 | + $caption = 'Untitled'; |
|
101 | + } |
|
102 | + echo ' ' , $chartName , ' - ' , $caption , EOL; |
|
103 | + echo str_repeat(' ',strlen($chartName)+3); |
|
104 | + $groupCount = $chart->getPlotArea()->getPlotGroupCount(); |
|
105 | + if ($groupCount == 1) { |
|
106 | + $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); |
|
107 | + echo ' ' , $chartType , EOL; |
|
108 | + } else { |
|
109 | + $chartTypes = array(); |
|
110 | + for($i = 0; $i < $groupCount; ++$i) { |
|
111 | + $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); |
|
112 | + } |
|
113 | + $chartTypes = array_unique($chartTypes); |
|
114 | + if (count($chartTypes) == 1) { |
|
115 | + $chartType = 'Multiple Plot ' . array_pop($chartTypes); |
|
116 | + echo ' ' , $chartType , EOL; |
|
117 | + } elseif (count($chartTypes) == 0) { |
|
118 | + echo ' *** Type not yet implemented' , EOL; |
|
119 | + } else { |
|
120 | + echo ' Combination Chart' , EOL; |
|
121 | + } |
|
122 | + } |
|
123 | + } |
|
124 | + } |
|
125 | + } |
|
126 | + |
|
127 | + |
|
128 | + $outputFileName = str_replace('.xlsx', '.pdf', basename($inputFileName)); |
|
129 | + |
|
130 | + echo date('H:i:s') , " Write Tests to HTML file " , EOL; |
|
131 | + $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF'); |
|
132 | + $objWriter->setIncludeCharts(TRUE); |
|
133 | + $objWriter->save($outputFileName); |
|
134 | + echo date('H:i:s') , " File written to " , $outputFileName , EOL; |
|
135 | + |
|
136 | + $objPHPExcel->disconnectWorksheets(); |
|
137 | + unset($objPHPExcel); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | // Echo memory peak usage |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | ini_set('display_startup_errors', TRUE); |
7 | 7 | date_default_timezone_set('Europe/London'); |
8 | 8 | |
9 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
9 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
10 | 10 | |
11 | 11 | date_default_timezone_set('Europe/London'); |
12 | 12 | |
@@ -61,63 +61,63 @@ discard block |
||
61 | 61 | |
62 | 62 | if ((isset($argc)) && ($argc > 1)) { |
63 | 63 | $inputFileNames = array(); |
64 | - for($i = 1; $i < $argc; ++$i) { |
|
64 | + for ($i = 1; $i < $argc; ++$i) { |
|
65 | 65 | $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i]; |
66 | 66 | } |
67 | 67 | } else { |
68 | 68 | $inputFileNames = glob($inputFileNames); |
69 | 69 | } |
70 | -foreach($inputFileNames as $inputFileName) { |
|
70 | +foreach ($inputFileNames as $inputFileName) { |
|
71 | 71 | $inputFileNameShort = basename($inputFileName); |
72 | 72 | |
73 | 73 | if (!file_exists($inputFileName)) { |
74 | - echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL; |
|
74 | + echo date('H:i:s'), " File ", $inputFileNameShort, ' does not exist', EOL; |
|
75 | 75 | continue; |
76 | 76 | } |
77 | 77 | |
78 | - echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL; |
|
78 | + echo date('H:i:s'), " Load Test from $inputFileType file ", $inputFileNameShort, EOL; |
|
79 | 79 | |
80 | 80 | $objReader = \PHPExcel\IOFactory::createReader($inputFileType); |
81 | 81 | $objReader->setIncludeCharts(TRUE); |
82 | 82 | $objPHPExcel = $objReader->load($inputFileName); |
83 | 83 | |
84 | 84 | |
85 | - echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL; |
|
85 | + echo date('H:i:s'), " Iterate worksheets looking at the charts", EOL; |
|
86 | 86 | foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { |
87 | 87 | $sheetName = $worksheet->getTitle(); |
88 | - echo 'Worksheet: ' , $sheetName , EOL; |
|
88 | + echo 'Worksheet: ', $sheetName, EOL; |
|
89 | 89 | |
90 | 90 | $chartNames = $worksheet->getChartNames(); |
91 | - if(empty($chartNames)) { |
|
92 | - echo ' There are no charts in this worksheet' , EOL; |
|
91 | + if (empty($chartNames)) { |
|
92 | + echo ' There are no charts in this worksheet', EOL; |
|
93 | 93 | } else { |
94 | 94 | natsort($chartNames); |
95 | - foreach($chartNames as $i => $chartName) { |
|
95 | + foreach ($chartNames as $i => $chartName) { |
|
96 | 96 | $chart = $worksheet->getChartByName($chartName); |
97 | 97 | if (!is_null($chart->getTitle())) { |
98 | - $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"'; |
|
98 | + $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; |
|
99 | 99 | } else { |
100 | 100 | $caption = 'Untitled'; |
101 | 101 | } |
102 | - echo ' ' , $chartName , ' - ' , $caption , EOL; |
|
103 | - echo str_repeat(' ',strlen($chartName)+3); |
|
102 | + echo ' ', $chartName, ' - ', $caption, EOL; |
|
103 | + echo str_repeat(' ', strlen($chartName) + 3); |
|
104 | 104 | $groupCount = $chart->getPlotArea()->getPlotGroupCount(); |
105 | 105 | if ($groupCount == 1) { |
106 | 106 | $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); |
107 | - echo ' ' , $chartType , EOL; |
|
107 | + echo ' ', $chartType, EOL; |
|
108 | 108 | } else { |
109 | 109 | $chartTypes = array(); |
110 | - for($i = 0; $i < $groupCount; ++$i) { |
|
110 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
111 | 111 | $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); |
112 | 112 | } |
113 | 113 | $chartTypes = array_unique($chartTypes); |
114 | 114 | if (count($chartTypes) == 1) { |
115 | 115 | $chartType = 'Multiple Plot ' . array_pop($chartTypes); |
116 | - echo ' ' , $chartType , EOL; |
|
116 | + echo ' ', $chartType, EOL; |
|
117 | 117 | } elseif (count($chartTypes) == 0) { |
118 | - echo ' *** Type not yet implemented' , EOL; |
|
118 | + echo ' *** Type not yet implemented', EOL; |
|
119 | 119 | } else { |
120 | - echo ' Combination Chart' , EOL; |
|
120 | + echo ' Combination Chart', EOL; |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | } |
@@ -127,19 +127,19 @@ discard block |
||
127 | 127 | |
128 | 128 | $outputFileName = str_replace('.xlsx', '.pdf', basename($inputFileName)); |
129 | 129 | |
130 | - echo date('H:i:s') , " Write Tests to HTML file " , EOL; |
|
130 | + echo date('H:i:s'), " Write Tests to HTML file ", EOL; |
|
131 | 131 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF'); |
132 | 132 | $objWriter->setIncludeCharts(TRUE); |
133 | 133 | $objWriter->save($outputFileName); |
134 | - echo date('H:i:s') , " File written to " , $outputFileName , EOL; |
|
134 | + echo date('H:i:s'), " File written to ", $outputFileName, EOL; |
|
135 | 135 | |
136 | 136 | $objPHPExcel->disconnectWorksheets(); |
137 | 137 | unset($objPHPExcel); |
138 | 138 | } |
139 | 139 | |
140 | 140 | // Echo memory peak usage |
141 | -echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
141 | +echo date('H:i:s'), ' Peak memory usage: ', (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
142 | 142 | |
143 | 143 | // Echo done |
144 | -echo date('H:i:s') , " Done writing files" , EOL; |
|
145 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
144 | +echo date('H:i:s'), " Done writing files", EOL; |
|
145 | +echo 'Files have been created in ', getcwd(), EOL; |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | // Set document properties |
47 | 47 | echo date('H:i:s') , " Set document properties" , EOL; |
48 | 48 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
49 | - ->setLastModifiedBy("Maarten Balliauw") |
|
50 | - ->setTitle("Office 2007 XLSX Test Document") |
|
51 | - ->setSubject("Office 2007 XLSX Test Document") |
|
52 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
53 | - ->setKeywords("office 2007 openxml php") |
|
54 | - ->setCategory("Test result file"); |
|
49 | + ->setLastModifiedBy("Maarten Balliauw") |
|
50 | + ->setTitle("Office 2007 XLSX Test Document") |
|
51 | + ->setSubject("Office 2007 XLSX Test Document") |
|
52 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
53 | + ->setKeywords("office 2007 openxml php") |
|
54 | + ->setCategory("Test result file"); |
|
55 | 55 | |
56 | 56 | |
57 | 57 | // Add some data |
@@ -62,26 +62,26 @@ discard block |
||
62 | 62 | $sharedStyle2 = new \PHPExcel\Style(); |
63 | 63 | |
64 | 64 | $sharedStyle1->applyFromArray( |
65 | - array('fill' => array( |
|
66 | - 'type' => \PHPExcel\Style\Fill::FILL_SOLID, |
|
67 | - 'color' => array('argb' => 'FFCCFFCC') |
|
68 | - ), |
|
69 | - 'borders' => array( |
|
70 | - 'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN), |
|
71 | - 'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM) |
|
72 | - ) |
|
73 | - )); |
|
65 | + array('fill' => array( |
|
66 | + 'type' => \PHPExcel\Style\Fill::FILL_SOLID, |
|
67 | + 'color' => array('argb' => 'FFCCFFCC') |
|
68 | + ), |
|
69 | + 'borders' => array( |
|
70 | + 'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN), |
|
71 | + 'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM) |
|
72 | + ) |
|
73 | + )); |
|
74 | 74 | |
75 | 75 | $sharedStyle2->applyFromArray( |
76 | - array('fill' => array( |
|
77 | - 'type' => \PHPExcel\Style\Fill::FILL_SOLID, |
|
78 | - 'color' => array('argb' => 'FFFFFF00') |
|
79 | - ), |
|
80 | - 'borders' => array( |
|
81 | - 'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN), |
|
82 | - 'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM) |
|
83 | - ) |
|
84 | - )); |
|
76 | + array('fill' => array( |
|
77 | + 'type' => \PHPExcel\Style\Fill::FILL_SOLID, |
|
78 | + 'color' => array('argb' => 'FFFFFF00') |
|
79 | + ), |
|
80 | + 'borders' => array( |
|
81 | + 'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN), |
|
82 | + 'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM) |
|
83 | + ) |
|
84 | + )); |
|
85 | 85 | |
86 | 86 | $objPHPExcel->getActiveSheet()->duplicateStyle($sharedStyle1, "A1:T100"); |
87 | 87 | $objPHPExcel->getActiveSheet()->duplicateStyle($sharedStyle2, "C5:R95"); |
@@ -31,7 +31,7 @@ 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 | date_default_timezone_set('Europe/London'); |
37 | 37 | |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | // Create new PHPExcel object |
43 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
43 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
44 | 44 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
45 | 45 | |
46 | 46 | // Set document properties |
47 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
47 | +echo date('H:i:s'), " Set document properties", EOL; |
|
48 | 48 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
49 | 49 | ->setLastModifiedBy("Maarten Balliauw") |
50 | 50 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | |
57 | 57 | // Add some data |
58 | -echo date('H:i:s') , " Add some data" , EOL; |
|
58 | +echo date('H:i:s'), " Add some data", EOL; |
|
59 | 59 | $objPHPExcel->setActiveSheetIndex(0); |
60 | 60 | |
61 | 61 | $sharedStyle1 = new \PHPExcel\Style(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $objPHPExcel->getActiveSheet()->duplicateStyle($sharedStyle2, "C5:R95"); |
88 | 88 | |
89 | 89 | // Save Excel 2007 file |
90 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
90 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
91 | 91 | $callStartTime = microtime(true); |
92 | 92 | |
93 | 93 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | $callEndTime = microtime(true); |
96 | 96 | $callTime = $callEndTime - $callStartTime; |
97 | 97 | |
98 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
99 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
98 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
99 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
100 | 100 | // Echo memory usage |
101 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
101 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
102 | 102 | |
103 | 103 | |
104 | 104 | // Save Excel 95 file |
105 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
105 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
106 | 106 | $callStartTime = microtime(true); |
107 | 107 | |
108 | 108 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
@@ -110,15 +110,15 @@ discard block |
||
110 | 110 | $callEndTime = microtime(true); |
111 | 111 | $callTime = $callEndTime - $callStartTime; |
112 | 112 | |
113 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
114 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
113 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
114 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
115 | 115 | // Echo memory usage |
116 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
116 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
117 | 117 | |
118 | 118 | |
119 | 119 | // Echo memory peak usage |
120 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
120 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
121 | 121 | |
122 | 122 | // Echo done |
123 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
124 | -echo 'File has been created in ' , getcwd() , EOL; |
|
123 | +echo date('H:i:s'), " Done writing file", EOL; |
|
124 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -30,14 +30,14 @@ 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 | |
37 | 37 | include "05featuredemo.inc.php"; |
38 | 38 | |
39 | 39 | // Save Excel 2007 file |
40 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
40 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
41 | 41 | $callStartTime = microtime(true); |
42 | 42 | |
43 | 43 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | $callEndTime = microtime(true); |
46 | 46 | $callTime = $callEndTime - $callStartTime; |
47 | 47 | |
48 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
49 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
48 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
49 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
50 | 50 | // Echo memory usage |
51 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
51 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
52 | 52 | |
53 | 53 | |
54 | 54 | // Save Excel 95 file |
55 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
55 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
56 | 56 | $callStartTime = microtime(true); |
57 | 57 | |
58 | 58 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | $callEndTime = microtime(true); |
61 | 61 | $callTime = $callEndTime - $callStartTime; |
62 | 62 | |
63 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
64 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
63 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
64 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
65 | 65 | // Echo memory usage |
66 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
66 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
67 | 67 | |
68 | 68 | |
69 | 69 | // Echo memory peak usage |
70 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
70 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
71 | 71 | |
72 | 72 | // Echo done |
73 | -echo date('H:i:s') , " Done writing files" , EOL; |
|
74 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
73 | +echo date('H:i:s'), " Done writing files", EOL; |
|
74 | +echo 'Files have been created in ', getcwd(), EOL; |
@@ -34,17 +34,17 @@ |
||
34 | 34 | require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php'; |
35 | 35 | |
36 | 36 | |
37 | -echo date('H:i:s') , " Load from SYLK file" , PHP_EOL; |
|
37 | +echo date('H:i:s'), " Load from SYLK file", PHP_EOL; |
|
38 | 38 | $objPHPExcel = \PHPExcel\IOFactory::load("SylkTest.slk"); |
39 | 39 | |
40 | -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; |
|
40 | +echo date('H:i:s'), " Write to Excel2007 format", PHP_EOL; |
|
41 | 41 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
42 | 42 | $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); |
43 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; |
|
43 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', __FILE__), PHP_EOL; |
|
44 | 44 | |
45 | 45 | |
46 | 46 | // Echo memory peak usage |
47 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_EOL; |
|
47 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", PHP_EOL; |
|
48 | 48 | |
49 | 49 | // Echo done |
50 | -echo date('H:i:s') , " Done writing file" , PHP_EOL; |
|
50 | +echo date('H:i:s'), " Done writing file", PHP_EOL; |
@@ -31,7 +31,7 @@ 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 | date_default_timezone_set('Europe/London'); |
37 | 37 | |
@@ -105,4 +105,4 @@ discard block |
||
105 | 105 | echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n"; |
106 | 106 | |
107 | 107 | // Echo done |
108 | -echo date('H:i:s') . " Done" , EOL; |
|
108 | +echo date('H:i:s') . " Done", EOL; |
@@ -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 PHPExcel object |
42 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
42 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
43 | 43 | $objPHPExcel = new \PHPExcel\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 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
48 | 48 | ->setLastModifiedBy("Maarten Balliauw") |
49 | 49 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | ->setCategory("Test result file"); |
54 | 54 | |
55 | 55 | // Generate an image |
56 | -echo date('H:i:s') , " Generate an image" , EOL; |
|
56 | +echo date('H:i:s'), " Generate an image", EOL; |
|
57 | 57 | $gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); |
58 | 58 | $textColor = imagecolorallocate($gdImage, 255, 255, 255); |
59 | -imagestring($gdImage, 1, 5, 5, 'Created with PHPExcel', $textColor); |
|
59 | +imagestring($gdImage, 1, 5, 5, 'Created with PHPExcel', $textColor); |
|
60 | 60 | |
61 | 61 | // Add a drawing to the worksheet |
62 | -echo date('H:i:s') , " Add a drawing to the worksheet" , EOL; |
|
62 | +echo date('H:i:s'), " Add a drawing to the worksheet", EOL; |
|
63 | 63 | $objDrawing = new \PHPExcel\Worksheet\MemoryDrawing(); |
64 | 64 | $objDrawing->setName('Sample image'); |
65 | 65 | $objDrawing->setDescription('Sample image'); |
@@ -69,21 +69,21 @@ discard block |
||
69 | 69 | $objDrawing->setHeight(36); |
70 | 70 | $objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); |
71 | 71 | |
72 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
72 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
73 | 73 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
74 | 74 | $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); |
75 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
75 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
76 | 76 | |
77 | 77 | |
78 | -echo date('H:i:s') , " Write to HTML format" , EOL; |
|
78 | +echo date('H:i:s'), " Write to HTML format", EOL; |
|
79 | 79 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML'); |
80 | 80 | $objWriter->save(str_replace('.php', '.html', __FILE__)); |
81 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.html', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
81 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.html', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
82 | 82 | |
83 | 83 | |
84 | 84 | // Echo memory peak usage |
85 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
85 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
86 | 86 | |
87 | 87 | // Echo done |
88 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
89 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
88 | +echo date('H:i:s'), " Done writing file", EOL; |
|
89 | +echo 'Files have been created in ', getcwd(), EOL; |
@@ -45,12 +45,12 @@ |
||
45 | 45 | // Set document properties |
46 | 46 | echo date('H:i:s') , " Set document properties" , EOL; |
47 | 47 | $objPHPExcel->getProperties()->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 | |
56 | 56 | // Add some data |
@@ -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 PHPExcel */ |
37 | 37 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
38 | 38 | |
39 | 39 | |
40 | 40 | // Create new PHPExcel object |
41 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
41 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
42 | 42 | $objPHPExcel = new \PHPExcel\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 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
47 | 47 | ->setLastModifiedBy("Maarten Balliauw") |
48 | 48 | ->setTitle("PHPExcel Test Document") |
@@ -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 | $objPHPExcel->setActiveSheetIndex(0) |
58 | 58 | ->setCellValue('A1', 'Hello') |
59 | 59 | ->setCellValue('B2', 'world!') |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); |
67 | 67 | |
68 | 68 | |
69 | -$objPHPExcel->getActiveSheet()->setCellValue('A8',"Hello\nWorld"); |
|
69 | +$objPHPExcel->getActiveSheet()->setCellValue('A8', "Hello\nWorld"); |
|
70 | 70 | $objPHPExcel->getActiveSheet()->getRowDimension(8)->setRowHeight(-1); |
71 | 71 | $objPHPExcel->getActiveSheet()->getStyle('A8')->getAlignment()->setWrapText(true); |
72 | 72 | |
73 | 73 | |
74 | 74 | // Rename worksheet |
75 | -echo date('H:i:s') , " Rename worksheet" , EOL; |
|
75 | +echo date('H:i:s'), " Rename worksheet", EOL; |
|
76 | 76 | $objPHPExcel->getActiveSheet()->setTitle('Simple'); |
77 | 77 | |
78 | 78 | |
79 | 79 | // Clone worksheet |
80 | -echo date('H:i:s') , " Clone worksheet" , EOL; |
|
80 | +echo date('H:i:s'), " Clone worksheet", EOL; |
|
81 | 81 | $clonedSheet = clone $objPHPExcel->getActiveSheet(); |
82 | 82 | $clonedSheet |
83 | 83 | ->setCellValue('A1', 'Goodbye') |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | ->setCellValue('C2', 'cruel'); |
87 | 87 | |
88 | 88 | // Rename cloned worksheet |
89 | -echo date('H:i:s') , " Rename cloned worksheet" , EOL; |
|
89 | +echo date('H:i:s'), " Rename cloned worksheet", EOL; |
|
90 | 90 | $clonedSheet->setTitle('Simple Clone'); |
91 | 91 | $objPHPExcel->addSheet($clonedSheet); |
92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | |
98 | 98 | // Save Excel 2007 file |
99 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
99 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
100 | 100 | $callStartTime = microtime(true); |
101 | 101 | |
102 | 102 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | $callEndTime = microtime(true); |
105 | 105 | $callTime = $callEndTime - $callStartTime; |
106 | 106 | |
107 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
108 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
107 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
108 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
109 | 109 | // Echo memory usage |
110 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
110 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
111 | 111 | |
112 | 112 | |
113 | 113 | // Echo memory peak usage |
114 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
114 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
115 | 115 | |
116 | 116 | // Echo done |
117 | -echo date('H:i:s') , " Done writing files" , EOL; |
|
118 | -echo 'File has been created in ' , getcwd() , EOL; |
|
117 | +echo date('H:i:s'), " Done writing files", EOL; |
|
118 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -44,12 +44,12 @@ |
||
44 | 44 | // Set document properties |
45 | 45 | echo date('H:i:s') , " Set document properties" , EOL; |
46 | 46 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
47 | - ->setLastModifiedBy("Maarten Balliauw") |
|
48 | - ->setTitle("PHPExcel Test Document") |
|
49 | - ->setSubject("PHPExcel Test Document") |
|
50 | - ->setDescription("Test document for PHPExcel, generated using PHP classes.") |
|
51 | - ->setKeywords("office PHPExcel php") |
|
52 | - ->setCategory("Test result file"); |
|
47 | + ->setLastModifiedBy("Maarten Balliauw") |
|
48 | + ->setTitle("PHPExcel Test Document") |
|
49 | + ->setSubject("PHPExcel Test Document") |
|
50 | + ->setDescription("Test document for PHPExcel, generated using PHP classes.") |
|
51 | + ->setKeywords("office PHPExcel php") |
|
52 | + ->setCategory("Test result file"); |
|
53 | 53 | |
54 | 54 | |
55 | 55 | // Add some data |
@@ -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; |
@@ -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() |
46 | 46 | ->setCreator("Maarten Balliauw") |
47 | 47 | ->setLastModifiedBy("Maarten Balliauw") |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | ->setCategory("Test result file"); |
53 | 53 | |
54 | 54 | // Set default font |
55 | -echo date('H:i:s') , " Set default font" , EOL; |
|
55 | +echo date('H:i:s'), " Set default font", EOL; |
|
56 | 56 | $objPhpSpreadsheet->getDefaultStyle() |
57 | 57 | ->getFont() |
58 | 58 | ->setName('Arial') |
59 | 59 | ->setSize(10); |
60 | 60 | |
61 | 61 | // Add some data, resembling some different data types |
62 | -echo date('H:i:s') , " Add some data" , EOL; |
|
62 | +echo date('H:i:s'), " Add some data", EOL; |
|
63 | 63 | $objPhpSpreadsheet->getActiveSheet() |
64 | 64 | ->setCellValue('A1', 'String') |
65 | 65 | ->setCellValue('B1', 'Simple') |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $objPhpSpreadsheet->getActiveSheet() |
105 | 105 | ->setCellValue('A9', 'Date/Time') |
106 | 106 | ->setCellValue('B9', 'Date') |
107 | - ->setCellValue('C9', \PhpSpreadsheet\Shared\Date::PHPToExcel( $dateTimeNow )); |
|
107 | + ->setCellValue('C9', \PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow)); |
|
108 | 108 | $objPhpSpreadsheet->getActiveSheet() |
109 | 109 | ->getStyle('C9') |
110 | 110 | ->getNumberFormat() |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $objPhpSpreadsheet->getActiveSheet() |
114 | 114 | ->setCellValue('A10', 'Date/Time') |
115 | 115 | ->setCellValue('B10', 'Time') |
116 | - ->setCellValue('C10', \PhpSpreadsheet\Shared\Date::PHPToExcel( $dateTimeNow )); |
|
116 | + ->setCellValue('C10', \PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow)); |
|
117 | 117 | $objPhpSpreadsheet->getActiveSheet() |
118 | 118 | ->getStyle('C10') |
119 | 119 | ->getNumberFormat() |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $objPhpSpreadsheet->getActiveSheet() |
123 | 123 | ->setCellValue('A11', 'Date/Time') |
124 | 124 | ->setCellValue('B11', 'Date and Time') |
125 | - ->setCellValue('C11', \PhpSpreadsheet\Shared\Date::PHPToExcel( $dateTimeNow )); |
|
125 | + ->setCellValue('C11', \PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow)); |
|
126 | 126 | $objPhpSpreadsheet->getActiveSheet() |
127 | 127 | ->getStyle('C11') |
128 | 128 | ->getNumberFormat() |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $objPayable = $objRichText->createTextRun('你 好 吗?'); |
139 | 139 | $objPayable->getFont()->setBold(true); |
140 | 140 | $objPayable->getFont()->setItalic(true); |
141 | -$objPayable->getFont()->setColor( new \PhpSpreadsheet\Style\Color( \PhpSpreadsheet\Style\Color::COLOR_DARKGREEN ) ); |
|
141 | +$objPayable->getFont()->setColor(new \PhpSpreadsheet\Style\Color(\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN)); |
|
142 | 142 | |
143 | 143 | $objRichText->createText(', unless specified otherwise on the invoice.'); |
144 | 144 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $objRichText2->createText("black text\n"); |
152 | 152 | |
153 | 153 | $objRed = $objRichText2->createTextRun("red text"); |
154 | -$objRed->getFont()->setColor( new \PhpSpreadsheet\Style\Color(\PhpSpreadsheet\Style\Color::COLOR_RED ) ); |
|
154 | +$objRed->getFont()->setColor(new \PhpSpreadsheet\Style\Color(\PhpSpreadsheet\Style\Color::COLOR_RED)); |
|
155 | 155 | |
156 | 156 | $objPhpSpreadsheet->getActiveSheet() |
157 | 157 | ->getCell("C14") |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ->setAutoSize(true); |
184 | 184 | |
185 | 185 | // Rename worksheet |
186 | -echo date('H:i:s') , " Rename worksheet" , EOL; |
|
186 | +echo date('H:i:s'), " Rename worksheet", EOL; |
|
187 | 187 | $objPhpSpreadsheet->getActiveSheet()->setTitle('Datatypes'); |
188 | 188 | |
189 | 189 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | |
194 | 194 | // Save Excel 2007 file |
195 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
195 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
196 | 196 | $callStartTime = microtime(true); |
197 | 197 | |
198 | 198 | $objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel2007'); |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | $callEndTime = microtime(true); |
201 | 201 | $callTime = $callEndTime - $callStartTime; |
202 | 202 | |
203 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
204 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
203 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
204 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
205 | 205 | // Echo memory usage |
206 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
206 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
207 | 207 | |
208 | 208 | |
209 | 209 | // Save Excel 5 file |
210 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
210 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
211 | 211 | $callStartTime = microtime(true); |
212 | 212 | |
213 | 213 | $objWriter = \PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, 'Excel5'); |
@@ -215,15 +215,15 @@ discard block |
||
215 | 215 | $callEndTime = microtime(true); |
216 | 216 | $callTime = $callEndTime - $callStartTime; |
217 | 217 | |
218 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
219 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
218 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
219 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
220 | 220 | // Echo memory usage |
221 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
221 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
222 | 222 | |
223 | 223 | |
224 | 224 | // Echo memory peak usage |
225 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
225 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
226 | 226 | |
227 | 227 | // Echo done |
228 | -echo date('H:i:s') , " Done testing file" , EOL; |
|
229 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
228 | +echo date('H:i:s'), " Done testing file", EOL; |
|
229 | +echo 'Files have been created in ', getcwd(), EOL; |