From 500a8e763e8ba21fec99cdfd907ffcb7b6c655fd Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Wed, 8 Dec 2010 17:20:03 +0000 Subject: [PATCH] First steps toward reading cell comments git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@65027 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Reader/Excel5.php | 33 +++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Classes/PHPExcel/Reader/Excel5.php b/Classes/PHPExcel/Reader/Excel5.php index c1f9c1fc..0ff17e02 100644 --- a/Classes/PHPExcel/Reader/Excel5.php +++ b/Classes/PHPExcel/Reader/Excel5.php @@ -720,6 +720,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader case self::XLS_Type_SHEETLAYOUT: $this->_readSheetLayout(); break; case self::XLS_Type_SHEETPROTECTION: $this->_readSheetProtection(); break; case self::XLS_Type_RANGEPROTECTION: $this->_readRangeProtection(); break; + case self::XLS_Type_NOTE: $this->_readNote(); break; //case self::XLS_Type_IMDATA: $this->_readImData(); break; case self::XLS_Type_CONTINUE: $this->_readContinue(); break; case self::XLS_Type_EOF: $this->_readDefault(); break 2; @@ -744,7 +745,8 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader // treat OBJ records foreach ($this->_objs as $n => $obj) { - +// echo 'Object ID is ',$n,'
'; +// // the first shape container never has a corresponding OBJ record, hence $n + 1 $spContainer = $allSpContainers[$n + 1]; @@ -771,6 +773,11 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader switch ($obj['type']) { + case 0x19: + // Note +// echo 'Comment Object
'; + break; + case 0x08: // picture @@ -1277,6 +1284,30 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader $this->_pos += 4 + $length; } + private function _readNote() + { +// echo 'Read Note
'; + $length = self::_GetInt2d($this->_data, $this->_pos + 2); + $recordData = substr($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + if ($this->_readDataOnly || $this->_version != self::XLS_BIFF8) { + return; + } + +// hexDump($recordData); +// + $cellAddress = $this->_readBIFF8CellAddress(substr($recordData, 0, 4)); + $noteObjID = self::_GetInt2d($recordData, 6); + $noteAuthor = trim(substr($recordData, 8)); + +// echo 'Note Address=',$cellAddress,'
'; +// echo 'Note Object ID=',$noteObjID,'
'; +// echo 'Note Author=',$noteAuthor,'
'; + } + /** * Read BOF */