From 4ee1fe36e244fb9b2133012e93aa130040d1dafc Mon Sep 17 00:00:00 2001 From: Ron Cemer Date: Fri, 5 Nov 2021 19:34:58 -0500 Subject: [PATCH] Make column numbers 1-relative. --- src/Report.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Report.php b/src/Report.php index e1c82f1..061ec85 100644 --- a/src/Report.php +++ b/src/Report.php @@ -263,7 +263,7 @@ protected function outputHeading($forceNewPage = false) { $rowData = ''; $sep = ''; - $colNum = -1; + $colNum = 0; if ($this->outputter->outputFormat == 'html') { $this->ensureHTMLTableSection('thead'); @@ -496,7 +496,7 @@ public function outputRow(&$row) { $sep = ''; $rowData = ''; - $colNum = -1; + $colNum = 0; if ($this->outputter->outputFormat == 'html') { $this->ensureHTMLTableSection('tbody'); @@ -731,7 +731,6 @@ public function outputCustomRow( $sep = ''; $rowData = ''; - $colNum = -1; if ($this->outputter->outputFormat == 'html') { $this->ensureHTMLTableSection(($appearance == 'heading') ? 'thead' : 'tbody'); @@ -786,9 +785,9 @@ public function outputCustomRow( case 'xls': case 'xlsx': case 'ods': - $cell = $this->outputter->worksheet->getCellByColumnAndRow($ci, $this->outputter->worksheetRowNum); + $cell = $this->outputter->worksheet->getCellByColumnAndRow($ci+1, $this->outputter->worksheetRowNum); $cell->setValueExplicit($text, DataType::TYPE_STRING); - $style = $this->outputter->worksheet->getStyleByColumnAndRow($ci, $this->outputter->worksheetRowNum); + $style = $this->outputter->worksheet->getStyleByColumnAndRow($ci+1, $this->outputter->worksheetRowNum); $style->getAlignment()->setHorizontal($align); if (($appearance == 'heading') || ($appearance == 'totals')) { $style->getFont()->setBold(true); @@ -925,7 +924,7 @@ public function outputAndResetTotals($levelIdx) { $sep = ''; $rowData = ''; - $colNum = -1; + $colNum = 0; if ($this->outputter->outputFormat == 'html') { $this->ensureHTMLTableSection('tbody'); @@ -989,9 +988,9 @@ public function outputAndResetTotals($levelIdx) { $style->getFont()->setBold(true); if ($nTotDescCols > 1) { $this->outputter->worksheet->mergeCellsByColumnAndRow( - $colNum+1, + $colNum, $this->outputter->worksheetRowNum, - $colNum+1+($nTotDescCols-1), + $colNum+($nTotDescCols-1), $this->outputter->worksheetRowNum ); }