mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 13:26:07 +03:00
added the requested index to the out of bounds exception
This commit is contained in:
parent
756dfad85a
commit
9926c64314
@ -227,7 +227,9 @@ class PHPExcel
|
||||
public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL)
|
||||
{
|
||||
if ($this->sheetNameExists($pSheet->getTitle())) {
|
||||
throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first.");
|
||||
throw new PHPExcel_Exception(
|
||||
"Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first."
|
||||
);
|
||||
}
|
||||
|
||||
if($iSheetIndex === NULL) {
|
||||
@ -264,7 +266,9 @@ class PHPExcel
|
||||
$numSheets = count($this->_workSheetCollection);
|
||||
|
||||
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
||||
throw new PHPExcel_Exception("Sheet index is out of bounds. Actual number of sheets is {$numSheets}");
|
||||
throw new PHPExcel_Exception(
|
||||
"The requested Sheet index: {$pIndex} is out of bounds. Actual number of sheets is {$numSheets}"
|
||||
);
|
||||
} else {
|
||||
array_splice($this->_workSheetCollection, $pIndex, 1);
|
||||
}
|
||||
@ -289,7 +293,9 @@ class PHPExcel
|
||||
$numSheets = count($this->_workSheetCollection);
|
||||
|
||||
if ($pIndex > $numSheets - 1) {
|
||||
throw new PHPExcel_Exception("Sheet index is out of bounds. Actual number of sheets is {$numSheets}");
|
||||
throw new PHPExcel_Exception(
|
||||
"The requested Sheet index: {$pIndex} is out of bounds. Actual number of sheets is {$numSheets}"
|
||||
);
|
||||
} else {
|
||||
return $this->_workSheetCollection[$pIndex];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user