From f2bfda68e9ad99706476b53d9a1386a02b30d5e8 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Mon, 24 Sep 2012 11:42:20 +0100 Subject: [PATCH] Fixed the OOCalc Reader that I broke a few days ago --- Classes/PHPExcel/Reader/OOCalc.php | 22 +++++++++++----------- Tests/33chartcreate-multiple-charts.php | 4 ++-- Tests/33chartcreate-pie.php | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Classes/PHPExcel/Reader/OOCalc.php b/Classes/PHPExcel/Reader/OOCalc.php index a56c9f85..ab3023ed 100644 --- a/Classes/PHPExcel/Reader/OOCalc.php +++ b/Classes/PHPExcel/Reader/OOCalc.php @@ -513,15 +513,12 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader } // echo ''.$columnID.$rowID.'
'; - if ($cellData->children) { - $cellDataText = $cellData->children($namespacesContent['text']); - $cellDataOffice = $cellData->children($namespacesContent['office']); - $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']); - $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']); - } else { - $cellDataText = ''; - $cellDataOffice = $cellDataOfficeAttributes = $cellDataTableAttributes = array(); - } + $cellDataText = (isset($namespacesContent['text'])) ? + $cellData->children($namespacesContent['text']) : + ''; + $cellDataOffice = $cellData->children($namespacesContent['office']); + $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']); + $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']); // echo 'Office Attributes: '; // print_r($cellDataOfficeAttributes); @@ -611,7 +608,10 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $dataValue = (float) $cellDataOfficeAttributes['value']; if (floor($dataValue) == $dataValue) { - $dataValue = (integer) $dataValue; + if ($dataValue = (integer) $dataValue) + $dataValue = (integer) $dataValue; + else + $dataValue = (float) $dataValue; } break; case 'date' : @@ -638,7 +638,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader // } } else { $type = PHPExcel_Cell_DataType::TYPE_NULL; - $dataValue = null; + $dataValue = NULL; } if ($hasCalculatedValue) { diff --git a/Tests/33chartcreate-multiple-charts.php b/Tests/33chartcreate-multiple-charts.php index aeead20b..6c8bcbe1 100644 --- a/Tests/33chartcreate-multiple-charts.php +++ b/Tests/33chartcreate-multiple-charts.php @@ -188,8 +188,8 @@ $yAxisLabel2 = new PHPExcel_Chart_Title('Value ($k)'); // Create the chart $chart2 = new PHPExcel_Chart( - 'chart1', // name - $title2, // title + 'chart2', // name + $title2, // title $legend2, // legend $plotarea2, // plotArea true, // plotVisibleOnly diff --git a/Tests/33chartcreate-pie.php b/Tests/33chartcreate-pie.php index e4a989ad..86b2ce4a 100644 --- a/Tests/33chartcreate-pie.php +++ b/Tests/33chartcreate-pie.php @@ -183,7 +183,7 @@ $title2 = new PHPExcel_Chart_Title('Test Donut Chart'); // Create the chart $chart2 = new PHPExcel_Chart( - 'chart1', // name + 'chart2', // name $title2, // title NULL, // legend $plotarea2, // plotArea