Cannot get chart to display

Topics: User Forum
Sep 21, 2014 at 12:10 PM
Edited Sep 21, 2014 at 3:14 PM
Hi, first time here.
I have an xlsx file which holds a simple table and a line chart. What I hope to be able to do is fill the values in from a database to update the chart (I'm not at that stage yet). As I am new to PHPExcel and finding my way with the library, what I have done is simply created the table with some random numbers except for 1 cell and a line chart. I open my browser, point to my php file and what I want to happen is that a new file is created with a random number generated by php in the empty cell, chart is updated with the new number and save it as result.xlsx. I'm at the early stages of learning here!!

Everything works except I can't get the chart generated in the new file even though it is already there in the initial file. The only thing I have left in the new file is the updated table.

No errors are reported so I'm not sure where I'm going wrong.

Windows 8.1
Excel 2010
PHPExcel 1.8
php version 5.4.24
Apache 2.4

Checked my phpinfo() and all is enabled (ie, php.xml,

My code is;


/* Error reporting /
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

require_once 'Classes/PHPExcel.php';
include 'Classes/PHPExcel/IOFactory.php';

$inputFileName = 'Gas Exception Report.xlsx';

//$objPHPExcel=$objPHPExcel_new = new PHPExcel();
$objReader = PHPExcel_IOFactory::createReader('Excel2007');

$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);

$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B24', rand(10,100));

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');



Appreciate any help, regards


I tried the examples which came with PHPExcel and all worked. I changed the first chart example and saved it with my own chart and table. It produces a new file but with the following error when opening

<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<recoveryLog xmlns="">
<summary>Errors were detected in file 'C:\Apache24\htdocs\Tests\32readwriteAreaChart1.xlsx'</summary>
<removedParts summary="Following is a list of removed parts:">
<removedPart>Removed Part: /xl/drawings/drawing1.xml part. (Drawing shape)</removedPart>
Still baffled but will persevere!!!!