Bugfixes to Chart Reader and Writer

This commit is contained in:
Mark Baker 2012-07-20 22:35:53 +01:00
parent 59932b0cac
commit 946ea73ddb
3 changed files with 17 additions and 7 deletions

View File

@ -64,7 +64,8 @@ class PHPExcel_Reader_Excel2007_Chart
$namespacesChartMeta = $chartElements->getNamespaces(true); $namespacesChartMeta = $chartElements->getNamespaces(true);
$chartElementsC = $chartElements->children($namespacesChartMeta['c']); $chartElementsC = $chartElements->children($namespacesChartMeta['c']);
$XaxisLabel = $YaxisLabel = $legend = $title = null; $XaxisLabel = $YaxisLabel = $legend = $title = NULL;
$dispBlanksAs = $plotVisOnly = NULL;
foreach($chartElementsC as $chartElementKey => $chartElement) { foreach($chartElementsC as $chartElementKey => $chartElement) {
switch ($chartElementKey) { switch ($chartElementKey) {

View File

@ -114,6 +114,10 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter {
*/ */
public function writeRawData($text) public function writeRawData($text)
{ {
if (is_array($text)) {
$text = implode("\n",$text);
}
if (method_exists($this, 'writeRaw')) { if (method_exists($this, 'writeRaw')) {
return $this->writeRaw(htmlspecialchars($text)); return $this->writeRaw(htmlspecialchars($text));
} }

View File

@ -955,6 +955,10 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$dataValues = $plotSeriesValues->getDataValues(); $dataValues = $plotSeriesValues->getDataValues();
if (!empty($dataValues)) { if (!empty($dataValues)) {
if (!is_array($dataValues)) {
var_dump($dataValues);
}
if (is_array($dataValues)) {
foreach($dataValues as $plotSeriesKey => $plotSeriesValue) { foreach($dataValues as $plotSeriesKey => $plotSeriesValue) {
$objWriter->startElement('c:pt'); $objWriter->startElement('c:pt');
$objWriter->writeAttribute('idx', $plotSeriesKey ); $objWriter->writeAttribute('idx', $plotSeriesKey );
@ -965,6 +969,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->endElement(); $objWriter->endElement();
} }
} }
}
$objWriter->endElement(); $objWriter->endElement();