You are here

public function PHPExcel::setActiveSheetIndex in Loft Data Grids 6.2

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

Set active sheet index

Parameters

int $pIndex Active sheet index:

Return value

PHPExcel_Worksheet

Throws

PHPExcel_Exception

1 call to PHPExcel::setActiveSheetIndex()
PHPExcel::setActiveSheetIndexByName in vendor/phpoffice/phpexcel/Classes/PHPExcel.php
Set active sheet index by name

File

vendor/phpoffice/phpexcel/Classes/PHPExcel.php, line 683

Class

PHPExcel
PHPExcel

Code

public function setActiveSheetIndex($pIndex = 0) {
  $numSheets = count($this->_workSheetCollection);
  if ($pIndex > $numSheets - 1) {
    throw new PHPExcel_Exception("You tried to set a sheet active by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}.");
  }
  else {
    $this->_activeSheetIndex = $pIndex;
  }
  return $this
    ->getActiveSheet();
}