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');
9 define(
'EOL',(PHP_SAPI ==
'cli') ?
PHP_EOL :
'<br />');
11 date_default_timezone_set(
'Europe/London');
40 set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) .
'/../Classes/');
43 include
'PHPExcel/IOFactory.php';
58 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
60 'at the top of this script as appropriate for your directory structure' 68 if ((isset($argc)) && ($argc > 1)) {
70 for(
$i = 1;
$i < $argc; ++
$i) {
77 $inputFileNameShort = basename($inputFileName);
79 if (!file_exists($inputFileName)) {
80 echo
date(
'H:i:s') ,
" File " , $inputFileNameShort ,
' does not exist' ,
EOL;
84 echo
date(
'H:i:s') ,
" Load Test from $inputFileType file " , $inputFileNameShort ,
EOL;
91 echo
date(
'H:i:s') ,
" Iterate worksheets looking at the charts" ,
EOL;
94 echo
'Worksheet: ' , $sheetName ,
EOL;
97 if(empty($chartNames)) {
98 echo
' There are no charts in this worksheet' ,
EOL;
100 natsort($chartNames);
101 foreach($chartNames as
$i => $chartName) {
103 if (!is_null(
$chart->getTitle())) {
104 $caption =
'"' . implode(
' ',
$chart->getTitle()->getCaption()) .
'"';
106 $caption =
'Untitled';
108 echo
' ' , $chartName ,
' - ' , $caption ,
EOL;
109 echo str_repeat(
' ',strlen($chartName)+3);
111 $jpegFile =
'35'.str_replace(
'.xlsx',
'.jpg', substr($inputFileNameShort,2));
112 if (file_exists($jpegFile)) {
116 $chart->render($jpegFile);
118 echo
'Error rendering chart: ',$e->getMessage();
130 echo
date(
'H:i:s') ,
' Peak memory usage: ' , (memory_get_peak_usage(
true) / 1024 / 1024) ,
" MB" ,
EOL;
133 echo
date(
'H:i:s') ,
" Done rendering charts as images" ,
EOL;
134 echo
'Image files have been created in ' , getcwd() ,
EOL;
if(!PHPExcel_Settings::setChartRenderer($rendererName, $rendererLibraryPath)) $inputFileType
$rendererName
PHPExcel_IOFactory.
static createReader($readerType='')
Create PHPExcel_Reader_IReader.
static setChartRenderer($libraryName, $libraryBaseDir)
Set details of the external library that PHPExcel should use for rendering charts.
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 CHART_RENDERER_JPGRAPH
Optional Chart Rendering libraries.