private function PHPExcel_Reader_Excel5::_readNote in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php \PHPExcel_Reader_Excel5::_readNote()
* The NOTE record specifies a comment associated with a particular cell. In Excel 95 (BIFF7) and earlier versions, * this record stores a note (cell note). This feature was significantly enhanced in Excel 97.
1 call to PHPExcel_Reader_Excel5::_readNote()
- PHPExcel_Reader_Excel5::load in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ Excel5.php - * Loads PHPExcel from file * *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ Excel5.php, line 1516
Class
- PHPExcel_Reader_Excel5
- PHPExcel_Reader_Excel5
Code
private function _readNote() {
// echo '<b>Read Cell Annotation</b><br />';
$length = self::_GetInt2d($this->_data, $this->_pos + 2);
$recordData = $this
->_readRecordData($this->_data, $this->_pos + 4, $length);
// move stream pointer to next record
$this->_pos += 4 + $length;
if ($this->_readDataOnly) {
return;
}
$cellAddress = $this
->_readBIFF8CellAddress(substr($recordData, 0, 4));
if ($this->_version == self::XLS_BIFF8) {
$noteObjID = self::_GetInt2d($recordData, 6);
$noteAuthor = self::_readUnicodeStringLong(substr($recordData, 8));
$noteAuthor = $noteAuthor['value'];
// echo 'Note Address=',$cellAddress,'<br />';
// echo 'Note Object ID=',$noteObjID,'<br />';
// echo 'Note Author=',$noteAuthor,'<hr />';
//
$this->_cellNotes[$noteObjID] = array(
'cellRef' => $cellAddress,
'objectID' => $noteObjID,
'author' => $noteAuthor,
);
}
else {
$extension = false;
if ($cellAddress == '$B$65536') {
// If the address row is -1 and the column is 0, (which translates as $B$65536) then this is a continuation
// note from the previous cell annotation. We're not yet handling this, so annotations longer than the
// max 2048 bytes will probably throw a wobbly.
$row = self::_GetInt2d($recordData, 0);
$extension = true;
$cellAddress = array_pop(array_keys($this->_phpSheet
->getComments()));
}
// echo 'Note Address=',$cellAddress,'<br />';
$cellAddress = str_replace('$', '', $cellAddress);
$noteLength = self::_GetInt2d($recordData, 4);
$noteText = trim(substr($recordData, 6));
// echo 'Note Length=',$noteLength,'<br />';
// echo 'Note Text=',$noteText,'<br />';
if ($extension) {
// Concatenate this extension with the currently set comment for the cell
$comment = $this->_phpSheet
->getComment($cellAddress);
$commentText = $comment
->getText()
->getPlainText();
$comment
->setText($this
->_parseRichText($commentText . $noteText));
}
else {
// Set comment for the cell
$this->_phpSheet
->getComment($cellAddress)
->setText($this
->_parseRichText($noteText));
}
}
}