various improvements

This commit is contained in:
Adrien Loison committed 2017-11-19 02:41:07 +01:00
1 parent 102e17159c
commit 4d1d1c1e87
19 files changed
+90 -112

No files matched your search

+8
View File
@@ -81,4 +81,12 @@ class Row
return $this;
}
/**
* @return int
*/
public function getNumCells()
{
return count($this->cells);
}
}
@@ -259,7 +259,7 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
// update max num columns for the worksheet
$currentMaxNumColumns = $worksheet->getMaxNumColumns();
$cellsCount = count($row->getCells());
$cellsCount = $row->getNumCells();
$worksheet->setMaxNumColumns(max($currentMaxNumColumns, $cellsCount));
}
@@ -111,7 +111,6 @@ class WorksheetManager implements WorksheetManagerInterface
public function addRow(Worksheet $worksheet, Row $row)
{
$cells = $row->getCells();
$cellsCount = count($cells);
$rowStyle = $row->getStyle();
$data = '<table:table-row table:style-name="ro1">';
@@ -119,7 +118,7 @@ class WorksheetManager implements WorksheetManagerInterface
$currentCellIndex = 0;
$nextCellIndex = 1;
for ($i = 0; $i < $cellsCount; $i++) {
for ($i = 0; $i < $row->getNumCells(); $i++) {
/** @var Cell $cell */
$cell = $cells[$currentCellIndex];
/** @var Cell|null $nextCell */
@@ -156,7 +156,7 @@ EOD;
$cellIndex = 0;
$rowStyle = $row->getStyle();
$rowIndex = $worksheet->getLastWrittenRowIndex() + 1;
$numCells = count($row->getCells());
$numCells = $row->getNumCells();
$rowXML = '<row r="' . $rowIndex . '" spans="1:' . $numCells . '">';