- Bugfix: Work item 18425 - Problems with $_activeSheetIndex when decreased below 0.

This commit is contained in:
Mark Baker 2012-09-04 12:46:30 +01:00
parent 13f227c4f2
commit a376606bd2
2 changed files with 6 additions and 2 deletions

View File

@ -198,7 +198,7 @@ class PHPExcel
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
* @throws Exception * @throws Exception
*/ */
public function createSheet($iSheetIndex = null) public function createSheet($iSheetIndex = NULL)
{ {
$newSheet = new PHPExcel_Worksheet($this); $newSheet = new PHPExcel_Worksheet($this);
$this->addSheet($newSheet, $iSheetIndex); $this->addSheet($newSheet, $iSheetIndex);
@ -224,13 +224,16 @@ class PHPExcel
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
* @throws Exception * @throws Exception
*/ */
public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL)
{ {
if ($this->sheetNameExists($pSheet->getTitle())) { if ($this->sheetNameExists($pSheet->getTitle())) {
throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first."); throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first.");
} }
if($iSheetIndex === NULL) { if($iSheetIndex === NULL) {
if ($this->_activeSheetIndex < 0) {
$this->_activeSheetIndex = 0;
}
$this->_workSheetCollection[] = $pSheet; $this->_workSheetCollection[] = $pSheet;
} else { } else {
// Insert the sheet at the requested index // Insert the sheet at the requested index

View File

@ -108,6 +108,7 @@ Fixed in develop branch:
- Bugfix: (wolf5x) Work item 18492 - load file failed if the file has no extensionType - Bugfix: (wolf5x) Work item 18492 - load file failed if the file has no extensionType
- Bugfix: (dverspui) Pattern fill colours in Excel2007 Style Writer - Bugfix: (dverspui) Pattern fill colours in Excel2007 Style Writer
- Bugfix: (MBaker) Excel2007 Writer order of font style elements to conform with Excel2003 using compatibility pack - Bugfix: (MBaker) Excel2007 Writer order of font style elements to conform with Excel2003 using compatibility pack
- Bugfix: (MBaker) Work item 18425 - Problems with $_activeSheetIndex when decreased below 0.
2012-05-19 (v1.7.7): 2012-05-19 (v1.7.7):