Only calculate column autosize for a cell if it contains data (#2167)
Only calculate column autosize for a cell if it contains data
This commit is contained in:
parent
d2076fefab
commit
6f88d1b54e
|
|
@ -757,6 +757,7 @@ class Worksheet implements IComparable
|
||||||
$this->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode()
|
$this->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($cellValue !== null && $cellValue !== '') {
|
||||||
$autoSizes[$this->cellCollection->getCurrentColumn()] = max(
|
$autoSizes[$this->cellCollection->getCurrentColumn()] = max(
|
||||||
(float) $autoSizes[$this->cellCollection->getCurrentColumn()],
|
(float) $autoSizes[$this->cellCollection->getCurrentColumn()],
|
||||||
(float) Shared\Font::calculateColumnWidth(
|
(float) Shared\Font::calculateColumnWidth(
|
||||||
|
|
@ -769,6 +770,7 @@ class Worksheet implements IComparable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// adjust column widths
|
// adjust column widths
|
||||||
foreach ($autoSizes as $columnIndex => $width) {
|
foreach ($autoSizes as $columnIndex => $width) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue