You are here

public function PHPExcel_Worksheet::removeRow 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::removeRow()

Delete a row, updating all possible related data

Parameters

int $pRow Remove starting with this one:

int $pNumRows Number of rows to remove:

Return value

PHPExcel_Worksheet

Throws

PHPExcel_Exception

File

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

Class

PHPExcel_Worksheet
PHPExcel_Worksheet

Code

public function removeRow($pRow = 1, $pNumRows = 1) {
  if ($pRow >= 1) {
    $highestRow = $this
      ->getHighestDataRow();
    $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
    $objReferenceHelper
      ->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this);
    for ($r = 0; $r < $pNumRows; ++$r) {
      $this
        ->getCellCacheController()
        ->removeRow($highestRow);
      --$highestRow;
    }
  }
  else {
    throw new PHPExcel_Exception("Rows to be deleted should at least start from row 1.");
  }
  return $this;
}