Merge pull request #166 from neclimdul/extra_html_writer_row

Fix Extra Table Row From Images and Charts - Thanks
This commit is contained in:
Mark Baker 2013-04-20 02:43:03 -07:00
commit 2d3451d95d
1 changed files with 10 additions and 13 deletions

View File

@ -394,7 +394,6 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
// calculate start of <tbody>, <thead> // calculate start of <tbody>, <thead>
$tbodyStart = $rowMin; $tbodyStart = $rowMin;
$tbodyEnd = $rowMax;
$theadStart = $theadEnd = 0; // default: no <thead> no </thead> $theadStart = $theadEnd = 0; // default: no <thead> no </thead>
if ($sheet->getPageSetup()->isRowsToRepeatAtTopSet()) { if ($sheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
$rowsToRepeatAtTop = $sheet->getPageSetup()->getRowsToRepeatAtTop(); $rowsToRepeatAtTop = $sheet->getPageSetup()->getRowsToRepeatAtTop();
@ -441,14 +440,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
if ($row == $theadEnd) { if ($row == $theadEnd) {
$html .= ' </thead>' . PHP_EOL; $html .= ' </thead>' . PHP_EOL;
} }
// </tbody> ?
if ($row == $tbodyEnd) {
$html .= ' </tbody>' . PHP_EOL;
}
} }
$html .= $this->_extendRowsForChartsAndImages($sheet, $row); $html .= $this->_extendRowsForChartsAndImages($sheet, $row);
// Close table body.
$html .= ' </tbody>' . PHP_EOL;
// Write table footer // Write table footer
$html .= $this->_generateTableFooter(); $html .= $this->_generateTableFooter();
@ -520,9 +517,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$chartCol = PHPExcel_Cell::columnIndexFromString($chartTL[0]); $chartCol = PHPExcel_Cell::columnIndexFromString($chartTL[0]);
if ($chartTL[1] > $rowMax) { if ($chartTL[1] > $rowMax) {
$rowMax = $chartTL[1]; $rowMax = $chartTL[1];
} if ($chartCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
if ($chartCol > PHPExcel_Cell::columnIndexFromString($colMax)) { $colMax = $chartTL[0];
$colMax = $chartTL[0]; }
} }
} }
} }
@ -534,15 +531,15 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$imageCol = PHPExcel_Cell::columnIndexFromString($imageTL[0]); $imageCol = PHPExcel_Cell::columnIndexFromString($imageTL[0]);
if ($imageTL[1] > $rowMax) { if ($imageTL[1] > $rowMax) {
$rowMax = $imageTL[1]; $rowMax = $imageTL[1];
} if ($imageCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
if ($imageCol > PHPExcel_Cell::columnIndexFromString($colMax)) { $colMax = $imageTL[0];
$colMax = $imageTL[0]; }
} }
} }
} }
$html = ''; $html = '';
$colMax++; $colMax++;
while ($row <= $rowMax) { while ($row < $rowMax) {
$html .= '<tr>'; $html .= '<tr>';
for ($col = 'A'; $col != $colMax; ++$col) { for ($col = 'A'; $col != $colMax; ++$col) {
$html .= '<td>'; $html .= '<td>';