allow PHP 8.3 (#4471)

Fix use of range() and auto-width columns for Excel exports
This commit is contained in:
Kevin Papst
2023-12-01 22:40:02 +01:00
committed by GitHub
parent 8fd2e7029e
commit e0769bc3dc
6 changed files with 54 additions and 54 deletions

View File

@@ -66,12 +66,11 @@ class XlsxRenderer extends AbstractSpreadsheetRenderer
// Freeze first row and date & time columns for easier navigation
$sheet->freezePane('D2');
/** @var string $column */
foreach (range('A', $highestColumn) as $column) {
foreach ($sheet->getColumnIterator() as $columnName => $column) {
// We default to a reasonable auto-width decided by the client,
// sadly ->getDefaultColumnDimension() is not supported so it needs
// to be specific about what column should be auto sized.
$col = $sheet->getColumnDimension($column);
$col = $sheet->getColumnDimension($columnName);
// If no other width is specified (which defaults to -1)
if ((int) $col->getWidth() === -1) {

View File

@@ -59,12 +59,11 @@ final class XlsxWriter implements WriterInterface
$sheet->freezePane($options['freeze']);
}
/** @var string $column */
foreach (range('A', $highestColumn) as $column) {
foreach ($sheet->getColumnIterator() as $columnName => $column) {
// We default to a reasonable auto-width decided by the client,
// sadly ->getDefaultColumnDimension() is not supported so it needs
// to be specific about what column should be auto sized.
$col = $sheet->getColumnDimension($column);
$col = $sheet->getColumnDimension($columnName);
// If no other width is specified (which defaults to -1)
if ((int) $col->getWidth() === -1) {