You are here

protected function PHPExcel_ReferenceHelper::_adjustMergeCells in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/ReferenceHelper.php \PHPExcel_ReferenceHelper::_adjustMergeCells()

* Update merged cells when inserting/deleting rows/columns * *

Parameters

PHPExcel_Worksheet $pSheet The worksheet that we're editing: * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) * @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)

1 call to PHPExcel_ReferenceHelper::_adjustMergeCells()
PHPExcel_ReferenceHelper::insertNewBefore in vendor/phpoffice/phpexcel/Classes/PHPExcel/ReferenceHelper.php
* Insert a new column or row, updating all possible related data * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/ReferenceHelper.php, line 279

Class

PHPExcel_ReferenceHelper
PHPExcel_ReferenceHelper (Singleton)

Code

protected function _adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) {
  $aMergeCells = $pSheet
    ->getMergeCells();
  $aNewMergeCells = array();

  // the new array of all merge cells
  foreach ($aMergeCells as $key => &$value) {
    $newReference = $this
      ->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
    $aNewMergeCells[$newReference] = $newReference;
  }
  $pSheet
    ->setMergeCells($aNewMergeCells);

  // replace the merge cells array
}