本文整理汇总了PHP中PHPExcel_Worksheet::rebindParent方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Worksheet::rebindParent方法的具体用法?PHP PHPExcel_Worksheet::rebindParent怎么用?PHP PHPExcel_Worksheet::rebindParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Worksheet
的用法示例。
在下文中一共展示了PHPExcel_Worksheet::rebindParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addExternalSheet
/**
* Add external sheet
*
* @param PHPExcel_Worksheet $pSheet External sheet to add
* @throws Exception
*/
public function addExternalSheet(PHPExcel_Worksheet $pSheet) {
if (!is_null($this->getSheetByName($pSheet->getTitle()))) {
throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
}
$pSheet->rebindParent($this);
$this->addSheet($pSheet);
}
示例2: addExternalSheet
/**
* Add external sheet
*
* @param PHPExcel_Worksheet $pSheet External sheet to add
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet
*/
public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null)
{
if ($this->sheetNameExists($pSheet->getTitle())) {
throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
}
// count how many cellXfs there are in this workbook currently, we will need this below
$countCellXfs = count($this->cellXfCollection);
// copy all the shared cellXfs from the external workbook and append them to the current
foreach ($pSheet->getParent()->getCellXfCollection() as $cellXf) {
$this->addCellXf(clone $cellXf);
}
// move sheet to this workbook
$pSheet->rebindParent($this);
// update the cellXfs
foreach ($pSheet->getCellCollection(false) as $cellID) {
$cell = $pSheet->getCell($cellID);
$cell->setXfIndex($cell->getXfIndex() + $countCellXfs);
}
return $this->addSheet($pSheet, $iSheetIndex);
}
示例3: addExternalSheet
public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null)
{
if ($this->sheetNameExists($pSheet->getTitle())) {
throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
}
$countCellXfs = count($this->_cellXfCollection);
foreach ($pSheet->getParent()->getCellXfCollection() as $cellXf) {
$this->addCellXf(clone $cellXf);
}
$pSheet->rebindParent($this);
foreach ($pSheet->getCellCollection(false) as $cellID) {
$cell = $pSheet->getCell($cellID);
$cell->setXfIndex($cell->getXfIndex() + $countCellXfs);
}
return $this->addSheet($pSheet, $iSheetIndex);
}