Forum


Replies: 2   Views: 3232
Addtemplatechart corrupting file
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by mbcalvin  · 10-12-2012 - 22:41

Hello,
I am trying to add a line chart to a template document. Whenever I try and add it, I get the message:
Source: Microsoft Word Description: The file appears to be corrupted.
-2147352567
[server path]\event\worddocs\index.php LINE: 77

I am using the exact data from the example to create the line chart (so I can get it working, then I will put my own data). Here is the php I am using for this part of the document:

$lineChartValues = array(
'legend' => array('SymbianOS','iOS','BlackBerry OS','Android', 'Sony Ericsson','Samsung','Other'),
'2010-05' => array('32.92', '29.01', '14.15', '3.94', '9.09', '2.86', '1.11'),
'2010-06' => array('33.39', '26.66', '14.98', '3.95', '9.81', '3.34', '1.07'),
'2010-07' => array('32.04', '26.05', '16.45', '7.91', '6.77', '2.93', '1.46'),
'2010-08' => array('31.54', '25.71', '16.95', '9.22', '6.16', '2.85', '1.43'),
'2010-09' => array('32.69', '22.85', '17.9', '9.79', '6.59', '2.96', '1.16'),
'2010-10' => array('32.83', '22.45', '18.19', '10.67', '5.91', '2.83', '1.19'),
'2010-11' => array('31.93', '21.94', '19.25', '11.61', '5.32', '3.49', '1.2'),
'2010-12' => array('29.66', '23.57', '18.04', '13.6', '5.13', '4.05', '1.2'),
'2011-01' => array('30.25', '25.02', '15.03', '14.61', '5.21', '4.33', '1.27'),
'2011-02' => array('30.66', '24.56', '14.52', '15.16', '5.14', '4.51', '1.26'),
'2011-03' => array('30.61', '24.38', '14.1', '15.8', '5.1', '4.73', '1.21'),
'2011-04' => array('31.56', '23.34', '13.54', '16.05', '5.28', '4.99', '1.26'),
'2011-05' => array('31.36', '22.09', '12.94', '17.63', '5.77', '5.08', '1.4')
);

$paramsChart = array(
'data' => $lineChartValues,
'type' => 'lineChart',
'title' => 'Top 7 Mobile OSs from May 2010 to May 2011',
'color' => 2,
'sizeX' => 15,
'sizeY' => 15,
'jc' => 'center',
'groupBar' => 'clustered',
'font' => 'Arial',
'hgrid' => 1,
'vgrid' => 1,
'legendpos' => 'b',
'legendoverlay' => 0
);

$docx->addTemplateChart('CHART', $paramsChart);

I would appreciate any help you can offer.