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

Commit

Permalink
Merge pull request #166 from neclimdul/extra_html_writer_row
Browse files Browse the repository at this point in the history
Fix Extra Table Row From Images and Charts - Thanks
  • Loading branch information
Mark Baker committed Apr 20, 2013
2 parents db7b99a + 0a09b23 commit 2d3451d
Showing 1 changed file with 10 additions and 13 deletions.
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

0 comments on commit 2d3451d

Please sign in to comment.