ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
22heavilyformatted.php
Go to the documentation of this file.
1 <?php
29 error_reporting(E_ALL);
30 ini_set('display_errors', TRUE);
31 ini_set('display_startup_errors', TRUE);
32 date_default_timezone_set('Europe/London');
33 
34 define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
35 
36 date_default_timezone_set('Europe/London');
37 
39 require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
40 
41 
42 // Create new PHPExcel object
43 echo date('H:i:s') , " Create new PHPExcel object" , EOL;
45 
46 // Set document properties
47 echo date('H:i:s') , " Set document properties" , EOL;
48 $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
49  ->setLastModifiedBy("Maarten Balliauw")
50  ->setTitle("Office 2007 XLSX Test Document")
51  ->setSubject("Office 2007 XLSX Test Document")
52  ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
53  ->setKeywords("office 2007 openxml php")
54  ->setCategory("Test result file");
55 
56 
57 // Add some data
58 echo date('H:i:s') , " Add some data" , EOL;
59 $objPHPExcel->setActiveSheetIndex(0);
60 
61 $objPHPExcel->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
62  array('fill' => array(
64  'color' => array('argb' => 'FFCCFFCC')
65  ),
66  'borders' => array(
67  'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
68  'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
69  )
70  )
71  );
72 
73 $objPHPExcel->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
74  array('fill' => array(
76  'color' => array('argb' => 'FFFFFF00')
77  ),
78  )
79  );
80 
81 // Save Excel 2007 file
82 echo date('H:i:s') , " Write to Excel2007 format" , EOL;
83 $callStartTime = microtime(true);
84 
86 $objWriter->save(str_replace('.php', '.xlsx', __FILE__));
87 $callEndTime = microtime(true);
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;
92 // Echo memory usage
93 echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
94 
95 
96 // Save Excel 95 file
97 echo date('H:i:s') , " Write to Excel5 format" , EOL;
98 $callStartTime = microtime(true);
99 
101 $objWriter->save(str_replace('.php', '.xls', __FILE__));
102 $callEndTime = microtime(true);
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;
107 // Echo memory usage
108 echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
109 
110 
111 // Echo memory peak usage
112 echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
113 
114 // Echo done
115 echo date('H:i:s') , " Done writing file" , EOL;
116 echo 'File has been created in ' , getcwd() , EOL;
$callStartTime
static createWriter(PHPExcel $phpExcel, $writerType='')
Create PHPExcel_Writer_IWriter.
Definition: IOFactory.php:132
if($is_dev) echo "Review changes write something in WHATSNEW and and then commit with log PHP_EOL
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
const FILL_SOLID
Definition: Fill.php:40
const EOL