Home » excel » c# – Excel Cell Height Does Not Increase

c# – Excel Cell Height Does Not Increase

Posted by: admin April 23, 2020 Leave a comment


I’m using Microsoft.Office.Interop.Excel to write data into excel cell. The cell has a certain initial height and I’m setting both “merge cell = true” and “wrap text = true”.

When the cell content is large, the cell height is not increased. I tried both of the following:


This doesn’t work anything for me, please suggest some solution.

How to&Answers:

Try _range.Rows.Autofit();

Please note:
COM objects don’t get released with double periods. It created tempory variables, which you can’t access.

So rather use:

Range rows = _range.Rows;
if (rows != null)