Remove spurious worksheet created when instantiating the PHPExcel object, and only create sheets defined in the Excel2003XML file

This commit is contained in:
MarkBaker 2014-11-26 22:40:49 +00:00
parent e7cfdacf95
commit 9940b262c4

View File

@ -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;