You are here

protected function PHPExcel_ReferenceHelper::_adjustProtectedCells 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::_adjustProtectedCells()

* Update protected 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::_adjustProtectedCells()
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 300

Class

PHPExcel_ReferenceHelper
PHPExcel_ReferenceHelper (Singleton)

Code

protected function _adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) {
  $aProtectedCells = $pSheet
    ->getProtectedCells();
  $pNumCols > 0 || $pNumRows > 0 ? uksort($aProtectedCells, array(
    'PHPExcel_ReferenceHelper',
    'cellReverseSort',
  )) : uksort($aProtectedCells, array(
    'PHPExcel_ReferenceHelper',
    'cellSort',
  ));
  foreach ($aProtectedCells as $key => $value) {
    $newReference = $this
      ->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
    if ($key != $newReference) {
      $pSheet
        ->protectCells($newReference, $value, true);
      $pSheet
        ->unprotectCells($key);
    }
  }
}