mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 21:36:05 +03:00
Still improving the out of bounds error messages in the exceptions.
This commit is contained in:
parent
9926c64314
commit
aadc933827
@ -267,7 +267,7 @@ class PHPExcel
|
|||||||
|
|
||||||
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
||||||
throw new PHPExcel_Exception(
|
throw new PHPExcel_Exception(
|
||||||
"The requested Sheet index: {$pIndex} is out of bounds. Actual number of sheets is {$numSheets}"
|
"Your requested sheet index: {$pIndex} is out of bounds. The actual number of sheets is {$numSheets}"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
array_splice($this->_workSheetCollection, $pIndex, 1);
|
array_splice($this->_workSheetCollection, $pIndex, 1);
|
||||||
@ -294,7 +294,7 @@ class PHPExcel
|
|||||||
|
|
||||||
if ($pIndex > $numSheets - 1) {
|
if ($pIndex > $numSheets - 1) {
|
||||||
throw new PHPExcel_Exception(
|
throw new PHPExcel_Exception(
|
||||||
"The requested Sheet index: {$pIndex} is out of bounds. Actual number of sheets is {$numSheets}"
|
"Your requested sheet index: {$pIndex} is out of bounds. The actual number of sheets is {$numSheets}"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return $this->_workSheetCollection[$pIndex];
|
return $this->_workSheetCollection[$pIndex];
|
||||||
@ -401,8 +401,12 @@ class PHPExcel
|
|||||||
*/
|
*/
|
||||||
public function setActiveSheetIndex($pIndex = 0)
|
public function setActiveSheetIndex($pIndex = 0)
|
||||||
{
|
{
|
||||||
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
$numSheets = count($this->_workSheetCollection);
|
||||||
throw new PHPExcel_Exception("Active sheet index is out of bounds.");
|
|
||||||
|
if ($pIndex > $numSheets - 1) {
|
||||||
|
throw new PHPExcel_Exception(
|
||||||
|
"You tried to set a sheet active by an out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}."
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->_activeSheetIndex = $pIndex;
|
$this->_activeSheetIndex = $pIndex;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user