Autosize Column not Working

Jun 23, 2011 at 2:29 PM

Hello,

I am using this code for merging cells in my project.

CellRangeAddress region = new CellRangeAddress(5, 5, 0, 10);
 oSheet.AddMergedRegion(region);

After creating all cells I want to autosize column for that I am writing below code.

 for (int l = 0; l < dt.Columns.Count; l++)
                oSheet.AutoSizeColumn(l);

But Autosizing column not working.

Please provide me solution as soon as possible.

Best Regards,

Saharsh

Jun 23, 2011 at 4:12 PM

I'm pretty sure Excel doesn't allow autosizing with merged cells.  You definitely can't (without macros) autosize row height if any of the row's cells are merged. 

What would autosizing merged columns entail?  How would excel know which column to adjust?  

Google around for Excel and merging cells and autosize.  The results are grim.