@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | |
23 | 23 | |
24 | 24 | if (!PHPExcel\Settings::setChartRenderer( |
25 | - $rendererName, |
|
26 | - $rendererLibraryPath |
|
27 | - )) { |
|
28 | - die( |
|
29 | - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
30 | - EOL . |
|
31 | - 'at the top of this script as appropriate for your directory structure' |
|
32 | - ); |
|
25 | + $rendererName, |
|
26 | + $rendererLibraryPath |
|
27 | + )) { |
|
28 | + die( |
|
29 | + 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
30 | + EOL . |
|
31 | + 'at the top of this script as appropriate for your directory structure' |
|
32 | + ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -37,81 +37,81 @@ discard block |
||
37 | 37 | $inputFileNames = 'templates/36write*.xlsx'; |
38 | 38 | |
39 | 39 | if ((isset($argc)) && ($argc > 1)) { |
40 | - $inputFileNames = array(); |
|
41 | - for($i = 1; $i < $argc; ++$i) { |
|
42 | - $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i]; |
|
43 | - } |
|
40 | + $inputFileNames = array(); |
|
41 | + for($i = 1; $i < $argc; ++$i) { |
|
42 | + $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i]; |
|
43 | + } |
|
44 | 44 | } else { |
45 | - $inputFileNames = glob($inputFileNames); |
|
45 | + $inputFileNames = glob($inputFileNames); |
|
46 | 46 | } |
47 | 47 | foreach($inputFileNames as $inputFileName) { |
48 | - $inputFileNameShort = basename($inputFileName); |
|
49 | - |
|
50 | - if (!file_exists($inputFileName)) { |
|
51 | - echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL; |
|
52 | - continue; |
|
53 | - } |
|
54 | - |
|
55 | - echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL; |
|
56 | - |
|
57 | - $objReader = \PHPExcel\IOFactory::createReader($inputFileType); |
|
58 | - $objReader->setIncludeCharts(TRUE); |
|
59 | - $objPHPExcel = $objReader->load($inputFileName); |
|
60 | - |
|
61 | - |
|
62 | - echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL; |
|
63 | - foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { |
|
64 | - $sheetName = $worksheet->getTitle(); |
|
65 | - echo 'Worksheet: ' , $sheetName , EOL; |
|
66 | - |
|
67 | - $chartNames = $worksheet->getChartNames(); |
|
68 | - if(empty($chartNames)) { |
|
69 | - echo ' There are no charts in this worksheet' , EOL; |
|
70 | - } else { |
|
71 | - natsort($chartNames); |
|
72 | - foreach($chartNames as $i => $chartName) { |
|
73 | - $chart = $worksheet->getChartByName($chartName); |
|
74 | - if (!is_null($chart->getTitle())) { |
|
75 | - $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"'; |
|
76 | - } else { |
|
77 | - $caption = 'Untitled'; |
|
78 | - } |
|
79 | - echo ' ' , $chartName , ' - ' , $caption , EOL; |
|
80 | - echo str_repeat(' ',strlen($chartName)+3); |
|
81 | - $groupCount = $chart->getPlotArea()->getPlotGroupCount(); |
|
82 | - if ($groupCount == 1) { |
|
83 | - $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); |
|
84 | - echo ' ' , $chartType , EOL; |
|
85 | - } else { |
|
86 | - $chartTypes = array(); |
|
87 | - for($i = 0; $i < $groupCount; ++$i) { |
|
88 | - $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); |
|
89 | - } |
|
90 | - $chartTypes = array_unique($chartTypes); |
|
91 | - if (count($chartTypes) == 1) { |
|
92 | - $chartType = 'Multiple Plot ' . array_pop($chartTypes); |
|
93 | - echo ' ' , $chartType , EOL; |
|
94 | - } elseif (count($chartTypes) == 0) { |
|
95 | - echo ' *** Type not yet implemented' , EOL; |
|
96 | - } else { |
|
97 | - echo ' Combination Chart' , EOL; |
|
98 | - } |
|
99 | - } |
|
100 | - } |
|
101 | - } |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - $outputFileName = str_replace('.xlsx', '.html', basename($inputFileName)); |
|
106 | - |
|
107 | - echo date('H:i:s') , " Write Tests to HTML file " , EOL; |
|
108 | - $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML'); |
|
109 | - $objWriter->setIncludeCharts(TRUE); |
|
110 | - $objWriter->save($outputFileName); |
|
111 | - echo date('H:i:s') , " File written to " , $outputFileName , EOL; |
|
112 | - |
|
113 | - $objPHPExcel->disconnectWorksheets(); |
|
114 | - unset($objPHPExcel); |
|
48 | + $inputFileNameShort = basename($inputFileName); |
|
49 | + |
|
50 | + if (!file_exists($inputFileName)) { |
|
51 | + echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL; |
|
52 | + continue; |
|
53 | + } |
|
54 | + |
|
55 | + echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL; |
|
56 | + |
|
57 | + $objReader = \PHPExcel\IOFactory::createReader($inputFileType); |
|
58 | + $objReader->setIncludeCharts(TRUE); |
|
59 | + $objPHPExcel = $objReader->load($inputFileName); |
|
60 | + |
|
61 | + |
|
62 | + echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL; |
|
63 | + foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { |
|
64 | + $sheetName = $worksheet->getTitle(); |
|
65 | + echo 'Worksheet: ' , $sheetName , EOL; |
|
66 | + |
|
67 | + $chartNames = $worksheet->getChartNames(); |
|
68 | + if(empty($chartNames)) { |
|
69 | + echo ' There are no charts in this worksheet' , EOL; |
|
70 | + } else { |
|
71 | + natsort($chartNames); |
|
72 | + foreach($chartNames as $i => $chartName) { |
|
73 | + $chart = $worksheet->getChartByName($chartName); |
|
74 | + if (!is_null($chart->getTitle())) { |
|
75 | + $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"'; |
|
76 | + } else { |
|
77 | + $caption = 'Untitled'; |
|
78 | + } |
|
79 | + echo ' ' , $chartName , ' - ' , $caption , EOL; |
|
80 | + echo str_repeat(' ',strlen($chartName)+3); |
|
81 | + $groupCount = $chart->getPlotArea()->getPlotGroupCount(); |
|
82 | + if ($groupCount == 1) { |
|
83 | + $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); |
|
84 | + echo ' ' , $chartType , EOL; |
|
85 | + } else { |
|
86 | + $chartTypes = array(); |
|
87 | + for($i = 0; $i < $groupCount; ++$i) { |
|
88 | + $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); |
|
89 | + } |
|
90 | + $chartTypes = array_unique($chartTypes); |
|
91 | + if (count($chartTypes) == 1) { |
|
92 | + $chartType = 'Multiple Plot ' . array_pop($chartTypes); |
|
93 | + echo ' ' , $chartType , EOL; |
|
94 | + } elseif (count($chartTypes) == 0) { |
|
95 | + echo ' *** Type not yet implemented' , EOL; |
|
96 | + } else { |
|
97 | + echo ' Combination Chart' , EOL; |
|
98 | + } |
|
99 | + } |
|
100 | + } |
|
101 | + } |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + $outputFileName = str_replace('.xlsx', '.html', basename($inputFileName)); |
|
106 | + |
|
107 | + echo date('H:i:s') , " Write Tests to HTML file " , EOL; |
|
108 | + $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML'); |
|
109 | + $objWriter->setIncludeCharts(TRUE); |
|
110 | + $objWriter->save($outputFileName); |
|
111 | + echo date('H:i:s') , " File written to " , $outputFileName , EOL; |
|
112 | + |
|
113 | + $objPHPExcel->disconnectWorksheets(); |
|
114 | + unset($objPHPExcel); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | // Echo memory peak usage |
@@ -45,12 +45,12 @@ discard block |
||
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 | // Create a first sheet, representing sales data |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | // duplicate the conditional styles across a range of cells |
98 | 98 | echo date('H:i:s') , " Duplicate the conditional formatting across a range of cells" , EOL; |
99 | 99 | $objPHPExcel->getActiveSheet()->duplicateConditionalStyle( |
100 | - $objPHPExcel->getActiveSheet()->getStyle('A1')->getConditionalStyles(), |
|
101 | - 'A2:A8' |
|
102 | - ); |
|
100 | + $objPHPExcel->getActiveSheet()->getStyle('A1')->getConditionalStyles(), |
|
101 | + 'A2:A8' |
|
102 | + ); |
|
103 | 103 | |
104 | 104 | |
105 | 105 | // Save Excel 2007 file |
@@ -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 |
@@ -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 |
@@ -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"); |
@@ -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; |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
44 | 44 | $objWorksheet = $objPHPExcel->getActiveSheet(); |
45 | 45 | $objWorksheet->fromArray( |
46 | - array( |
|
47 | - array('', 2010, 2011, 2012), |
|
48 | - array('Q1', 12, 15, 21), |
|
49 | - array('Q2', 56, 73, 86), |
|
50 | - array('Q3', 52, 61, 69), |
|
51 | - array('Q4', 30, 32, 0), |
|
52 | - ) |
|
46 | + array( |
|
47 | + array('', 2010, 2011, 2012), |
|
48 | + array('Q1', 12, 15, 21), |
|
49 | + array('Q2', 56, 73, 86), |
|
50 | + array('Q3', 52, 61, 69), |
|
51 | + array('Q4', 30, 32, 0), |
|
52 | + ) |
|
53 | 53 | ); |
54 | 54 | |
55 | 55 | |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | // Data values |
62 | 62 | // Data Marker |
63 | 63 | $dataSeriesLabels1 = array( |
64 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 |
|
65 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 |
|
66 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 |
|
64 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 |
|
65 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 |
|
66 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 |
|
67 | 67 | ); |
68 | 68 | // Set the X-Axis Labels |
69 | 69 | // Datatype |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // Data values |
74 | 74 | // Data Marker |
75 | 75 | $xAxisTickValues1 = array( |
76 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
76 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
77 | 77 | ); |
78 | 78 | // Set the Data values for each data series we want to plot |
79 | 79 | // Datatype |
@@ -83,19 +83,19 @@ discard block |
||
83 | 83 | // Data values |
84 | 84 | // Data Marker |
85 | 85 | $dataSeriesValues1 = array( |
86 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), |
|
87 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), |
|
88 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), |
|
86 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), |
|
87 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), |
|
88 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | // Build the dataseries |
92 | 92 | $series1 = new \PHPExcel\Chart\DataSeries( |
93 | - \PHPExcel\Chart\DataSeries::TYPE_AREACHART, // plotType |
|
94 | - \PHPExcel\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping |
|
95 | - range(0, count($dataSeriesValues1)-1), // plotOrder |
|
96 | - $dataSeriesLabels1, // plotLabel |
|
97 | - $xAxisTickValues1, // plotCategory |
|
98 | - $dataSeriesValues1 // plotValues |
|
93 | + \PHPExcel\Chart\DataSeries::TYPE_AREACHART, // plotType |
|
94 | + \PHPExcel\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping |
|
95 | + range(0, count($dataSeriesValues1)-1), // plotOrder |
|
96 | + $dataSeriesLabels1, // plotLabel |
|
97 | + $xAxisTickValues1, // plotCategory |
|
98 | + $dataSeriesValues1 // plotValues |
|
99 | 99 | ); |
100 | 100 | |
101 | 101 | // Set the series in the plot area |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | |
110 | 110 | // Create the chart |
111 | 111 | $chart1 = new \PHPExcel\Chart( |
112 | - 'chart1', // name |
|
113 | - $title1, // title |
|
114 | - $legend1, // legend |
|
115 | - $plotArea1, // plotArea |
|
116 | - true, // plotVisibleOnly |
|
117 | - 0, // displayBlanksAs |
|
118 | - NULL, // xAxisLabel |
|
119 | - $yAxisLabel1 // yAxisLabel |
|
112 | + 'chart1', // name |
|
113 | + $title1, // title |
|
114 | + $legend1, // legend |
|
115 | + $plotArea1, // plotArea |
|
116 | + true, // plotVisibleOnly |
|
117 | + 0, // displayBlanksAs |
|
118 | + NULL, // xAxisLabel |
|
119 | + $yAxisLabel1 // yAxisLabel |
|
120 | 120 | ); |
121 | 121 | |
122 | 122 | // Set the position where the chart should appear in the worksheet |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | // Data values |
136 | 136 | // Data Marker |
137 | 137 | $dataSeriesLabels2 = array( |
138 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 |
|
139 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 |
|
140 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 |
|
138 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 |
|
139 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 |
|
140 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 |
|
141 | 141 | ); |
142 | 142 | // Set the X-Axis Labels |
143 | 143 | // Datatype |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | // Data values |
148 | 148 | // Data Marker |
149 | 149 | $xAxisTickValues2 = array( |
150 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
150 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
151 | 151 | ); |
152 | 152 | // Set the Data values for each data series we want to plot |
153 | 153 | // Datatype |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | // Data values |
158 | 158 | // Data Marker |
159 | 159 | $dataSeriesValues2 = array( |
160 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), |
|
161 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), |
|
162 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), |
|
160 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), |
|
161 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), |
|
162 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), |
|
163 | 163 | ); |
164 | 164 | |
165 | 165 | // Build the dataseries |
166 | 166 | $series2 = new \PHPExcel\Chart\DataSeries( |
167 | - \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType |
|
168 | - \PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping |
|
169 | - range(0, count($dataSeriesValues2)-1), // plotOrder |
|
170 | - $dataSeriesLabels2, // plotLabel |
|
171 | - $xAxisTickValues2, // plotCategory |
|
172 | - $dataSeriesValues2 // plotValues |
|
167 | + \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType |
|
168 | + \PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping |
|
169 | + range(0, count($dataSeriesValues2)-1), // plotOrder |
|
170 | + $dataSeriesLabels2, // plotLabel |
|
171 | + $xAxisTickValues2, // plotCategory |
|
172 | + $dataSeriesValues2 // plotValues |
|
173 | 173 | ); |
174 | 174 | // Set additional dataseries parameters |
175 | 175 | // Make it a vertical column rather than a horizontal bar graph |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | |
187 | 187 | // Create the chart |
188 | 188 | $chart2 = new \PHPExcel\Chart( |
189 | - 'chart2', // name |
|
190 | - $title2, // title |
|
191 | - $legend2, // legend |
|
192 | - $plotArea2, // plotArea |
|
193 | - true, // plotVisibleOnly |
|
194 | - 0, // displayBlanksAs |
|
195 | - NULL, // xAxisLabel |
|
196 | - $yAxisLabel2 // yAxisLabel |
|
189 | + 'chart2', // name |
|
190 | + $title2, // title |
|
191 | + $legend2, // legend |
|
192 | + $plotArea2, // plotArea |
|
193 | + true, // plotVisibleOnly |
|
194 | + 0, // displayBlanksAs |
|
195 | + NULL, // xAxisLabel |
|
196 | + $yAxisLabel2 // yAxisLabel |
|
197 | 197 | ); |
198 | 198 | |
199 | 199 | // Set the position where the chart should appear in the worksheet |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | |
42 | 42 | if (!file_exists("14excel5.xls")) { |
43 | - exit("Please run 14excel5.php first.\n"); |
|
43 | + exit("Please run 14excel5.php first.\n"); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | echo date('H:i:s') , " Load workbook from Excel5 file" , EOL; |
@@ -33,30 +33,30 @@ |
||
33 | 33 | <?php |
34 | 34 | /** If the user has submitted the form, then we need to execute a calculation **/ |
35 | 35 | if (isset($_POST['submit'])) { |
36 | - if ($_POST['A'] == 0) { |
|
37 | - echo 'The equation is not quadratic'; |
|
38 | - } else { |
|
39 | - /** So we include PHPExcel to perform the calculations **/ |
|
40 | - include 'PHPExcel/Calculation.php'; |
|
36 | + if ($_POST['A'] == 0) { |
|
37 | + echo 'The equation is not quadratic'; |
|
38 | + } else { |
|
39 | + /** So we include PHPExcel to perform the calculations **/ |
|
40 | + include 'PHPExcel/Calculation.php'; |
|
41 | 41 | |
42 | - /** Calculate and Display the results **/ |
|
43 | - echo '<hr /><b>Roots:</b><br />'; |
|
42 | + /** Calculate and Display the results **/ |
|
43 | + echo '<hr /><b>Roots:</b><br />'; |
|
44 | 44 | |
45 | - $callStartTime = microtime(true); |
|
46 | - $discriminantFormula = '=POWER('.$_POST['B'].',2) - (4 * '.$_POST['A'].' * '.$_POST['C'].')'; |
|
47 | - $discriminant = PHPExcel_Calculation::getInstance()->calculateFormula($discriminantFormula); |
|
45 | + $callStartTime = microtime(true); |
|
46 | + $discriminantFormula = '=POWER('.$_POST['B'].',2) - (4 * '.$_POST['A'].' * '.$_POST['C'].')'; |
|
47 | + $discriminant = PHPExcel_Calculation::getInstance()->calculateFormula($discriminantFormula); |
|
48 | 48 | |
49 | - $r1Formula = '=IMDIV(IMSUM(-'.$_POST['B'].',IMSQRT('.$discriminant.')),2 * '.$_POST['A'].')'; |
|
50 | - $r2Formula = '=IF('.$discriminant.'=0,"Only one root",IMDIV(IMSUB(-'.$_POST['B'].',IMSQRT('.$discriminant.')),2 * '.$_POST['A'].'))'; |
|
49 | + $r1Formula = '=IMDIV(IMSUM(-'.$_POST['B'].',IMSQRT('.$discriminant.')),2 * '.$_POST['A'].')'; |
|
50 | + $r2Formula = '=IF('.$discriminant.'=0,"Only one root",IMDIV(IMSUB(-'.$_POST['B'].',IMSQRT('.$discriminant.')),2 * '.$_POST['A'].'))'; |
|
51 | 51 | |
52 | - echo PHPExcel_Calculation::getInstance()->calculateFormula($r1Formula).'<br />'; |
|
53 | - echo PHPExcel_Calculation::getInstance()->calculateFormula($r2Formula).'<br />'; |
|
54 | - $callEndTime = microtime(true); |
|
55 | - $callTime = $callEndTime - $callStartTime; |
|
52 | + echo PHPExcel_Calculation::getInstance()->calculateFormula($r1Formula).'<br />'; |
|
53 | + echo PHPExcel_Calculation::getInstance()->calculateFormula($r2Formula).'<br />'; |
|
54 | + $callEndTime = microtime(true); |
|
55 | + $callTime = $callEndTime - $callStartTime; |
|
56 | 56 | |
57 | - echo '<hr />Call time for Quadratic Equation Solution was '.sprintf('%.4f',$callTime).' seconds<br /><hr />'; |
|
58 | - echo ' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB<br />'; |
|
59 | - } |
|
57 | + echo '<hr />Call time for Quadratic Equation Solution was '.sprintf('%.4f',$callTime).' seconds<br /><hr />'; |
|
58 | + echo ' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB<br />'; |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | ?> |