ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
40duplicateStyle.php
Go to the documentation of this file.
1 <?php
3 error_reporting(E_ALL);
4 ini_set('display_errors', TRUE);
5 ini_set('display_startup_errors', TRUE);
6 date_default_timezone_set('Europe/London');
7 
8 define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
9 
10 date_default_timezone_set('Europe/London');
11 
13 require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
14 
15 echo date('H:i:s') , " Create new PHPExcel object" , EOL;
17 $worksheet = $objPHPExcel->getActiveSheet();
18 
19 echo date('H:i:s') , " Create styles array" , EOL;
21 for ($i = 0; $i < 10; $i++) {
22  $style = new PHPExcel_Style();
23  $style->getFont()->setSize($i + 4);
24  $styles[] = $style;
25 }
26 
27 echo date('H:i:s') , " Add data (begin)" , EOL;
28 $t = microtime(true);
29 for ($col = 0; $col < 50; $col++) {
30  for ($row = 0; $row < 100; $row++) {
31  $str = ($row + $col);
32  $style = $styles[$row % 10];
33  $coord = PHPExcel_Cell::stringFromColumnIndex($col) . ($row + 1);
34  $worksheet->setCellValue($coord, $str);
35  $worksheet->duplicateStyle($style, $coord);
36  }
37 }
38 $d = microtime(true) - $t;
39 echo date('H:i:s') , " Add data (end), time: " . round($d, 2) . " s", EOL;
40 
41 
42 echo date('H:i:s') , " Write to Excel2007 format" , EOL;
44 $objWriter->save(str_replace('.php', '.xlsx', __FILE__));
45 echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
46 
47 
48 echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
49 
50 echo date('H:i:s') , " Done writing file" , EOL;
51 echo 'File has been created in ' , getcwd() , EOL;
$worksheet
$style
Definition: example_012.php:70
$objPHPExcel
for($col=0; $col< 50; $col++) $d
$objWriter
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 EOL
static stringFromColumnIndex($pColumnIndex=0)
String from columnindex.
Definition: Cell.php:825