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 / 34chartupdate.php

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

79 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /** Error reporting */
4 error_reporting(E_ALL);
5 ini_set('display_errors', TRUE);
6 ini_set('display_startup_errors', TRUE);
7 date_default_timezone_set('Europe/London');
8
9 define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
10
11 date_default_timezone_set('Europe/London');
12
13 /**
14 * PHPExcel
15 *
16 * Copyright (C) 2006 - 2014 PHPExcel
17 *
18 * This library is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU Lesser General Public
20 * License as published by the Free Software Foundation; either
21 * version 2.1 of the License, or (at your option) any later version.
22 *
23 * This library is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 * Lesser General Public License for more details.
27 *
28 * You should have received a copy of the GNU Lesser General Public
29 * License along with this library; if not, write to the Free Software
30 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
31 *
32 * @category PHPExcel
33 * @package PHPExcel
34 * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
35 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
36 * @version ##VERSION##, ##DATE##
37 */
38
39 /** PHPExcel */
40 require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
41
42 if (!file_exists("33chartcreate-bar.xlsx")) {
43 exit("Please run 33chartcreate-bar.php first." . EOL);
44 }
45
46 echo date('H:i:s') , " Load from Excel2007 file" , EOL;
47 $objReader = PHPExcel_IOFactory::createReader("Excel2007");
48 $objReader->setIncludeCharts(TRUE);
49 $objPHPExcel = $objReader->load("33chartcreate-bar.xlsx");
50
51
52 echo date('H:i:s') , " Update cell data values that are displayed in the chart" , EOL;
53 $objWorksheet = $objPHPExcel->getActiveSheet();
54 $objWorksheet->fromArray(
55 array(
56 array(50-12, 50-15, 50-21),
57 array(50-56, 50-73, 50-86),
58 array(50-52, 50-61, 50-69),
59 array(50-30, 50-32, 50),
60 ),
61 NULL,
62 'B2'
63 );
64
65 // Save Excel 2007 file
66 echo date('H:i:s') , " Write to Excel2007 format" , EOL;
67 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
68 $objWriter->setIncludeCharts(TRUE);
69 $objWriter->save(str_replace('.php', '.xlsx', __FILE__));
70 echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
71
72
73 // Echo memory peak usage
74 echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
75
76 // Echo done
77 echo date('H:i:s') , " Done writing file" , EOL;
78 echo 'File has been created in ' , getcwd() , EOL;
79