PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 2.2.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v2.2.0
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / phpoffice / phpexcel / Examples / 40duplicateStyle.php

40duplicateStyle.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 2.2.0, at vendor/phpoffice/phpexcel/Examples/40duplicateStyle.php

52 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /** Error reporting */
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
12 /** Include PHPExcel */
13 require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
14
15 echo date('H:i:s') , " Create new PHPExcel object" , EOL;
16 $objPHPExcel = new PHPExcel();
17 $worksheet = $objPHPExcel->getActiveSheet();
18
19 echo date('H:i:s') , " Create styles array" , EOL;
20 $styles = array();
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;
43 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
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;
52