Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Fix Extra Table Row From Images and Charts #166

Merged
merged 2 commits into from
Apr 20, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions Classes/PHPExcel/Writer/HTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ public function generateSheetData() {

// calculate start of <tbody>, <thead>
$tbodyStart = $rowMin;
$tbodyEnd = $rowMax;
$theadStart = $theadEnd = 0; // default: no <thead> no </thead>
if ($sheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
$rowsToRepeatAtTop = $sheet->getPageSetup()->getRowsToRepeatAtTop();
Expand Down Expand Up @@ -441,14 +440,12 @@ public function generateSheetData() {
if ($row == $theadEnd) {
$html .= ' </thead>' . PHP_EOL;
}

// </tbody> ?
if ($row == $tbodyEnd) {
$html .= ' </tbody>' . PHP_EOL;
}
}
$html .= $this->_extendRowsForChartsAndImages($sheet, $row);

// Close table body.
$html .= ' </tbody>' . PHP_EOL;

// Write table footer
$html .= $this->_generateTableFooter();

Expand Down Expand Up @@ -520,9 +517,9 @@ private function _extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row)
$chartCol = PHPExcel_Cell::columnIndexFromString($chartTL[0]);
if ($chartTL[1] > $rowMax) {
$rowMax = $chartTL[1];
}
if ($chartCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
$colMax = $chartTL[0];
if ($chartCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
$colMax = $chartTL[0];
}
}
}
}
Expand All @@ -534,15 +531,15 @@ private function _extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row)
$imageCol = PHPExcel_Cell::columnIndexFromString($imageTL[0]);
if ($imageTL[1] > $rowMax) {
$rowMax = $imageTL[1];
}
if ($imageCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
$colMax = $imageTL[0];
if ($imageCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
$colMax = $imageTL[0];
}
}
}
}
$html = '';
$colMax++;
while ($row <= $rowMax) {
while ($row < $rowMax) {
$html .= '<tr>';
for ($col = 'A'; $col != $colMax; ++$col) {
$html .= '<td>';
Expand Down