How to auto-fit a row whose customHeight is not set in Excel worksheet in .NET

Hello,

we would like to mimic Excels behaviour with regards to row autofitting when setting a cell value. Excel autofits a row when a textWrap property is enabled AND when customHeight on a row is not set. We didn’t find a way to read that customHeight property via Aspose Cells. Is that somehow possible? If not then would you consider adding it?

Best regards,
Konrad

@konradglayer,

While auto-fitting row(s), please try the method overload (see the onlyAuto parameter to set to “true”).

If you still have any issue or have queries, let us know with details. We will check it soon.

That would almost solve the problem, but we don’t want to auto-fit all the rows, just specific ones. And I didn’t find a method for single row auto-fitting with onlyAuto parameter.

@konradglayer,

That is easy, you may try to use this overload of Worksheet.AutoFitRows. Here both startRow and endRow would be same and initialize AutoFitterOptions options (set “OnlyAuto” property to true). That’s it.

Hope, this helps a bit.

Yup, it gets the job done. Thanks for your help.

@konradglayer,

Good to know that the suggested overloaded method works for your needs. Feel free to write us back if you need further help or have some other issue or queries, we will be happy to assist you soon.