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);
$chartElementsC = $chartElements->children($namespacesChartMeta['c']);
$XaxisLabel = $YaxisLabel = $legend = $title = null;
$XaxisLabel = $YaxisLabel = $legend = $title = NULL;
$dispBlanksAs = $plotVisOnly = NULL;
foreach($chartElementsC as $chartElementKey => $chartElement) {
switch ($chartElementKey) {

View File

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

View File

@ -955,14 +955,19 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$dataValues = $plotSeriesValues->getDataValues();
if (!empty($dataValues)) {
foreach($dataValues as $plotSeriesKey => $plotSeriesValue) {
$objWriter->startElement('c:pt');
$objWriter->writeAttribute('idx', $plotSeriesKey );
if (!is_array($dataValues)) {
var_dump($dataValues);
}
if (is_array($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();
}
}
}