/** * Re-bind parent * * @param PHPExcel $parent * @return PHPExcel_Worksheet */ public function rebindParent(PHPExcel $parent) { if ($this->_parent !== null) { $namedRanges = $this->_parent->getNamedRanges(); foreach ($namedRanges as $namedRange) { $parent->addNamedRange($namedRange); } $this->_parent->removeSheetByIndex($this->_parent->getIndex($this)); } $this->_parent = $parent; return $this; }
/** * Write named ranges * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel * @throws PHPExcel_Writer_Exception */ private function _writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel) { // Loop named ranges $namedRanges = $pPHPExcel->getNamedRanges(); foreach ($namedRanges as $namedRange) { $this->_writeDefinedNameForNamedRange($objWriter, $namedRange); } }