From e2a2fdb33588b6570d58702402fe76b1408cbba7 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Sat, 14 Jul 2012 01:26:53 +0100 Subject: [PATCH] Bugfix: (seltzlab) Fix to excel2007 Chart Writer when a $plotSeriesValues is empty --- Classes/PHPExcel/Writer/Excel2007/Chart.php | 15 +++++++++------ changelog.txt | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Classes/PHPExcel/Writer/Excel2007/Chart.php b/Classes/PHPExcel/Writer/Excel2007/Chart.php index d27c7af5..705a4072 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Chart.php +++ b/Classes/PHPExcel/Writer/Excel2007/Chart.php @@ -953,14 +953,17 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->writeAttribute('val', $plotSeriesValues->getPointCount() ); $objWriter->endElement(); - foreach($plotSeriesValues->getDataValues() as $plotSeriesKey => $plotSeriesValue) { - $objWriter->startElement('c:pt'); - $objWriter->writeAttribute('idx', $plotSeriesKey ); + $dataValues = $plotSeriesValues->getDataValues(); + if (!empty($dataValues)) { + foreach($dataValues as $plotSeriesKey => $plotSeriesValue) { + $objWriter->startElement('c:pt'); + $objWriter->writeAttribute('idx', $plotSeriesKey ); - $objWriter->startElement('c:v'); - $objWriter->writeRawData( $plotSeriesValue ); + $objWriter->startElement('c:v'); + $objWriter->writeRawData( $plotSeriesValue ); + $objWriter->endElement(); $objWriter->endElement(); - $objWriter->endElement(); + } } $objWriter->endElement(); diff --git a/changelog.txt b/changelog.txt index 06eac57d..bdfa9644 100644 --- a/changelog.txt +++ b/changelog.txt @@ -37,6 +37,7 @@ Fixed in develop branch: - Bugfix: (MBaker) Work items 15799 and 18278 - Background color cell is always black when editing cell - Bugfix: (MBaker) Work items 15905 and 18183 - Allow "no impact" to formats on Conditional Formatting - Bugfix: (wackonline) OOCalc Reader fix for NULL cells +- Bugfix: (seltzlab) Fix to excel2007 Chart Writer when a $plotSeriesValues is empty 2012-05-19 (v1.7.7):