I'm creating a spreadsheet in C# using EPPlus, and some of the cells contain multiline text, with the lines separated by carriage returns. When I open the newly created spreadsheet in Excel, the default row height means that I can only see the first line of text in these cells, e.g.:
After editing that cell (even if I don't actually change anything), Excel automatically adjusts the row height so that the cell can now be seen in full. Note I've added green dots to show where the carriage returns are:
Is there any way to set the row height using EPPlus, so that it looks like the second image when the spreadsheet is first opened in Excel?
Note that I'm also auto-fitting the columns using worksheet.Cells.AutoFitColumns(0);, if that is relevant to the problem.
Edit: I've just made a change whereby I find the cell with the most carriage returns in each row, then multiply the row's height by cell_cr_count + 1. Here, the row height now looks "correct" when I first open the spreadsheet, but weirdly it still only displays the first line of text (until I edit the cell, as before):
Starting to think this is an Excel quirk, and not something that can be fixed using EPPlus?


