Skip to content

Commit 9926c64

Browse files
author
Dominik Bonsch
committed
added the requested index to the out of bounds exception
1 parent 756dfad commit 9926c64

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Classes/PHPExcel.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ public function sheetNameExists($pSheetName)
227227
public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL)
228228
{
229229
if ($this->sheetNameExists($pSheet->getTitle())) {
230-
throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first.");
230+
throw new PHPExcel_Exception(
231+
"Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first."
232+
);
231233
}
232234

233235
if($iSheetIndex === NULL) {
@@ -264,7 +266,9 @@ public function removeSheetByIndex($pIndex = 0)
264266
$numSheets = count($this->_workSheetCollection);
265267

266268
if ($pIndex > count($this->_workSheetCollection) - 1) {
267-
throw new PHPExcel_Exception("Sheet index is out of bounds. Actual number of sheets is {$numSheets}");
269+
throw new PHPExcel_Exception(
270+
"The requested Sheet index: {$pIndex} is out of bounds. Actual number of sheets is {$numSheets}"
271+
);
268272
} else {
269273
array_splice($this->_workSheetCollection, $pIndex, 1);
270274
}
@@ -289,7 +293,9 @@ public function getSheet($pIndex = 0)
289293
$numSheets = count($this->_workSheetCollection);
290294

291295
if ($pIndex > $numSheets - 1) {
292-
throw new PHPExcel_Exception("Sheet index is out of bounds. Actual number of sheets is {$numSheets}");
296+
throw new PHPExcel_Exception(
297+
"The requested Sheet index: {$pIndex} is out of bounds. Actual number of sheets is {$numSheets}"
298+
);
293299
} else {
294300
return $this->_workSheetCollection[$pIndex];
295301
}

0 commit comments

Comments
 (0)