1 year ago
#229909
Matthew Knill
PHPSpreadsheet setAutoSize function not working as expected
I am using PHPSpreadsheet and I'm doing the following to autosize the relevant columns:
foreach (range('A', 'K') as $col) {
$productsSheet->getColumnDimension($col)->setAutoSize(true);
}
The issue is, however, that extra padding is added.
The following is when I use autosize with using the setAutoSize
function:
And here it is after doing the autosize in Excel:
It becomes even more prominent for wider cells thus making the export far wider than it needs to be.
Is there anything that can be done about this, manually setting the width of each column is not acceptable for us as the content is highly variable.
php
phpexcel
phpspreadsheet
phpoffice-phpspreadsheet
0 Answers
Your Answer