@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | |
34 | 34 | |
35 | 35 | // Create new PHPExcel object |
36 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
36 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
37 | 37 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
38 | 38 | |
39 | 39 | // Set document properties |
40 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
40 | +echo date('H:i:s'), " Set document properties", EOL; |
|
41 | 41 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
42 | 42 | ->setLastModifiedBy("Maarten Balliauw") |
43 | 43 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | |
49 | 49 | |
50 | 50 | // Create a first sheet, representing sales data |
51 | -echo date('H:i:s') , " Add some data" , EOL; |
|
51 | +echo date('H:i:s'), " Add some data", EOL; |
|
52 | 52 | $objPHPExcel->setActiveSheetIndex(0); |
53 | 53 | $objPHPExcel->getActiveSheet()->setCellValue('B1', 'Invoice'); |
54 | -$objPHPExcel->getActiveSheet()->setCellValue('D1', \PHPExcel\Shared\Date::PHPToExcel( gmmktime(0,0,0,date('m'),date('d'),date('Y')) )); |
|
54 | +$objPHPExcel->getActiveSheet()->setCellValue('D1', \PHPExcel\Shared\Date::PHPToExcel(gmmktime(0, 0, 0, date('m'), date('d'), date('Y')))); |
|
55 | 55 | $objPHPExcel->getActiveSheet()->getStyle('D1')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX15); |
56 | 56 | $objPHPExcel->getActiveSheet()->setCellValue('E1', '#12566'); |
57 | 57 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $objPHPExcel->getActiveSheet()->setCellValue('E13', '=E11+E12'); |
89 | 89 | |
90 | 90 | // Add comment |
91 | -echo date('H:i:s') , " Add comments" , EOL; |
|
91 | +echo date('H:i:s'), " Add comments", EOL; |
|
92 | 92 | |
93 | 93 | $objPHPExcel->getActiveSheet()->getComment('E11')->setAuthor('PHPExcel'); |
94 | 94 | $objCommentRichText = $objPHPExcel->getActiveSheet()->getComment('E11')->getText()->createTextRun('PHPExcel:'); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | |
116 | 116 | // Add rich-text string |
117 | -echo date('H:i:s') , " Add rich-text string" , EOL; |
|
117 | +echo date('H:i:s'), " Add rich-text string", EOL; |
|
118 | 118 | $objRichText = new \PHPExcel\RichText(); |
119 | 119 | $objRichText->createText('This invoice is '); |
120 | 120 | |
@@ -128,28 +128,28 @@ discard block |
||
128 | 128 | $objPHPExcel->getActiveSheet()->getCell('A18')->setValue($objRichText); |
129 | 129 | |
130 | 130 | // Merge cells |
131 | -echo date('H:i:s') , " Merge cells" , EOL; |
|
131 | +echo date('H:i:s'), " Merge cells", EOL; |
|
132 | 132 | $objPHPExcel->getActiveSheet()->mergeCells('A18:E22'); |
133 | -$objPHPExcel->getActiveSheet()->mergeCells('A28:B28'); // Just to test... |
|
134 | -$objPHPExcel->getActiveSheet()->unmergeCells('A28:B28'); // Just to test... |
|
133 | +$objPHPExcel->getActiveSheet()->mergeCells('A28:B28'); // Just to test... |
|
134 | +$objPHPExcel->getActiveSheet()->unmergeCells('A28:B28'); // Just to test... |
|
135 | 135 | |
136 | 136 | // Protect cells |
137 | -echo date('H:i:s') , " Protect cells" , EOL; |
|
138 | -$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); // Needs to be set to true in order to enable any worksheet protection! |
|
137 | +echo date('H:i:s'), " Protect cells", EOL; |
|
138 | +$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); // Needs to be set to true in order to enable any worksheet protection! |
|
139 | 139 | $objPHPExcel->getActiveSheet()->protectCells('A3:E13', 'PHPExcel'); |
140 | 140 | |
141 | 141 | // Set cell number formats |
142 | -echo date('H:i:s') , " Set cell number formats" , EOL; |
|
142 | +echo date('H:i:s'), " Set cell number formats", EOL; |
|
143 | 143 | $objPHPExcel->getActiveSheet()->getStyle('E4:E13')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); |
144 | 144 | |
145 | 145 | // Set column widths |
146 | -echo date('H:i:s') , " Set column widths" , EOL; |
|
146 | +echo date('H:i:s'), " Set column widths", EOL; |
|
147 | 147 | $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true); |
148 | 148 | $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(12); |
149 | 149 | $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(12); |
150 | 150 | |
151 | 151 | // Set fonts |
152 | -echo date('H:i:s') , " Set fonts" , EOL; |
|
152 | +echo date('H:i:s'), " Set fonts", EOL; |
|
153 | 153 | $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setName('Candara'); |
154 | 154 | $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setSize(20); |
155 | 155 | $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $objPHPExcel->getActiveSheet()->getStyle('E13')->getFont()->setBold(true); |
164 | 164 | |
165 | 165 | // Set alignments |
166 | -echo date('H:i:s') , " Set alignments" , EOL; |
|
166 | +echo date('H:i:s'), " Set alignments", EOL; |
|
167 | 167 | $objPHPExcel->getActiveSheet()->getStyle('D11')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT); |
168 | 168 | $objPHPExcel->getActiveSheet()->getStyle('D12')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT); |
169 | 169 | $objPHPExcel->getActiveSheet()->getStyle('D13')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $objPHPExcel->getActiveSheet()->getStyle('B5')->getAlignment()->setShrinkToFit(true); |
175 | 175 | |
176 | 176 | // Set thin black border outline around column |
177 | -echo date('H:i:s') , " Set thin black border outline around column" , EOL; |
|
177 | +echo date('H:i:s'), " Set thin black border outline around column", EOL; |
|
178 | 178 | $styleThinBlackBorderOutline = array( |
179 | 179 | 'borders' => array( |
180 | 180 | 'outline' => array( |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | |
189 | 189 | // Set thick brown border outline around "Total" |
190 | -echo date('H:i:s') , " Set thick brown border outline around Total" , EOL; |
|
190 | +echo date('H:i:s'), " Set thick brown border outline around Total", EOL; |
|
191 | 191 | $styleThickBrownBorderOutline = array( |
192 | 192 | 'borders' => array( |
193 | 193 | 'outline' => array( |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | $objPHPExcel->getActiveSheet()->getStyle('D13:E13')->applyFromArray($styleThickBrownBorderOutline); |
200 | 200 | |
201 | 201 | // Set fills |
202 | -echo date('H:i:s') , " Set fills" , EOL; |
|
202 | +echo date('H:i:s'), " Set fills", EOL; |
|
203 | 203 | $objPHPExcel->getActiveSheet()->getStyle('A1:E1')->getFill()->setFillType(\PHPExcel\Style\Fill::FILL_SOLID); |
204 | 204 | $objPHPExcel->getActiveSheet()->getStyle('A1:E1')->getFill()->getStartColor()->setARGB('FF808080'); |
205 | 205 | |
206 | 206 | // Set style for header row using alternative method |
207 | -echo date('H:i:s') , " Set style for header row using alternative method" , EOL; |
|
207 | +echo date('H:i:s'), " Set style for header row using alternative method", EOL; |
|
208 | 208 | $objPHPExcel->getActiveSheet()->getStyle('A3:E3')->applyFromArray( |
209 | 209 | array( |
210 | 210 | 'font' => array( |
@@ -263,24 +263,24 @@ discard block |
||
263 | 263 | ); |
264 | 264 | |
265 | 265 | // Unprotect a cell |
266 | -echo date('H:i:s') , " Unprotect a cell" , EOL; |
|
266 | +echo date('H:i:s'), " Unprotect a cell", EOL; |
|
267 | 267 | $objPHPExcel->getActiveSheet()->getStyle('B1')->getProtection()->setLocked(\PHPExcel\Style\Protection::PROTECTION_UNPROTECTED); |
268 | 268 | |
269 | 269 | // Add a hyperlink to the sheet |
270 | -echo date('H:i:s') , " Add a hyperlink to an external website" , EOL; |
|
270 | +echo date('H:i:s'), " Add a hyperlink to an external website", EOL; |
|
271 | 271 | $objPHPExcel->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net'); |
272 | 272 | $objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('http://www.phpexcel.net'); |
273 | 273 | $objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setTooltip('Navigate to website'); |
274 | 274 | $objPHPExcel->getActiveSheet()->getStyle('E26')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT); |
275 | 275 | |
276 | -echo date('H:i:s') , " Add a hyperlink to another cell on a different worksheet within the workbook" , EOL; |
|
276 | +echo date('H:i:s'), " Add a hyperlink to another cell on a different worksheet within the workbook", EOL; |
|
277 | 277 | $objPHPExcel->getActiveSheet()->setCellValue('E27', 'Terms and conditions'); |
278 | 278 | $objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setUrl("sheet://'Terms and conditions'!A1"); |
279 | 279 | $objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setTooltip('Review terms and conditions'); |
280 | 280 | $objPHPExcel->getActiveSheet()->getStyle('E27')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT); |
281 | 281 | |
282 | 282 | // Add a drawing to the worksheet |
283 | -echo date('H:i:s') , " Add a drawing to the worksheet" , EOL; |
|
283 | +echo date('H:i:s'), " Add a drawing to the worksheet", EOL; |
|
284 | 284 | $objDrawing = new \PHPExcel\Worksheet\Drawing(); |
285 | 285 | $objDrawing->setName('Logo'); |
286 | 286 | $objDrawing->setDescription('Logo'); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); |
290 | 290 | |
291 | 291 | // Add a drawing to the worksheet |
292 | -echo date('H:i:s') , " Add a drawing to the worksheet" , EOL; |
|
292 | +echo date('H:i:s'), " Add a drawing to the worksheet", EOL; |
|
293 | 293 | $objDrawing = new \PHPExcel\Worksheet\Drawing(); |
294 | 294 | $objDrawing->setName('Paid'); |
295 | 295 | $objDrawing->setDescription('Paid'); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); |
303 | 303 | |
304 | 304 | // Add a drawing to the worksheet |
305 | -echo date('H:i:s') , " Add a drawing to the worksheet" , EOL; |
|
305 | +echo date('H:i:s'), " Add a drawing to the worksheet", EOL; |
|
306 | 306 | $objDrawing = new \PHPExcel\Worksheet\Drawing(); |
307 | 307 | $objDrawing->setName('PHPExcel logo'); |
308 | 308 | $objDrawing->setDescription('PHPExcel logo'); |
@@ -313,36 +313,36 @@ discard block |
||
313 | 313 | $objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); |
314 | 314 | |
315 | 315 | // Play around with inserting and removing rows and columns |
316 | -echo date('H:i:s') , " Play around with inserting and removing rows and columns" , EOL; |
|
316 | +echo date('H:i:s'), " Play around with inserting and removing rows and columns", EOL; |
|
317 | 317 | $objPHPExcel->getActiveSheet()->insertNewRowBefore(6, 10); |
318 | 318 | $objPHPExcel->getActiveSheet()->removeRow(6, 10); |
319 | 319 | $objPHPExcel->getActiveSheet()->insertNewColumnBefore('E', 5); |
320 | 320 | $objPHPExcel->getActiveSheet()->removeColumn('E', 5); |
321 | 321 | |
322 | 322 | // Set header and footer. When no different headers for odd/even are used, odd header is assumed. |
323 | -echo date('H:i:s') , " Set header/footer" , EOL; |
|
323 | +echo date('H:i:s'), " Set header/footer", EOL; |
|
324 | 324 | $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&BInvoice&RPrinted on &D'); |
325 | 325 | $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N'); |
326 | 326 | |
327 | 327 | // Set page orientation and size |
328 | -echo date('H:i:s') , " Set page orientation and size" , EOL; |
|
328 | +echo date('H:i:s'), " Set page orientation and size", EOL; |
|
329 | 329 | $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_PORTRAIT); |
330 | 330 | $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4); |
331 | 331 | |
332 | 332 | // Rename first worksheet |
333 | -echo date('H:i:s') , " Rename first worksheet" , EOL; |
|
333 | +echo date('H:i:s'), " Rename first worksheet", EOL; |
|
334 | 334 | $objPHPExcel->getActiveSheet()->setTitle('Invoice'); |
335 | 335 | |
336 | 336 | |
337 | 337 | // Create a new worksheet, after the default sheet |
338 | -echo date('H:i:s') , " Create a second Worksheet object" , EOL; |
|
338 | +echo date('H:i:s'), " Create a second Worksheet object", EOL; |
|
339 | 339 | $objPHPExcel->createSheet(); |
340 | 340 | |
341 | 341 | // Llorem ipsum... |
342 | 342 | $sLloremIpsum = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus eget ante. Sed cursus nunc semper tortor. Aliquam luctus purus non elit. Fusce vel elit commodo sapien dignissim dignissim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur accumsan magna sed massa. Nullam bibendum quam ac ipsum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin augue. Praesent malesuada justo sed orci. Pellentesque lacus ligula, sodales quis, ultricies a, ultricies vitae, elit. Sed luctus consectetuer dolor. Vivamus vel sem ut nisi sodales accumsan. Nunc et felis. Suspendisse semper viverra odio. Morbi at odio. Integer a orci a purus venenatis molestie. Nam mattis. Praesent rhoncus, nisi vel mattis auctor, neque nisi faucibus sem, non dapibus elit pede ac nisl. Cras turpis.'; |
343 | 343 | |
344 | 344 | // Add some data to the second sheet, resembling some different data types |
345 | -echo date('H:i:s') , " Add some data" , EOL; |
|
345 | +echo date('H:i:s'), " Add some data", EOL; |
|
346 | 346 | $objPHPExcel->setActiveSheetIndex(1); |
347 | 347 | $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Terms and conditions'); |
348 | 348 | $objPHPExcel->getActiveSheet()->setCellValue('A3', $sLloremIpsum); |
@@ -351,19 +351,19 @@ discard block |
||
351 | 351 | $objPHPExcel->getActiveSheet()->setCellValue('A6', $sLloremIpsum); |
352 | 352 | |
353 | 353 | // Set the worksheet tab color |
354 | -echo date('H:i:s') , " Set the worksheet tab color" , EOL; |
|
355 | -$objPHPExcel->getActiveSheet()->getTabColor()->setARGB('FF0094FF');; |
|
354 | +echo date('H:i:s'), " Set the worksheet tab color", EOL; |
|
355 | +$objPHPExcel->getActiveSheet()->getTabColor()->setARGB('FF0094FF'); ; |
|
356 | 356 | |
357 | 357 | // Set alignments |
358 | -echo date('H:i:s') , " Set alignments" , EOL; |
|
358 | +echo date('H:i:s'), " Set alignments", EOL; |
|
359 | 359 | $objPHPExcel->getActiveSheet()->getStyle('A3:A6')->getAlignment()->setWrapText(true); |
360 | 360 | |
361 | 361 | // Set column widths |
362 | -echo date('H:i:s') , " Set column widths" , EOL; |
|
362 | +echo date('H:i:s'), " Set column widths", EOL; |
|
363 | 363 | $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(80); |
364 | 364 | |
365 | 365 | // Set fonts |
366 | -echo date('H:i:s') , " Set fonts" , EOL; |
|
366 | +echo date('H:i:s'), " Set fonts", EOL; |
|
367 | 367 | $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setName('Candara'); |
368 | 368 | $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(20); |
369 | 369 | $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true); |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $objPHPExcel->getActiveSheet()->getStyle('A3:A6')->getFont()->setSize(8); |
373 | 373 | |
374 | 374 | // Add a drawing to the worksheet |
375 | -echo date('H:i:s') , " Add a drawing to the worksheet" , EOL; |
|
375 | +echo date('H:i:s'), " Add a drawing to the worksheet", EOL; |
|
376 | 376 | $objDrawing = new \PHPExcel\Worksheet\Drawing(); |
377 | 377 | $objDrawing->setName('Terms and conditions'); |
378 | 378 | $objDrawing->setDescription('Terms and conditions'); |
@@ -381,12 +381,12 @@ discard block |
||
381 | 381 | $objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); |
382 | 382 | |
383 | 383 | // Set page orientation and size |
384 | -echo date('H:i:s') , " Set page orientation and size" , EOL; |
|
384 | +echo date('H:i:s'), " Set page orientation and size", EOL; |
|
385 | 385 | $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); |
386 | 386 | $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4); |
387 | 387 | |
388 | 388 | // Rename second worksheet |
389 | -echo date('H:i:s') , " Rename second worksheet" , EOL; |
|
389 | +echo date('H:i:s'), " Rename second worksheet", EOL; |
|
390 | 390 | $objPHPExcel->getActiveSheet()->setTitle('Terms and conditions'); |
391 | 391 | |
392 | 392 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | date_default_timezone_set('Europe/London'); |
33 | 33 | |
34 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
35 | 35 | |
36 | 36 | date_default_timezone_set('Europe/London'); |
37 | 37 | |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | // Create new PHPExcel object |
43 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
43 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
44 | 44 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
45 | 45 | |
46 | 46 | // Set document properties |
47 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
47 | +echo date('H:i:s'), " Set document properties", EOL; |
|
48 | 48 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
49 | 49 | ->setLastModifiedBy("Maarten Balliauw") |
50 | 50 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | |
57 | 57 | // Add some data |
58 | -echo date('H:i:s') , " Add some data" , EOL; |
|
58 | +echo date('H:i:s'), " Add some data", EOL; |
|
59 | 59 | $objPHPExcel->setActiveSheetIndex(0); |
60 | 60 | |
61 | 61 | $objPHPExcel->getActiveSheet()->getStyle('A1:T100')->applyFromArray( |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | ); |
80 | 80 | |
81 | 81 | // Save Excel 2007 file |
82 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
82 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
83 | 83 | $callStartTime = microtime(true); |
84 | 84 | |
85 | 85 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | $callEndTime = microtime(true); |
88 | 88 | $callTime = $callEndTime - $callStartTime; |
89 | 89 | |
90 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
91 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
90 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
91 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
92 | 92 | // Echo memory usage |
93 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
93 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
94 | 94 | |
95 | 95 | |
96 | 96 | // Save Excel 95 file |
97 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
97 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
98 | 98 | $callStartTime = microtime(true); |
99 | 99 | |
100 | 100 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | $callEndTime = microtime(true); |
103 | 103 | $callTime = $callEndTime - $callStartTime; |
104 | 104 | |
105 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
106 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
105 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
106 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
107 | 107 | // Echo memory usage |
108 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
108 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
109 | 109 | |
110 | 110 | |
111 | 111 | // Echo memory peak usage |
112 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
112 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
113 | 113 | |
114 | 114 | // Echo done |
115 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
116 | -echo 'File has been created in ' , getcwd() , EOL; |
|
115 | +echo date('H:i:s'), " Done writing file", EOL; |
|
116 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -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,9 +60,9 @@ 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 | // Datatype |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | // Data values |
73 | 73 | // Data Marker |
74 | 74 | $xAxisTickValues = array( |
75 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
75 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
76 | 76 | ); |
77 | 77 | // Set the Data values for each data series we want to plot |
78 | 78 | // Datatype |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | |
90 | 90 | // Build the dataseries |
91 | 91 | $series = new \PHPExcel\Chart\DataSeries( |
92 | - \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType |
|
93 | - \PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping |
|
94 | - range(0, count($dataSeriesValues)-1), // plotOrder |
|
95 | - $dataSeriesLabels, // plotLabel |
|
96 | - $xAxisTickValues, // plotCategory |
|
92 | + \PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType |
|
93 | + \PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping |
|
94 | + range(0, count($dataSeriesValues) - 1), // plotOrder |
|
95 | + $dataSeriesLabels, // plotLabel |
|
96 | + $xAxisTickValues, // plotCategory |
|
97 | 97 | $dataSeriesValues // plotValues |
98 | 98 | ); |
99 | 99 | // Set additional dataseries parameters |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | |
112 | 112 | // Create the chart |
113 | 113 | $chart = new \PHPExcel\Chart( |
114 | - 'chart1', // name |
|
115 | - $title, // title |
|
116 | - $legend, // legend |
|
117 | - $plotArea, // plotArea |
|
118 | - true, // plotVisibleOnly |
|
119 | - 0, // displayBlanksAs |
|
120 | - NULL, // xAxisLabel |
|
114 | + 'chart1', // name |
|
115 | + $title, // title |
|
116 | + $legend, // legend |
|
117 | + $plotArea, // plotArea |
|
118 | + true, // plotVisibleOnly |
|
119 | + 0, // displayBlanksAs |
|
120 | + NULL, // xAxisLabel |
|
121 | 121 | $yAxisLabel // yAxisLabel |
122 | 122 | ); |
123 | 123 | |
@@ -130,16 +130,16 @@ discard block |
||
130 | 130 | |
131 | 131 | |
132 | 132 | // Save Excel 2007 file |
133 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
133 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
134 | 134 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
135 | 135 | $objWriter->setIncludeCharts(TRUE); |
136 | 136 | $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); |
137 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
137 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
138 | 138 | |
139 | 139 | |
140 | 140 | // Echo memory peak usage |
141 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
141 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
142 | 142 | |
143 | 143 | // Echo done |
144 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
145 | -echo 'File has been created in ' , getcwd() , EOL; |
|
144 | +echo date('H:i:s'), " Done writing file", EOL; |
|
145 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -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,9 +60,9 @@ 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 | // Datatype |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | // Data values |
73 | 73 | // Data Marker |
74 | 74 | $xAxisTickValues = array( |
75 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
75 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
76 | 76 | ); |
77 | 77 | // Set the Data values for each data series we want to plot |
78 | 78 | // Datatype |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | |
90 | 90 | // Build the dataseries |
91 | 91 | $series = new \PHPExcel\Chart\DataSeries( |
92 | - \PHPExcel\Chart\DataSeries::TYPE_LINECHART, // plotType |
|
93 | - \PHPExcel\Chart\DataSeries::GROUPING_STACKED, // plotGrouping |
|
94 | - range(0, count($dataSeriesValues)-1), // plotOrder |
|
95 | - $dataSeriesLabels, // plotLabel |
|
96 | - $xAxisTickValues, // plotCategory |
|
92 | + \PHPExcel\Chart\DataSeries::TYPE_LINECHART, // plotType |
|
93 | + \PHPExcel\Chart\DataSeries::GROUPING_STACKED, // plotGrouping |
|
94 | + range(0, count($dataSeriesValues) - 1), // plotOrder |
|
95 | + $dataSeriesLabels, // plotLabel |
|
96 | + $xAxisTickValues, // plotCategory |
|
97 | 97 | $dataSeriesValues // plotValues |
98 | 98 | ); |
99 | 99 | |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | |
109 | 109 | // Create the chart |
110 | 110 | $chart = new \PHPExcel\Chart( |
111 | - 'chart1', // name |
|
112 | - $title, // title |
|
113 | - $legend, // legend |
|
114 | - $plotArea, // plotArea |
|
115 | - true, // plotVisibleOnly |
|
116 | - 0, // displayBlanksAs |
|
117 | - NULL, // xAxisLabel |
|
111 | + 'chart1', // name |
|
112 | + $title, // title |
|
113 | + $legend, // legend |
|
114 | + $plotArea, // plotArea |
|
115 | + true, // plotVisibleOnly |
|
116 | + 0, // displayBlanksAs |
|
117 | + NULL, // xAxisLabel |
|
118 | 118 | $yAxisLabel // yAxisLabel |
119 | 119 | ); |
120 | 120 | |
@@ -127,16 +127,16 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | // Save Excel 2007 file |
130 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
130 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
131 | 131 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
132 | 132 | $objWriter->setIncludeCharts(TRUE); |
133 | 133 | $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); |
134 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
134 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
135 | 135 | |
136 | 136 | |
137 | 137 | // Echo memory peak usage |
138 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
138 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
139 | 139 | |
140 | 140 | // Echo done |
141 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
142 | -echo 'File has been created in ' , getcwd() , EOL; |
|
141 | +echo date('H:i:s'), " Done writing file", EOL; |
|
142 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | date_default_timezone_set('Europe/London'); |
33 | 33 | |
34 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
35 | 35 | |
36 | 36 | date_default_timezone_set('Europe/London'); |
37 | 37 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
42 | 42 | |
43 | 43 | |
44 | -echo date('H:i:s') , " Write to HTML format" , EOL; |
|
44 | +echo date('H:i:s'), " Write to HTML format", EOL; |
|
45 | 45 | $callStartTime = microtime(true); |
46 | 46 | |
47 | 47 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML'); |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | $objWriter->save(str_replace('.php', '.htm', __FILE__)); |
51 | 51 | $callEndTime = microtime(true); |
52 | 52 | $callTime = $callEndTime - $callStartTime; |
53 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.htm', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
54 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
53 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.htm', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
54 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
55 | 55 | // Echo memory usage |
56 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
56 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
57 | 57 | |
58 | 58 | |
59 | 59 | // Echo memory peak usage |
60 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
60 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
61 | 61 | |
62 | 62 | // Echo done |
63 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
64 | -echo 'File has been created in ' , getcwd() , EOL; |
|
63 | +echo date('H:i:s'), " Done writing file", EOL; |
|
64 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | date_default_timezone_set('Europe/London'); |
33 | 33 | |
34 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
35 | 35 | |
36 | 36 | date_default_timezone_set('Europe/London'); |
37 | 37 | |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | // Create new PHPExcel object |
43 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
43 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
44 | 44 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
45 | 45 | |
46 | 46 | // Add some data, we will use some formulas here |
47 | -echo date('H:i:s') , " Add some data and formulas" , EOL; |
|
47 | +echo date('H:i:s'), " Add some data and formulas", EOL; |
|
48 | 48 | $objPHPExcel->getActiveSheet()->setCellValue('A1', '=B1') |
49 | 49 | ->setCellValue('A2', '=B2+1') |
50 | 50 | ->setCellValue('B1', '=A1+1') |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | \PHPExcel\Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 100; |
54 | 54 | |
55 | 55 | // Calculated data |
56 | -echo date('H:i:s') , " Calculated data" , EOL; |
|
57 | -for($row = 1; $row <= 2; ++$row) { |
|
56 | +echo date('H:i:s'), " Calculated data", EOL; |
|
57 | +for ($row = 1; $row <= 2; ++$row) { |
|
58 | 58 | for ($col = 'A'; $col != 'C'; ++$col) { |
59 | - if ((!is_null($formula = $objPHPExcel->getActiveSheet()->getCell($col.$row)->getValue())) && |
|
59 | + if ((!is_null($formula = $objPHPExcel->getActiveSheet()->getCell($col . $row)->getValue())) && |
|
60 | 60 | ($formula[0] == '=')) { |
61 | - echo 'Value of ' , $col , $row , ' [' , $formula , ']: ' , |
|
62 | - $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() . EOL; |
|
61 | + echo 'Value of ', $col, $row, ' [', $formula, ']: ', |
|
62 | + $objPHPExcel->getActiveSheet()->getCell($col . $row)->getCalculatedValue() . EOL; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | 68 | // Save Excel 2007 file |
69 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
69 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
70 | 70 | $callStartTime = microtime(true); |
71 | 71 | |
72 | 72 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | $callEndTime = microtime(true); |
84 | 84 | $callTime = $callEndTime - $callStartTime; |
85 | 85 | |
86 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
87 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
86 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
87 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
88 | 88 | // Echo memory usage |
89 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
89 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
90 | 90 | |
91 | 91 | |
92 | 92 | // Echo memory peak usage |
93 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
93 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
94 | 94 | |
95 | 95 | // Echo done |
96 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
97 | -echo 'File has been created in ' , getcwd() , EOL; |
|
96 | +echo date('H:i:s'), " Done writing file", EOL; |
|
97 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | date_default_timezone_set('Europe/London'); |
33 | 33 | |
34 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
35 | 35 | |
36 | 36 | date_default_timezone_set('Europe/London'); |
37 | 37 | |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | // Create new PHPExcel object |
43 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
43 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
44 | 44 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
45 | 45 | |
46 | 46 | |
47 | 47 | // Set document properties |
48 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
48 | +echo date('H:i:s'), " Set document properties", EOL; |
|
49 | 49 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
50 | 50 | ->setLastModifiedBy("Maarten Balliauw") |
51 | 51 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | |
58 | 58 | // Create a first sheet |
59 | -echo date('H:i:s') , " Add data" , EOL; |
|
59 | +echo date('H:i:s'), " Add data", EOL; |
|
60 | 60 | $objPHPExcel->setActiveSheetIndex(0); |
61 | 61 | $objPHPExcel->getActiveSheet()->setCellValue('A1', "Cell B3 and B5 contain data validation...") |
62 | 62 | ->setCellValue('A3', "Number:") |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | |
75 | 75 | |
76 | 76 | // Set data validation |
77 | -echo date('H:i:s') , " Set data validation" , EOL; |
|
77 | +echo date('H:i:s'), " Set data validation", EOL; |
|
78 | 78 | $objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation(); |
79 | -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_WHOLE ); |
|
80 | -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_STOP ); |
|
79 | +$objValidation->setType(\PHPExcel\Cell\DataValidation::TYPE_WHOLE); |
|
80 | +$objValidation->setErrorStyle(\PHPExcel\Cell\DataValidation::STYLE_STOP); |
|
81 | 81 | $objValidation->setAllowBlank(true); |
82 | 82 | $objValidation->setShowInputMessage(true); |
83 | 83 | $objValidation->setShowErrorMessage(true); |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | $objValidation->setFormula2(20); |
90 | 90 | |
91 | 91 | $objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation(); |
92 | -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST ); |
|
93 | -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION ); |
|
92 | +$objValidation->setType(\PHPExcel\Cell\DataValidation::TYPE_LIST); |
|
93 | +$objValidation->setErrorStyle(\PHPExcel\Cell\DataValidation::STYLE_INFORMATION); |
|
94 | 94 | $objValidation->setAllowBlank(false); |
95 | 95 | $objValidation->setShowInputMessage(true); |
96 | 96 | $objValidation->setShowErrorMessage(true); |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | $objValidation->setError('Value is not in list.'); |
100 | 100 | $objValidation->setPromptTitle('Pick from list'); |
101 | 101 | $objValidation->setPrompt('Please pick a value from the drop-down list.'); |
102 | -$objValidation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " !!! |
|
102 | +$objValidation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " !!! |
|
103 | 103 | |
104 | 104 | $objValidation = $objPHPExcel->getActiveSheet()->getCell('B7')->getDataValidation(); |
105 | -$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST ); |
|
106 | -$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION ); |
|
105 | +$objValidation->setType(\PHPExcel\Cell\DataValidation::TYPE_LIST); |
|
106 | +$objValidation->setErrorStyle(\PHPExcel\Cell\DataValidation::STYLE_INFORMATION); |
|
107 | 107 | $objValidation->setAllowBlank(false); |
108 | 108 | $objValidation->setShowInputMessage(true); |
109 | 109 | $objValidation->setShowErrorMessage(true); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $objValidation->setError('Value is not in list.'); |
113 | 113 | $objValidation->setPromptTitle('Pick from list'); |
114 | 114 | $objValidation->setPrompt('Please pick a value from the drop-down list.'); |
115 | -$objValidation->setFormula1('$D$2:$D$6'); // Make sure NOT to put a range of cells or a formula between " and " !!! |
|
115 | +$objValidation->setFormula1('$D$2:$D$6'); // Make sure NOT to put a range of cells or a formula between " and " !!! |
|
116 | 116 | |
117 | 117 | |
118 | 118 | // Set active sheet index to the first sheet, so Excel opens this as the first sheet |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | |
122 | 122 | // Save Excel 95 file |
123 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
123 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
124 | 124 | $callStartTime = microtime(true); |
125 | 125 | |
126 | 126 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | $callEndTime = microtime(true); |
129 | 129 | $callTime = $callEndTime - $callStartTime; |
130 | 130 | |
131 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
132 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
131 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
132 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
133 | 133 | // Echo memory usage |
134 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
134 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
135 | 135 | |
136 | 136 | |
137 | 137 | // Echo memory peak usage |
138 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
138 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
139 | 139 | |
140 | 140 | // Echo done |
141 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
142 | -echo 'File has been created in ' , getcwd() , EOL; |
|
141 | +echo date('H:i:s'), " Done writing file", EOL; |
|
142 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php'; |
35 | 35 | |
36 | 36 | |
37 | -echo date('H:i:s') , " Load from Excel2003XML file" , PHP_EOL; |
|
37 | +echo date('H:i:s'), " Load from Excel2003XML file", PHP_EOL; |
|
38 | 38 | $callStartTime = microtime(true); |
39 | 39 | |
40 | 40 | $objReader = \PHPExcel\IOFactory::createReader('Excel2003XML'); |
@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | |
44 | 44 | $callEndTime = microtime(true); |
45 | 45 | $callTime = $callEndTime - $callStartTime; |
46 | -echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , PHP_EOL; |
|
46 | +echo 'Call time to read Workbook was ', sprintf('%.4f', $callTime), " seconds", PHP_EOL; |
|
47 | 47 | // Echo memory usage |
48 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , PHP_EOL; |
|
48 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", PHP_EOL; |
|
49 | 49 | |
50 | 50 | |
51 | -echo date('H:i:s') , " Write to Excel5 format" , PHP_EOL; |
|
51 | +echo date('H:i:s'), " Write to Excel5 format", PHP_EOL; |
|
52 | 52 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
53 | 53 | $objWriter->save(str_replace('.php', '.xls', __FILE__)); |
54 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', __FILE__) , PHP_EOL; |
|
54 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', __FILE__), PHP_EOL; |
|
55 | 55 | |
56 | 56 | |
57 | 57 | // Echo memory peak usage |
58 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_EOL; |
|
58 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", PHP_EOL; |
|
59 | 59 | |
60 | 60 | // Echo done |
61 | -echo date('H:i:s') , " Done writing file" , PHP_EOL; |
|
61 | +echo date('H:i:s'), " Done writing file", PHP_EOL; |
@@ -114,11 +114,11 @@ |
||
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 |