Bugfix: Work Item CP20604 - Adding Sheet to Workbook Bug

This commit is contained in:
Mark Baker 2014-01-08 10:15:07 +00:00
parent 992aee683a
commit 496b76e70a
3 changed files with 15 additions and 7 deletions

View File

@ -527,6 +527,11 @@ class PHPExcel
++$this->_activeSheetIndex;
}
}
if ($pSheet->getParent() === null) {
$pSheet->rebindParent($this);
}
return $pSheet;
}

View File

@ -794,6 +794,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @return PHPExcel_Worksheet
*/
public function rebindParent(PHPExcel $parent) {
if ($this->_parent !== null) {
$namedRanges = $this->_parent->getNamedRanges();
foreach ($namedRanges as $namedRange) {
$parent->addNamedRange($namedRange);
@ -802,6 +803,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
$this->_parent->removeSheetByIndex(
$this->_parent->getIndex($this)
);
}
$this->_parent = $parent;
return $this;

View File

@ -46,6 +46,7 @@ Fixed in develop branch for release v1.8.0:
- Bugfix: (Roy Shahbazian) Work Item GH-299 - Fixed typo in Chart/Layout set/getYMode()
- Bugfix: (EliuFlorez) Work item GH-279 - Fatal error: Call to a member function cellExists() line: 3327 in calculation.php if referenced worksheet doesn't exist
- Bugfix: (MBaker) Work Item GH-290 - AdvancedValueBinder "Division by zero"-error
- Bugfix: (MBaker) Work Item CP20604 - Adding Sheet to Workbook Bug
- Feature: (amerov) - Implementation of the Excel HLOOKUP() function
- Feature: (MBaker) - Added "Quote Prefix" to style settings (Excel2007 Reader and Writer only)
- Feature: (MBaker) - Added Horizontal FILL alignment for Excel5 and Excel2007 Readers/Writers, and Horizontal DISTRIBUTED alignment for Excel2007 Reader/Writer