You are here

public function PHPExcel::setIndexByName in Loft Data Grids 6.2

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

Set index for sheet by sheet name.

Parameters

string $sheetName Sheet name to modify index for:

int $newIndex New index for the sheet:

Return value

New sheet index

Throws

PHPExcel_Exception

File

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

Class

PHPExcel
PHPExcel

Code

public function setIndexByName($sheetName, $newIndex) {
  $oldIndex = $this
    ->getIndex($this
    ->getSheetByName($sheetName));
  $pSheet = array_splice($this->_workSheetCollection, $oldIndex, 1);
  array_splice($this->_workSheetCollection, $newIndex, 0, $pSheet);
  return $newIndex;
}