diff --git a/Classes/PHPExcel/ReferenceHelper.php b/Classes/PHPExcel/ReferenceHelper.php index 98819b2e..4ccc2b59 100644 --- a/Classes/PHPExcel/ReferenceHelper.php +++ b/Classes/PHPExcel/ReferenceHelper.php @@ -259,6 +259,14 @@ class PHPExcel_ReferenceHelper } } + // Update worksheet: comments + $aComments = $pSheet->getComments(); + $aNewComments = array(); // the new array of all comments + foreach ($aComments as $key => &$value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + $aNewComments[$newReference] = $value; + } + $pSheet->setComments($aNewComments); // replace the comments array // Update worksheet: hyperlinks $aHyperlinkCollection = array_reverse($pSheet->getHyperlinkCollection(), true); diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index 1eed5ced..70ac3801 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -1941,6 +1941,19 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable return $this->_comments; } + /** + * Set comments array for the entire sheet. + * + * @param array of PHPExcel_Comment + * @return PHPExcel_Worksheet + */ + public function setComments($pValue = array()) + { + $this->_comments = $pValue; + + return $this; + } + /** * Get comment for cell * diff --git a/changelog.txt b/changelog.txt index 5bdd44ad..5a90160f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -67,6 +67,7 @@ Fixed in SVN: - Bugfix: (MBaker) Work item 15379 - Named ranges with dot don't get parsed properly - Bugfix: (MBaker) Work item 15096 - insertNewRowBefore fails to consistently update references - Bugfix: (MBaker) "i" is not a valid character for Excel date format masks (in isDateTimeFormatCode() method) +- Bugfix: (MKunert) Work item 15421 - PHPExcel_ReferenceHelper::insertNewBefore() is missing an 'Update worksheet: comments' section - General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer. - General: (MBaker) Improved performance (speed), for PHP to Excel date conversions - General: (MBaker) Enhanced SheetViews element structures in the Excel2007 Writer for frozen panes.