You are here

public function PHPExcel_Worksheet::removeColumn in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php \PHPExcel_Worksheet::removeColumn()

Remove a column, updating all possible related data

Parameters

string $pColumn Remove starting with this one:

int $pNumCols Number of columns to remove:

Return value

PHPExcel_Worksheet

Throws

PHPExcel_Exception

1 call to PHPExcel_Worksheet::removeColumn()
PHPExcel_Worksheet::removeColumnByIndex in vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php
Remove a column, updating all possible related data

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php, line 2088

Class

PHPExcel_Worksheet
PHPExcel_Worksheet

Code

public function removeColumn($pColumn = 'A', $pNumCols = 1) {
  if (!is_numeric($pColumn)) {
    $highestColumn = $this
      ->getHighestDataColumn();
    $pColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols);
    $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
    $objReferenceHelper
      ->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this);
    for ($c = 0; $c < $pNumCols; ++$c) {
      $this
        ->getCellCacheController()
        ->removeColumn($highestColumn);
      $highestColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($highestColumn) - 2);
    }
  }
  else {
    throw new PHPExcel_Exception("Column references should not be numeric.");
  }
  return $this;
}