You need to populate the Excel file with specific data. The width of the columns should be fixed, and the height of the row should increase depending on the text written in the cell. I'm trying to use the
AdjustToContents() method (of course after filling) for all lines, or only for a specific one, but nothing changes. Tried doing it before using the
Style.Alignment.WrapText = true method, also no result. Previously, this was done through the Interop library, but now it has become impossible. Any thoughts?
I came across a similar case. Auto-increasing the row height as the cell content grows stops working if the row height is set to some value – even if you specify
Row.SetHeight(Row.Height) (I don't remember the implementation details, but something like that). The bottom line was that as long as the line height is not set explicitly, when saving it is written as
null – in which case the auto-fit of the line height works as it should.
I reported this as a bug ( https://github.com/ClosedXML/ClosedXML/issues/352 ), and it looks like it should be fixed in version 0.89 (but I haven't checked it myself, unfortunately).