Autosize Column not Working

Jun 23, 2011 at 3:29 PM


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

CellRangeAddress region = new CellRangeAddress(5, 5, 0, 10);

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++)

But Autosizing column not working.

Please provide me solution as soon as possible.

Best Regards,


Jun 23, 2011 at 5: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.