@@ -58,7 +58,7 @@ |
||
58 | 58 | $fileHandle = parent::prepareForSave($pFilename); |
59 | 59 | |
60 | 60 | // Default PDF paper size |
61 | - $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) |
|
61 | + $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) |
|
62 | 62 | |
63 | 63 | // Check for paper size and page orientation |
64 | 64 | if (is_null($this->getSheetIndex())) { |
@@ -58,7 +58,7 @@ |
||
58 | 58 | $fileHandle = parent::prepareForSave($pFilename); |
59 | 59 | |
60 | 60 | // Default PDF paper size |
61 | - $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) |
|
61 | + $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) |
|
62 | 62 | |
63 | 63 | // Check for paper size and page orientation |
64 | 64 | if (is_null($this->getSheetIndex())) { |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | |
40 | 40 | if (!file_exists("05featuredemo.xlsx")) { |
41 | - exit("Please run 05featuredemo.php first." . EOL); |
|
41 | + exit("Please run 05featuredemo.php first." . EOL); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | echo date('H:i:s') , " Load from Excel2007 file" , EOL; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ini_set('display_errors', TRUE); |
30 | 30 | ini_set('display_startup_errors', TRUE); |
31 | 31 | |
32 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
32 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
33 | 33 | |
34 | 34 | date_default_timezone_set('Europe/London'); |
35 | 35 | |
@@ -41,19 +41,19 @@ discard block |
||
41 | 41 | exit("Please run 05featuredemo.php first." . EOL); |
42 | 42 | } |
43 | 43 | |
44 | -echo date('H:i:s') , " Load from Excel2007 file" , EOL; |
|
44 | +echo date('H:i:s'), " Load from Excel2007 file", EOL; |
|
45 | 45 | $callStartTime = microtime(true); |
46 | 46 | |
47 | 47 | $objPHPExcel = \PHPExcel\IOFactory::load("05featuredemo.xlsx"); |
48 | 48 | |
49 | 49 | $callEndTime = microtime(true); |
50 | 50 | $callTime = $callEndTime - $callStartTime; |
51 | -echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
51 | +echo 'Call time to read Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
52 | 52 | // Echo memory usage |
53 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
53 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
54 | 54 | |
55 | 55 | |
56 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
56 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
57 | 57 | $callStartTime = microtime(true); |
58 | 58 | |
59 | 59 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | $callEndTime = microtime(true); |
63 | 63 | $callTime = $callEndTime - $callStartTime; |
64 | 64 | |
65 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
66 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
65 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
66 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
67 | 67 | // Echo memory usage |
68 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
68 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
69 | 69 | |
70 | 70 | |
71 | 71 | // Echo memory peak usage |
72 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
72 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
73 | 73 | |
74 | 74 | // Echo done |
75 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
76 | -echo 'File has been created in ' , getcwd() , EOL; |
|
75 | +echo date('H:i:s'), " Done writing file", EOL; |
|
76 | +echo 'File has been created in ', getcwd(), 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 | // 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,22 +76,22 @@ 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 |
|
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 | 92 | NULL, // plotDirection |
93 | - NULL, // smooth line |
|
94 | - \PHPExcel\Chart\DataSeries::STYLE_LINEMARKER // plotStyle |
|
93 | + NULL, // smooth line |
|
94 | + \PHPExcel\Chart\DataSeries::STYLE_LINEMARKER // plotStyle |
|
95 | 95 | ); |
96 | 96 | |
97 | 97 | // Set the series in the plot area |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | |
106 | 106 | // Create the chart |
107 | 107 | $chart = new \PHPExcel\Chart( |
108 | - 'chart1', // name |
|
109 | - $title, // title |
|
110 | - $legend, // legend |
|
111 | - $plotArea, // plotArea |
|
112 | - true, // plotVisibleOnly |
|
113 | - 0, // displayBlanksAs |
|
114 | - NULL, // xAxisLabel |
|
115 | - $yAxisLabel // yAxisLabel |
|
108 | + 'chart1', // name |
|
109 | + $title, // title |
|
110 | + $legend, // legend |
|
111 | + $plotArea, // plotArea |
|
112 | + true, // plotVisibleOnly |
|
113 | + 0, // displayBlanksAs |
|
114 | + NULL, // xAxisLabel |
|
115 | + $yAxisLabel // yAxisLabel |
|
116 | 116 | ); |
117 | 117 | |
118 | 118 | // Set the position where the chart should appear in the worksheet |
@@ -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 | |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | $objWorksheet = $objPHPExcel->getActiveSheet(); |
45 | 45 | $objWorksheet->fromArray( |
46 | 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), |
|
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 | 52 | ) |
53 | 53 | ); |
54 | 54 | |
@@ -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 |
@@ -83,14 +83,14 @@ discard block |
||
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, // plotDirection |
|
93 | - NULL, // smooth line |
|
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, // plotDirection |
|
93 | + NULL, // smooth line |
|
94 | 94 | \PHPExcel\Chart\DataSeries::STYLE_LINEMARKER // plotStyle |
95 | 95 | ); |
96 | 96 | |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | |
106 | 106 | // Create the chart |
107 | 107 | $chart = new \PHPExcel\Chart( |
108 | - 'chart1', // name |
|
109 | - $title, // title |
|
110 | - $legend, // legend |
|
111 | - $plotArea, // plotArea |
|
112 | - true, // plotVisibleOnly |
|
113 | - 0, // displayBlanksAs |
|
114 | - NULL, // xAxisLabel |
|
108 | + 'chart1', // name |
|
109 | + $title, // title |
|
110 | + $legend, // legend |
|
111 | + $plotArea, // plotArea |
|
112 | + true, // plotVisibleOnly |
|
113 | + 0, // displayBlanksAs |
|
114 | + NULL, // xAxisLabel |
|
115 | 115 | $yAxisLabel // yAxisLabel |
116 | 116 | ); |
117 | 117 | |
@@ -124,16 +124,16 @@ discard block |
||
124 | 124 | |
125 | 125 | |
126 | 126 | // Save Excel 2007 file |
127 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
127 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
128 | 128 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
129 | 129 | $objWriter->setIncludeCharts(TRUE); |
130 | 130 | $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); |
131 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
131 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
132 | 132 | |
133 | 133 | |
134 | 134 | // Echo memory peak usage |
135 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
135 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
136 | 136 | |
137 | 137 | // Echo done |
138 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
139 | -echo 'File has been created in ' , getcwd() , EOL; |
|
138 | +echo date('H:i:s'), " Done writing file", EOL; |
|
139 | +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; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | date_default_timezone_set('Europe/London'); |
33 | 33 | |
34 | 34 | if (PHP_SAPI == 'cli') |
35 | - die('This example should only be run from a Web Browser'); |
|
35 | + die('This example should only be run from a Web Browser'); |
|
36 | 36 | |
37 | 37 | /** Include PHPExcel */ |
38 | 38 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | |
44 | 44 | // Set document properties |
45 | 45 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
46 | - ->setLastModifiedBy("Maarten Balliauw") |
|
47 | - ->setTitle("Office 2007 XLSX Test Document") |
|
48 | - ->setSubject("Office 2007 XLSX Test Document") |
|
49 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
50 | - ->setKeywords("office 2007 openxml php") |
|
51 | - ->setCategory("Test result file"); |
|
46 | + ->setLastModifiedBy("Maarten Balliauw") |
|
47 | + ->setTitle("Office 2007 XLSX Test Document") |
|
48 | + ->setSubject("Office 2007 XLSX Test Document") |
|
49 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
50 | + ->setKeywords("office 2007 openxml php") |
|
51 | + ->setCategory("Test result file"); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | // Add some data |
@@ -79,10 +79,10 @@ |
||
79 | 79 | header('Cache-Control: max-age=1'); |
80 | 80 | |
81 | 81 | // If you're serving to IE over SSL, then the following may be needed |
82 | -header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past |
|
83 | -header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified |
|
84 | -header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 |
|
85 | -header ('Pragma: public'); // HTTP/1.0 |
|
82 | +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past |
|
83 | +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified |
|
84 | +header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 |
|
85 | +header('Pragma: public'); // HTTP/1.0 |
|
86 | 86 | |
87 | 87 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
88 | 88 | $objWriter->save('php://output'); |
@@ -31,8 +31,9 @@ |
||
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | date_default_timezone_set('Europe/London'); |
33 | 33 | |
34 | -if (PHP_SAPI == 'cli') |
|
34 | +if (PHP_SAPI == 'cli') { |
|
35 | 35 | die('This example should only be run from a Web Browser'); |
36 | +} |
|
36 | 37 | |
37 | 38 | /** Include PHPExcel */ |
38 | 39 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | // Set document properties |
53 | 53 | echo date('H:i:s') , " Set properties" , EOL; |
54 | 54 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
55 | - ->setLastModifiedBy("Maarten Balliauw") |
|
56 | - ->setTitle("Office 2007 XLSX Test Document") |
|
57 | - ->setSubject("Office 2007 XLSX Test Document") |
|
58 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
59 | - ->setKeywords("office 2007 openxml php") |
|
60 | - ->setCategory("Test result file"); |
|
55 | + ->setLastModifiedBy("Maarten Balliauw") |
|
56 | + ->setTitle("Office 2007 XLSX Test Document") |
|
57 | + ->setSubject("Office 2007 XLSX Test Document") |
|
58 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
59 | + ->setKeywords("office 2007 openxml php") |
|
60 | + ->setCategory("Test result file"); |
|
61 | 61 | |
62 | 62 | |
63 | 63 | // Create a first sheet |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | // Set outline levels |
80 | 80 | echo date('H:i:s') , " Set outline levels" , EOL; |
81 | 81 | $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1) |
82 | - ->setVisible(false) |
|
83 | - ->setCollapsed(true); |
|
82 | + ->setVisible(false) |
|
83 | + ->setCollapsed(true); |
|
84 | 84 | |
85 | 85 | // Freeze panes |
86 | 86 | echo date('H:i:s') , " Freeze panes" , EOL; |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | |
95 | 95 | // Add data |
96 | 96 | for ($i = 2; $i <= 5000; $i++) { |
97 | - $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i") |
|
98 | - ->setCellValue('B' . $i, "LName $i") |
|
99 | - ->setCellValue('C' . $i, "PhoneNo $i") |
|
100 | - ->setCellValue('D' . $i, "FaxNo $i") |
|
101 | - ->setCellValue('E' . $i, true); |
|
97 | + $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i") |
|
98 | + ->setCellValue('B' . $i, "LName $i") |
|
99 | + ->setCellValue('C' . $i, "PhoneNo $i") |
|
100 | + ->setCellValue('D' . $i, "FaxNo $i") |
|
101 | + ->setCellValue('E' . $i, true); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 |
@@ -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,18 +39,18 @@ discard block |
||
39 | 39 | |
40 | 40 | $cacheMethod = \PHPExcel\CachedObjectStorageFactory::CACHE_TO_SQLITE; |
41 | 41 | if (\PHPExcel\Settings::setCacheStorageMethod($cacheMethod)) { |
42 | - echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL; |
|
42 | + echo date('H:i:s'), " Enable Cell Caching using ", $cacheMethod, " method", EOL; |
|
43 | 43 | } else { |
44 | - echo date('H:i:s') , " Unable to set Cell Caching using " , $cacheMethod , " method, reverting to memory" , EOL; |
|
44 | + echo date('H:i:s'), " Unable to set Cell Caching using ", $cacheMethod, " method, reverting to memory", EOL; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | // Create new PHPExcel object |
49 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
49 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
50 | 50 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
51 | 51 | |
52 | 52 | // Set document properties |
53 | -echo date('H:i:s') , " Set properties" , EOL; |
|
53 | +echo date('H:i:s'), " Set properties", EOL; |
|
54 | 54 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
55 | 55 | ->setLastModifiedBy("Maarten Balliauw") |
56 | 56 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | |
63 | 63 | // Create a first sheet |
64 | -echo date('H:i:s') , " Add data" , EOL; |
|
64 | +echo date('H:i:s'), " Add data", EOL; |
|
65 | 65 | $objPHPExcel->setActiveSheetIndex(0); |
66 | 66 | $objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname"); |
67 | 67 | $objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname"); |
@@ -71,24 +71,24 @@ discard block |
||
71 | 71 | |
72 | 72 | |
73 | 73 | // Hide "Phone" and "fax" column |
74 | -echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL; |
|
74 | +echo date('H:i:s'), " Hide 'Phone' and 'fax' columns", EOL; |
|
75 | 75 | $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false); |
76 | 76 | $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false); |
77 | 77 | |
78 | 78 | |
79 | 79 | // Set outline levels |
80 | -echo date('H:i:s') , " Set outline levels" , EOL; |
|
80 | +echo date('H:i:s'), " Set outline levels", EOL; |
|
81 | 81 | $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1) |
82 | 82 | ->setVisible(false) |
83 | 83 | ->setCollapsed(true); |
84 | 84 | |
85 | 85 | // Freeze panes |
86 | -echo date('H:i:s') , " Freeze panes" , EOL; |
|
86 | +echo date('H:i:s'), " Freeze panes", EOL; |
|
87 | 87 | $objPHPExcel->getActiveSheet()->freezePane('A2'); |
88 | 88 | |
89 | 89 | |
90 | 90 | // Rows to repeat at top |
91 | -echo date('H:i:s') , " Rows to repeat at top" , EOL; |
|
91 | +echo date('H:i:s'), " Rows to repeat at top", EOL; |
|
92 | 92 | $objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1); |
93 | 93 | |
94 | 94 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | |
109 | 109 | // Save Excel 2007 file |
110 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
110 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
111 | 111 | $callStartTime = microtime(true); |
112 | 112 | |
113 | 113 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | $callEndTime = microtime(true); |
116 | 116 | $callTime = $callEndTime - $callStartTime; |
117 | 117 | |
118 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
119 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
118 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
119 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
120 | 120 | // Echo memory usage |
121 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
121 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
122 | 122 | |
123 | 123 | |
124 | 124 | // Echo memory peak usage |
125 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
125 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
126 | 126 | |
127 | 127 | // Echo done |
128 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
129 | -echo 'File has been created in ' , getcwd() , EOL; |
|
128 | +echo date('H:i:s'), " Done writing file", EOL; |
|
129 | +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 |
@@ -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 | |
58 | 58 | $html1 = '<font color="#0000ff"> |
59 | 59 | <h1 align="center">My very first example of rich text<br />generated from html markup</h1> |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | |
126 | 126 | // Rename worksheet |
127 | -echo date('H:i:s') , " Rename worksheet" , EOL; |
|
127 | +echo date('H:i:s'), " Rename worksheet", EOL; |
|
128 | 128 | $objPHPExcel->getActiveSheet() |
129 | 129 | ->setTitle('Rich Text Examples'); |
130 | 130 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | |
136 | 136 | // Save Excel 2007 file |
137 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
137 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
138 | 138 | $callStartTime = microtime(true); |
139 | 139 | |
140 | 140 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | $callEndTime = microtime(true); |
143 | 143 | $callTime = $callEndTime - $callStartTime; |
144 | 144 | |
145 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
146 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
145 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
146 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
147 | 147 | // Echo memory usage |
148 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
148 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
149 | 149 | |
150 | 150 | |
151 | 151 | // Save Excel 95 file |
152 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
152 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
153 | 153 | $callStartTime = microtime(true); |
154 | 154 | |
155 | 155 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | $callEndTime = microtime(true); |
158 | 158 | $callTime = $callEndTime - $callStartTime; |
159 | 159 | |
160 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
161 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
160 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
161 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
162 | 162 | // Echo memory usage |
163 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
163 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
164 | 164 | |
165 | 165 | |
166 | 166 | // Echo memory peak usage |
167 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
167 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
168 | 168 | |
169 | 169 | // Echo done |
170 | -echo date('H:i:s') , " Done writing files" , EOL; |
|
171 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
170 | +echo date('H:i:s'), " Done writing files", EOL; |
|
171 | +echo 'Files have been created in ', getcwd(), EOL; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | date_default_timezone_set('Europe/London'); |
33 | 33 | |
34 | 34 | if (PHP_SAPI == 'cli') |
35 | - die('This example should only be run from a Web Browser'); |
|
35 | + die('This example should only be run from a Web Browser'); |
|
36 | 36 | |
37 | 37 | /** Include PHPExcel */ |
38 | 38 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | |
44 | 44 | // Set document properties |
45 | 45 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
46 | - ->setLastModifiedBy("Maarten Balliauw") |
|
47 | - ->setTitle("Office 2007 XLSX Test Document") |
|
48 | - ->setSubject("Office 2007 XLSX Test Document") |
|
49 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
50 | - ->setKeywords("office 2007 openxml php") |
|
51 | - ->setCategory("Test result file"); |
|
46 | + ->setLastModifiedBy("Maarten Balliauw") |
|
47 | + ->setTitle("Office 2007 XLSX Test Document") |
|
48 | + ->setSubject("Office 2007 XLSX Test Document") |
|
49 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
50 | + ->setKeywords("office 2007 openxml php") |
|
51 | + ->setCategory("Test result file"); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | // Add some data |
@@ -79,10 +79,10 @@ |
||
79 | 79 | header('Cache-Control: max-age=1'); |
80 | 80 | |
81 | 81 | // If you're serving to IE over SSL, then the following may be needed |
82 | -header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past |
|
83 | -header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified |
|
84 | -header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 |
|
85 | -header ('Pragma: public'); // HTTP/1.0 |
|
82 | +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past |
|
83 | +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified |
|
84 | +header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 |
|
85 | +header('Pragma: public'); // HTTP/1.0 |
|
86 | 86 | |
87 | 87 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
88 | 88 | $objWriter->save('php://output'); |
@@ -31,8 +31,9 @@ |
||
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | date_default_timezone_set('Europe/London'); |
33 | 33 | |
34 | -if (PHP_SAPI == 'cli') |
|
34 | +if (PHP_SAPI == 'cli') { |
|
35 | 35 | die('This example should only be run from a Web Browser'); |
36 | +} |
|
36 | 37 | |
37 | 38 | /** Include PHPExcel */ |
38 | 39 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |