Additional minor tweaks to HTML reader for merged cells

This commit is contained in:
MarkBaker 2014-12-07 23:45:15 +00:00
parent d7ea3e2ab0
commit 180ad168cb
1 changed files with 4 additions and 1 deletions

View File

@ -403,8 +403,8 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
} }
} }
//create merging rowspan
if (isset($attributeArray['rowspan']) && isset($attributeArray['colspan'])) { if (isset($attributeArray['rowspan']) && isset($attributeArray['colspan'])) {
//create merging rowspan and colspan
$columnTo = $column; $columnTo = $column;
for ($i = 0; $i < $attributeArray['colspan'] - 1; $i++) { for ($i = 0; $i < $attributeArray['colspan'] - 1; $i++) {
++$columnTo; ++$columnTo;
@ -414,13 +414,16 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
$this->rowspan[$value] = true; $this->rowspan[$value] = true;
} }
$sheet->mergeCells($range); $sheet->mergeCells($range);
$column = $columnTo;
} elseif (isset($attributeArray['rowspan'])) { } elseif (isset($attributeArray['rowspan'])) {
//create merging rowspan
$range = $column . $row . ':' . $column . ($row + $attributeArray['rowspan'] - 1); $range = $column . $row . ':' . $column . ($row + $attributeArray['rowspan'] - 1);
foreach (\PHPExcel_Cell::extractAllCellReferencesInRange($range) as $value) { foreach (\PHPExcel_Cell::extractAllCellReferencesInRange($range) as $value) {
$this->rowspan[$value] = true; $this->rowspan[$value] = true;
} }
$sheet->mergeCells($range); $sheet->mergeCells($range);
} elseif (isset($attributeArray['colspan'])) { } elseif (isset($attributeArray['colspan'])) {
//create merging colspan
$columnTo = $column; $columnTo = $column;
for ($i = 0; $i < $attributeArray['colspan'] - 1; $i++) { for ($i = 0; $i < $attributeArray['colspan'] - 1; $i++) {
++$columnTo; ++$columnTo;