From 9940b262c475f21db2e0705f02111a25c505bafd Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Wed, 26 Nov 2014 22:40:49 +0000 Subject: [PATCH] Remove spurious worksheet created when instantiating the PHPExcel object, and only create sheets defined in the Excel2003XML file --- Classes/PHPExcel/Reader/Excel2003XML.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Classes/PHPExcel/Reader/Excel2003XML.php b/Classes/PHPExcel/Reader/Excel2003XML.php index dbb196d..e8abeb4 100644 --- a/Classes/PHPExcel/Reader/Excel2003XML.php +++ b/Classes/PHPExcel/Reader/Excel2003XML.php @@ -232,6 +232,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P { // Create new PHPExcel $objPHPExcel = new PHPExcel(); + $objPHPExcel->removeSheetByIndex(0); // Load into this instance return $this->loadIntoExisting($pFilename, $objPHPExcel); @@ -576,6 +577,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P $rowID = 1; if (isset($worksheet->Table->Row)) { + $additionalMergedCells = 0; foreach($worksheet->Table->Row as $rowData) { $rowHasData = false; $row_ss = $rowData->attributes($namespaces['ss']); @@ -599,11 +601,10 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P } } - $additionalMergedCells = 0; if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) { $columnTo = $columnID; if (isset($cell_ss['MergeAcross'])) { - $additionalMergedCells = (int)$cell_ss['MergeAcross']; + $additionalMergedCells += (int)$cell_ss['MergeAcross']; $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1); } $rowTo = $rowID;