Feature: Added support for cell comments in the Gnumeric and Excel2003XML Readers

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@67186 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker
2011-01-21 13:11:28 +00:00
parent 5a2830c499
commit 2b4c15b92f
6 changed files with 255 additions and 175 deletions
+17
View File
@@ -406,6 +406,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
if (isset($sheet->PrintInformation->Margins)) {
foreach($sheet->PrintInformation->Margins->children('gnm',TRUE) as $key => $margin) {
$marginAttributes = $margin->attributes();
$marginSize = 72 / 100; // Default
switch($marginAttributes['PrefUnit']) {
case 'mm' :
$marginSize = intval($marginAttributes['Points']) / 100;
@@ -506,6 +507,14 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
$objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell,$type);
}
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) );
}
}
// echo '$maxCol=',$maxCol,'; $maxRow=',$maxRow,'<br />';
//
foreach($sheet->Styles->StyleRegion as $styleRegion) {
@@ -867,6 +876,14 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
return $styleArray;
}
private function _parseRichText($is = '') {
$value = new PHPExcel_RichText();
$value->createText($is);
return $value;
}
private static function _parseGnumericColour($gnmColour) {
list($gnmR,$gnmG,$gnmB) = explode(':',$gnmColour);
$gnmR = substr(str_pad($gnmR,4,'0',STR_PAD_RIGHT),0,2);