Feature: Added basic support for cell comments in the OOCalc Reader

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@67188 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2011-01-21 14:36:28 +00:00
parent 2b4c15b92f
commit 9cc2f8d50b
2 changed files with 26 additions and 1 deletions

View File

@ -405,6 +405,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
// echo '<b>'.$columnID.$rowID.'</b><br />'; // echo '<b>'.$columnID.$rowID.'</b><br />';
$cellDataText = $cellData->children($namespacesContent['text']); $cellDataText = $cellData->children($namespacesContent['text']);
$cellDataOffice = $cellData->children($namespacesContent['office']);
$cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']); $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
$cellDataTableAttributes = $cellData->attributes($namespacesContent['table']); $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
@ -424,6 +425,22 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
$hasCalculatedValue = true; $hasCalculatedValue = true;
} }
if (isset($cellDataOffice->annotation)) {
// echo 'Cell has comment<br />';
$annotationText = $cellDataOffice->annotation->children($namespacesContent['text']);
$textArray = array();
foreach($annotationText as $t) {
foreach($t->span as $text) {
$textArray[] = (string)$text;
}
}
$text = implode("\n",$textArray);
// echo $text,'<br />';
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID )
// ->setAuthor( $author )
->setText($this->_parseRichText($text) );
}
if (isset($cellDataText->p)) { if (isset($cellDataText->p)) {
// echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />'; // echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
switch ($cellDataOfficeAttributes['value-type']) { switch ($cellDataOfficeAttributes['value-type']) {
@ -539,4 +556,12 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
return $objPHPExcel; return $objPHPExcel;
} }
private function _parseRichText($is = '') {
$value = new PHPExcel_RichText();
$value->createText($is);
return $value;
}
} }

View File

@ -33,7 +33,7 @@ Fixed in SVN:
- Feature: (MBaker) Added new rangeToArray() and namedRangeToArray() methods to the PHPExcel_Worksheet object. - Feature: (MBaker) Added new rangeToArray() and namedRangeToArray() methods to the PHPExcel_Worksheet object.
Functionally, these are identical to the toArray() method, except that they take an additional first parameter of a Range (e.g. 'B2:C3') or a Named Range name. Functionally, these are identical to the toArray() method, except that they take an additional first parameter of a Range (e.g. 'B2:C3') or a Named Range name.
Modified the toArray() method so that it actually uses rangeToArray(). Modified the toArray() method so that it actually uses rangeToArray().
- Feature: (MBaker) Added support for cell comments in the Gnumeric and Excel2003XML Readers - Feature: (MBaker) Added support for cell comments in the OOCalc, Gnumeric and Excel2003XML Readers
- Bugfix: (MBaker) Work item 14888 - Simple =IF() formula disappears - Bugfix: (MBaker) Work item 14888 - Simple =IF() formula disappears
- Bugfix: (MBaker) Work item 14898 - PHP Warning: preg_match(): Compilation failed: PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X - Bugfix: (MBaker) Work item 14898 - PHP Warning: preg_match(): Compilation failed: PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X
- Bugfix: (MBaker) Work item 14901 - VLOOKUP choking on parameters in PHPExcel.1.7.5/PHPExcel_Writer_Excel2007 - Bugfix: (MBaker) Work item 14901 - VLOOKUP choking on parameters in PHPExcel.1.7.5/PHPExcel_Writer_Excel2007