From f27b3d7815756e4fa7eaa76df6ddcc540db2cda7 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Tue, 22 Feb 2011 14:02:27 +0000 Subject: [PATCH] Fix to prevent non-comment objects from throwing errors when retrieving the set of comment objects from the XML git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@69155 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Reader/Gnumeric.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Classes/PHPExcel/Reader/Gnumeric.php b/Classes/PHPExcel/Reader/Gnumeric.php index 275b770d..4ea57ba2 100644 --- a/Classes/PHPExcel/Reader/Gnumeric.php +++ b/Classes/PHPExcel/Reader/Gnumeric.php @@ -510,9 +510,12 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader if ((!$this->_readDataOnly) && (isset($sheet->Objects))) { foreach($sheet->Objects->children('gnm',TRUE) as $key => $comment) { $commentAttributes = $comment->attributes(); - $objPHPExcel->getActiveSheet()->getComment( (string)$commentAttributes->ObjectBound ) - ->setAuthor( (string)$commentAttributes->Author ) - ->setText($this->_parseRichText((string)$commentAttributes->Text) ); + // Only comment objects are handled at the moment + if ($commentAttributes->Text) { + $objPHPExcel->getActiveSheet()->getComment( (string)$commentAttributes->ObjectBound ) + ->setAuthor( (string)$commentAttributes->Author ) + ->setText($this->_parseRichText((string)$commentAttributes->Text) ); + } } } // echo '$maxCol=',$maxCol,'; $maxRow=',$maxRow,'
';