@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | // Add some data, we will use some formulas here |
47 | 47 | echo date('H:i:s') , " Add some data and formulas" , EOL; |
48 | 48 | $objPHPExcel->getActiveSheet()->setCellValue('A1', '=B1') |
49 | - ->setCellValue('A2', '=B2+1') |
|
50 | - ->setCellValue('B1', '=A1+1') |
|
51 | - ->setCellValue('B2', '=A2'); |
|
49 | + ->setCellValue('A2', '=B2+1') |
|
50 | + ->setCellValue('B1', '=A1+1') |
|
51 | + ->setCellValue('B2', '=A2'); |
|
52 | 52 | |
53 | 53 | \PHPExcel\Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 100; |
54 | 54 | |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | for($row = 1; $row <= 2; ++$row) { |
58 | 58 | for ($col = 'A'; $col != 'C'; ++$col) { |
59 | 59 | if ((!is_null($formula = $objPHPExcel->getActiveSheet()->getCell($col.$row)->getValue())) && |
60 | - ($formula[0] == '=')) { |
|
60 | + ($formula[0] == '=')) { |
|
61 | 61 | echo 'Value of ' , $col , $row , ' [' , $formula , ']: ' , |
62 | - $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() . EOL; |
|
62 | + $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() . EOL; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |
@@ -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 |
@@ -29,104 +29,104 @@ |
||
29 | 29 | error_reporting(E_ALL); |
30 | 30 | |
31 | 31 | if (PHP_SAPI != 'cli') { |
32 | - die ('This script executes all tests, and should only be run from the command line'); |
|
32 | + die ('This script executes all tests, and should only be run from the command line'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // List of tests |
36 | 36 | $aTests = array( |
37 | - '01simple.php' |
|
38 | - , '01simplePCLZip.php' |
|
39 | - , '02types.php' |
|
40 | - , '02types-xls.php' |
|
41 | - , '03formulas.php' |
|
42 | - , '04printing.php' |
|
43 | - , '05featuredemo.php' |
|
44 | - , '06largescale.php' |
|
45 | - , '06largescale-with-cellcaching.php' |
|
46 | - , '06largescale-with-cellcaching-sqlite.php' |
|
47 | - , '06largescale-with-cellcaching-sqlite3.php' |
|
48 | - , '06largescale-xls.php' |
|
49 | - , '07reader.php' |
|
50 | - , '07readerPCLZip.php' |
|
51 | - , '08conditionalformatting.php' |
|
52 | - , '08conditionalformatting2.php' |
|
53 | - , '09pagebreaks.php' |
|
54 | - , '10autofilter.php' |
|
55 | - , '10autofilter-selection-1.php' |
|
56 | - , '10autofilter-selection-2.php' |
|
57 | - , '10autofilter-selection-display.php' |
|
58 | - , '11documentsecurity.php' |
|
59 | - , '11documentsecurity-xls.php' |
|
60 | - , '12cellProtection.php' |
|
61 | - , '13calculation.php' |
|
37 | + '01simple.php' |
|
38 | + , '01simplePCLZip.php' |
|
39 | + , '02types.php' |
|
40 | + , '02types-xls.php' |
|
41 | + , '03formulas.php' |
|
42 | + , '04printing.php' |
|
43 | + , '05featuredemo.php' |
|
44 | + , '06largescale.php' |
|
45 | + , '06largescale-with-cellcaching.php' |
|
46 | + , '06largescale-with-cellcaching-sqlite.php' |
|
47 | + , '06largescale-with-cellcaching-sqlite3.php' |
|
48 | + , '06largescale-xls.php' |
|
49 | + , '07reader.php' |
|
50 | + , '07readerPCLZip.php' |
|
51 | + , '08conditionalformatting.php' |
|
52 | + , '08conditionalformatting2.php' |
|
53 | + , '09pagebreaks.php' |
|
54 | + , '10autofilter.php' |
|
55 | + , '10autofilter-selection-1.php' |
|
56 | + , '10autofilter-selection-2.php' |
|
57 | + , '10autofilter-selection-display.php' |
|
58 | + , '11documentsecurity.php' |
|
59 | + , '11documentsecurity-xls.php' |
|
60 | + , '12cellProtection.php' |
|
61 | + , '13calculation.php' |
|
62 | 62 | , '13calculationCyclicFormulae.php' |
63 | - , '14excel5.php' |
|
64 | - , '15datavalidation.php' |
|
65 | - , '15datavalidation-xls.php' |
|
66 | - , '16csv.php' |
|
67 | - , '17html.php' |
|
68 | - , '18extendedcalculation.php' |
|
69 | - , '19namedrange.php' |
|
70 | - , '20readexcel5.php' |
|
71 | - , '21pdf.php' |
|
72 | - , '22heavilyformatted.php' |
|
73 | - , '23sharedstyles.php' |
|
74 | - , '24readfilter.php' |
|
75 | - , '25inmemoryimage.php' |
|
76 | - , '26utf8.php' |
|
77 | - , '27imagesexcel5.php' |
|
78 | - , '28iterator.php' |
|
79 | - , '29advancedvaluebinder.php' |
|
80 | - , '30template.php' |
|
81 | - , '31docproperties_write.php' |
|
82 | - , '31docproperties_write-xls.php' |
|
83 | - , '32chartreadwrite.php' |
|
84 | - , '33chartcreate-area.php' |
|
85 | - , '33chartcreate-bar.php' |
|
86 | - , '33chartcreate-bar-stacked.php' |
|
87 | - , '33chartcreate-column.php' |
|
88 | - , '33chartcreate-column-2.php' |
|
89 | - , '33chartcreate-line.php' |
|
90 | - , '33chartcreate-pie.php' |
|
91 | - , '33chartcreate-radar.php' |
|
92 | - , '33chartcreate-stock.php' |
|
93 | - , '33chartcreate-multiple-charts.php' |
|
94 | - , '33chartcreate-composite.php' |
|
95 | - , '34chartupdate.php' |
|
96 | - , '35chartrender.php' |
|
97 | - , '36chartreadwriteHTML.php' |
|
98 | - , '36chartreadwritePDF.php' |
|
99 | - , '37page_layout_view.php' |
|
100 | - , '38cloneWorksheet.php' |
|
63 | + , '14excel5.php' |
|
64 | + , '15datavalidation.php' |
|
65 | + , '15datavalidation-xls.php' |
|
66 | + , '16csv.php' |
|
67 | + , '17html.php' |
|
68 | + , '18extendedcalculation.php' |
|
69 | + , '19namedrange.php' |
|
70 | + , '20readexcel5.php' |
|
71 | + , '21pdf.php' |
|
72 | + , '22heavilyformatted.php' |
|
73 | + , '23sharedstyles.php' |
|
74 | + , '24readfilter.php' |
|
75 | + , '25inmemoryimage.php' |
|
76 | + , '26utf8.php' |
|
77 | + , '27imagesexcel5.php' |
|
78 | + , '28iterator.php' |
|
79 | + , '29advancedvaluebinder.php' |
|
80 | + , '30template.php' |
|
81 | + , '31docproperties_write.php' |
|
82 | + , '31docproperties_write-xls.php' |
|
83 | + , '32chartreadwrite.php' |
|
84 | + , '33chartcreate-area.php' |
|
85 | + , '33chartcreate-bar.php' |
|
86 | + , '33chartcreate-bar-stacked.php' |
|
87 | + , '33chartcreate-column.php' |
|
88 | + , '33chartcreate-column-2.php' |
|
89 | + , '33chartcreate-line.php' |
|
90 | + , '33chartcreate-pie.php' |
|
91 | + , '33chartcreate-radar.php' |
|
92 | + , '33chartcreate-stock.php' |
|
93 | + , '33chartcreate-multiple-charts.php' |
|
94 | + , '33chartcreate-composite.php' |
|
95 | + , '34chartupdate.php' |
|
96 | + , '35chartrender.php' |
|
97 | + , '36chartreadwriteHTML.php' |
|
98 | + , '36chartreadwritePDF.php' |
|
99 | + , '37page_layout_view.php' |
|
100 | + , '38cloneWorksheet.php' |
|
101 | 101 | , '39dropdown.php' |
102 | - , '40duplicateStyle.php' |
|
103 | - , '41password.php' |
|
104 | - , '42richText.php' |
|
102 | + , '40duplicateStyle.php' |
|
103 | + , '41password.php' |
|
104 | + , '42richText.php' |
|
105 | 105 | , '43mergeWorkbooks.php' |
106 | 106 | , '44worksheetInfo.php' |
107 | - , 'OOCalcReader.php' |
|
108 | - , 'OOCalcReaderPCLZip.php' |
|
109 | - , 'SylkReader.php' |
|
110 | - , 'Excel2003XMLReader.php' |
|
111 | - , 'XMLReader.php' |
|
112 | - , 'GnumericReader.php' |
|
107 | + , 'OOCalcReader.php' |
|
108 | + , 'OOCalcReaderPCLZip.php' |
|
109 | + , 'SylkReader.php' |
|
110 | + , 'Excel2003XMLReader.php' |
|
111 | + , 'XMLReader.php' |
|
112 | + , 'GnumericReader.php' |
|
113 | 113 | ); |
114 | 114 | |
115 | 115 | // First, clear all previous run results |
116 | 116 | foreach ($aTests as $sTest) { |
117 | - @unlink( str_replace('.php', '.xls', $sTest) ); |
|
118 | - @unlink( str_replace('.php', '.xlsx', $sTest) ); |
|
119 | - @unlink( str_replace('.php', '.csv', $sTest) ); |
|
120 | - @unlink( str_replace('.php', '.htm', $sTest) ); |
|
121 | - @unlink( str_replace('.php', '.pdf', $sTest) ); |
|
117 | + @unlink( str_replace('.php', '.xls', $sTest) ); |
|
118 | + @unlink( str_replace('.php', '.xlsx', $sTest) ); |
|
119 | + @unlink( str_replace('.php', '.csv', $sTest) ); |
|
120 | + @unlink( str_replace('.php', '.htm', $sTest) ); |
|
121 | + @unlink( str_replace('.php', '.pdf', $sTest) ); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // Run all tests |
125 | 125 | foreach ($aTests as $sTest) { |
126 | - echo '============== TEST ==============' . "\r\n"; |
|
127 | - echo 'Test name: ' . $sTest . "\r\n"; |
|
128 | - echo "\r\n"; |
|
129 | - echo shell_exec('php ' . $sTest); |
|
130 | - echo "\r\n"; |
|
131 | - echo "\r\n"; |
|
126 | + echo '============== TEST ==============' . "\r\n"; |
|
127 | + echo 'Test name: ' . $sTest . "\r\n"; |
|
128 | + echo "\r\n"; |
|
129 | + echo shell_exec('php ' . $sTest); |
|
130 | + echo "\r\n"; |
|
131 | + echo "\r\n"; |
|
132 | 132 | } |
133 | 133 | \ No newline at end of file |
@@ -43,21 +43,21 @@ discard block |
||
43 | 43 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
44 | 44 | $objWorksheet = $objPHPExcel->getActiveSheet(); |
45 | 45 | $objWorksheet->fromArray( |
46 | - array( |
|
47 | - array('', '', 'Budget', 'Forecast', 'Actual'), |
|
48 | - array('2010', 'Q1', 47, 44, 43 ), |
|
49 | - array('', 'Q2', 56, 53, 50 ), |
|
50 | - array('', 'Q3', 52, 46, 45 ), |
|
51 | - array('', 'Q4', 45, 40, 40 ), |
|
52 | - array('2011', 'Q1', 51, 42, 46 ), |
|
53 | - array('', 'Q2', 53, 58, 56 ), |
|
54 | - array('', 'Q3', 64, 66, 69 ), |
|
55 | - array('', 'Q4', 54, 55, 56 ), |
|
56 | - array('2012', 'Q1', 49, 52, 58 ), |
|
57 | - array('', 'Q2', 68, 73, 86 ), |
|
58 | - array('', 'Q3', 72, 78, 0 ), |
|
59 | - array('', 'Q4', 50, 60, 0 ), |
|
60 | - ) |
|
46 | + array( |
|
47 | + array('', '', 'Budget', 'Forecast', 'Actual'), |
|
48 | + array('2010', 'Q1', 47, 44, 43 ), |
|
49 | + array('', 'Q2', 56, 53, 50 ), |
|
50 | + array('', 'Q3', 52, 46, 45 ), |
|
51 | + array('', 'Q4', 45, 40, 40 ), |
|
52 | + array('2011', 'Q1', 51, 42, 46 ), |
|
53 | + array('', 'Q2', 53, 58, 56 ), |
|
54 | + array('', 'Q3', 64, 66, 69 ), |
|
55 | + array('', 'Q4', 54, 55, 56 ), |
|
56 | + array('2012', 'Q1', 49, 52, 58 ), |
|
57 | + array('', 'Q2', 68, 73, 86 ), |
|
58 | + array('', 'Q3', 72, 78, 0 ), |
|
59 | + array('', 'Q4', 50, 60, 0 ), |
|
60 | + ) |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | // Set the Labels for each data series we want to plot |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | // Data values |
69 | 69 | // Data Marker |
70 | 70 | $dataSeriesLabels = array( |
71 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 'Budget' |
|
72 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 'Forecast' |
|
73 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$E$1', NULL, 1), // 'Actual' |
|
71 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 'Budget' |
|
72 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 'Forecast' |
|
73 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$E$1', NULL, 1), // 'Actual' |
|
74 | 74 | ); |
75 | 75 | // Set the X-Axis Labels |
76 | 76 | // Datatype |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | // Data values |
81 | 81 | // Data Marker |
82 | 82 | $xAxisTickValues = array( |
83 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$B$13', NULL, 12), // Q1 to Q4 for 2010 to 2012 |
|
83 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$B$13', NULL, 12), // Q1 to Q4 for 2010 to 2012 |
|
84 | 84 | ); |
85 | 85 | // Set the Data values for each data series we want to plot |
86 | 86 | // Datatype |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | // Data values |
91 | 91 | // Data Marker |
92 | 92 | $dataSeriesValues = array( |
93 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12), |
|
94 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12), |
|
95 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$13', NULL, 12), |
|
93 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12), |
|
94 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12), |
|
95 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$13', NULL, 12), |
|
96 | 96 | ); |
97 | 97 | |
98 | 98 | // Build the dataseries |
99 | 99 | $series = new \PHPExcel\Chart\DataSeries( |
100 | - \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType |
|
101 | - \PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping |
|
102 | - range(0, count($dataSeriesValues)-1), // plotOrder |
|
103 | - $dataSeriesLabels, // plotLabel |
|
104 | - $xAxisTickValues, // plotCategory |
|
105 | - $dataSeriesValues // plotValues |
|
100 | + \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType |
|
101 | + \PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping |
|
102 | + range(0, count($dataSeriesValues)-1), // plotOrder |
|
103 | + $dataSeriesLabels, // plotLabel |
|
104 | + $xAxisTickValues, // plotCategory |
|
105 | + $dataSeriesValues // plotValues |
|
106 | 106 | ); |
107 | 107 | // Set additional dataseries parameters |
108 | 108 | // Make it a vertical column rather than a horizontal bar graph |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | |
121 | 121 | // Create the chart |
122 | 122 | $chart = new \PHPExcel\Chart( |
123 | - 'chart1', // name |
|
124 | - $title, // title |
|
125 | - $legend, // legend |
|
126 | - $plotArea, // plotArea |
|
127 | - true, // plotVisibleOnly |
|
128 | - 0, // displayBlanksAs |
|
129 | - $xAxisLabel, // xAxisLabel |
|
130 | - $yAxisLabel // yAxisLabel |
|
123 | + 'chart1', // name |
|
124 | + $title, // title |
|
125 | + $legend, // legend |
|
126 | + $plotArea, // plotArea |
|
127 | + true, // plotVisibleOnly |
|
128 | + 0, // displayBlanksAs |
|
129 | + $xAxisLabel, // xAxisLabel |
|
130 | + $yAxisLabel // yAxisLabel |
|
131 | 131 | ); |
132 | 132 | |
133 | 133 | // Set the position where the chart should appear in the worksheet |
@@ -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 | // Set the Labels for each data series we want to plot |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | // Data values |
61 | 61 | // Data Marker |
62 | 62 | $dataSeriesLabels = array( |
63 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 |
|
64 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 |
|
65 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 |
|
63 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 |
|
64 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 |
|
65 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 |
|
66 | 66 | ); |
67 | 67 | // Set the X-Axis Labels |
68 | 68 | $xAxisTickValues = array( |
69 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
69 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
70 | 70 | ); |
71 | 71 | // Set the Data values for each data series we want to plot |
72 | 72 | // Datatype |
@@ -76,21 +76,21 @@ discard block |
||
76 | 76 | // Data values |
77 | 77 | // Data Marker |
78 | 78 | $dataSeriesValues = array( |
79 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), |
|
80 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), |
|
81 | - new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), |
|
79 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), |
|
80 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), |
|
81 | + new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4), |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | // Build the dataseries |
85 | 85 | $series = new \PHPExcel\Chart\DataSeries( |
86 | - \PHPExcel\Chart\DataSeries::TYPE_SCATTERCHART, // plotType |
|
87 | - NULL, // plotGrouping (Scatter charts don't have any grouping) |
|
88 | - range(0, count($dataSeriesValues)-1), // plotOrder |
|
89 | - $dataSeriesLabels, // plotLabel |
|
90 | - $xAxisTickValues, // plotCategory |
|
91 | - $dataSeriesValues, // plotValues |
|
92 | - NULL, // smooth line |
|
93 | - \PHPExcel\Chart\DataSeries::STYLE_LINEMARKER // plotStyle |
|
86 | + \PHPExcel\Chart\DataSeries::TYPE_SCATTERCHART, // plotType |
|
87 | + NULL, // plotGrouping (Scatter charts don't have any grouping) |
|
88 | + range(0, count($dataSeriesValues)-1), // plotOrder |
|
89 | + $dataSeriesLabels, // plotLabel |
|
90 | + $xAxisTickValues, // plotCategory |
|
91 | + $dataSeriesValues, // plotValues |
|
92 | + NULL, // smooth line |
|
93 | + \PHPExcel\Chart\DataSeries::STYLE_LINEMARKER // plotStyle |
|
94 | 94 | ); |
95 | 95 | |
96 | 96 | // Set the series in the plot area |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | |
105 | 105 | // Create the chart |
106 | 106 | $chart = new \PHPExcel\Chart( |
107 | - 'chart1', // name |
|
108 | - $title, // title |
|
109 | - $legend, // legend |
|
110 | - $plotArea, // plotArea |
|
111 | - true, // plotVisibleOnly |
|
112 | - 0, // displayBlanksAs |
|
113 | - NULL, // xAxisLabel |
|
114 | - $yAxisLabel // yAxisLabel |
|
107 | + 'chart1', // name |
|
108 | + $title, // title |
|
109 | + $legend, // legend |
|
110 | + $plotArea, // plotArea |
|
111 | + true, // plotVisibleOnly |
|
112 | + 0, // displayBlanksAs |
|
113 | + NULL, // xAxisLabel |
|
114 | + $yAxisLabel // yAxisLabel |
|
115 | 115 | ); |
116 | 116 | |
117 | 117 | // Set the position where the chart should appear in the worksheet |
@@ -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 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
38 | 38 | |
39 | 39 | if (!file_exists("05featuredemo.xlsx")) { |
40 | - exit("Please run 05featuredemo.php first." . EOL); |
|
40 | + exit("Please run 05featuredemo.php first." . EOL); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $inputFileName = "05featuredemo.xlsx"; |
@@ -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 |
@@ -45,19 +45,19 @@ |
||
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, 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 | - $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, $i); |
|
60 | - $objPHPExcel->getActiveSheet()->setCellValue('B' . $i, 'Test value'); |
|
59 | + $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, $i); |
|
60 | + $objPHPExcel->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. |