Bugfix: Work item 15421 - PHPExcel_ReferenceHelper::insertNewBefore() is missing an 'Update worksheet: comments' section

Solution, courtesy of MKunert

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@69421 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2011-02-25 22:57:22 +00:00
parent 901d20e6f9
commit 45fb4d84c1
3 changed files with 22 additions and 0 deletions

View File

@ -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);

View File

@ -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
*

View File

@ -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.