You are here

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

* Update hyperlinks 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::_adjustHyperlinks()
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 228

Class

PHPExcel_ReferenceHelper
PHPExcel_ReferenceHelper (Singleton)

Code

protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) {
  $aHyperlinkCollection = $pSheet
    ->getHyperlinkCollection();
  $pNumCols > 0 || $pNumRows > 0 ? uksort($aHyperlinkCollection, array(
    'PHPExcel_ReferenceHelper',
    'cellReverseSort',
  )) : uksort($aHyperlinkCollection, array(
    'PHPExcel_ReferenceHelper',
    'cellSort',
  ));
  foreach ($aHyperlinkCollection as $key => $value) {
    $newReference = $this
      ->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
    if ($key != $newReference) {
      $pSheet
        ->setHyperlink($newReference, $value);
      $pSheet
        ->setHyperlink($key, null);
    }
  }
}