Excel export autofit column width
Is there any way to autofit column width to contain all column data on excel export? I tried with
setShouldWrapText()
and setShouldShrinkToFit()
with no luck.13 Replies
Nothing?
we dont control excel output, its a separate package
Thanks. So maybe I should use laravel-export by spartner
So have you done the getXlsxCellStyle() or getXlsxHeaderCellStyle() in the exporter class with openspout?
is that where you added setShouldWrapText() and setShouldShrinkToFit() ?
Yes. If setShouldWrapText() is set tu true, this happens:
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1239894475153870958/image.png)
But I would like this
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1239894587657551984/image.png)
Something like
setAutoFitText()
i dont think there is an option in openspout, but there is an option to increase the width based on a fixed number
Maybe setting page setup? There is an option
fitToWidth
but i dont know if that is what im searching for
https://github.com/openspout/openspout/blob/4.x/docs/documentation.md#page-setupGitHub
openspout/docs/documentation.md at 4.x · openspout/openspout
Read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way - openspout/openspout
@Rome did you solve it?
I did not. Right now I'm doing it manually on the excel.
Not working 😦