Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Auto-size column width
posted

Hi,

Is there any way of auto-sizing the column widths to the largest cell contents when generating a .xls file?

I previously used the COM Interop classes to generate excel files and there was a handy way of auto-sizing the column by calling cell.EntireColumn.AutoFit();

If there isn't a method for this functionality, is it easy enough to mirror this functionality by iterating through the rows and picking up the cell contents length and setting the column width?

Thanks in advance.

Parents
No Data
Reply Children
No Data