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