Copy link to clipboard
Copied
I am using CFSpreadsheet(write) to create an Excel file. Using SPREADSHEETFORMATROW, I didn't see any attributes to set the cell size(Length or width). Any way to format the cell size for the entire file.
Thanks
As far as I know you need to do it for each column. But you can write
a wrapper function to set the widths something that could be called
like this setSpreadsheetColumnWidths(spreadsheet, "10,10,20,30,,10")
--
Mack
Copy link to clipboard
Copied
Wow. I had a look at this thinking "well surely it's just a matter of... well... OK that doesn't work, but one must be able to... or.. aha!... no. Damn". So probably much the same investigation you did.
I'm pretty sure CF's implementation of XLS support is based on POI, and POI has a setColumnWith() method, but the object that CF exposes as a worksheet is not actually a POI object but some CF wrapper of it, so the method doesn't work.
If it is as it seems, and CF doesn't support this sort of thing... wow, what a fvck up. Setting column width is not exactly an edge case!
Hopefully we're both wrong.
Maybe ignore CF and use POI for this directly?
--
Adam
Copy link to clipboard
Copied
Unless I'm mistaken, SpreadsheetSetColumnWidth should help you.
--
Mack
Copy link to clipboard
Copied
Hahaha: oops.
What makes it worse, is I actually checked the docs for that.
Groan.
I'd say "well spotted" if it wasn't so painfully obvious.
--
Adam
Copy link to clipboard
Copied
Thanks. This is helpful, but I wanted to set
the width for the entire workbook. Is their another function to
do that, or do I have to set each individual column.
Copy link to clipboard
Copied
As far as I know you need to do it for each column. But you can write
a wrapper function to set the widths something that could be called
like this setSpreadsheetColumnWidths(spreadsheet, "10,10,20,30,,10")
--
Mack
Copy link to clipboard
Copied
Thanks for the help.