Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi!
Thanks for the great module. The column widths for created xls files are all the default width. It is possible to add a function that automatically sets the optimal column width? With a Google search for "PHPExcel auto column width" I found this:
How to PHPExcel set auto-columns width
The final code that they used to automatically set optimal column widths was:
function autoFitColumnWidthToContent($sheet, $fromCol, $toCol) {
if (empty($toCol) ) {//not defined the last column, set it the max one
$toCol = $sheet->getColumnDimension($sheet->getHighestColumn())->getColumnIndex();
}
for($i = $fromCol; $i <= $toCol; $i++) {
$sheet->getColumnDimension($i)->setAutoSize(true);
}
$sheet->calculateColumnWidths();
}
I hope this idea for a new feature is helpful and will be seriously considered.
God Bless!
Frederick