Problems with AutoFit

Hi there. I am trying to AutoFit rows so that when the user opens the Excel file, the row height is auto adjusted so that all of the text is shown in a single cell. Here is some example text:

Name / 1001 / Data
Name / 12 / ISIN
Name / 10 / ISIN

The above 3 lines are output in the same cell. I have the carriage return "\n" separating each line above. Here is what API Mate is showing me when I open the file:

xls.SetCellValue(4, 30, "Name / 1001 / Data\nName / 12 / ISIN\nName / 10 / ISIN\n");

I have tried various methods relating to autofit but when I open the file all of the 3 lines of text above are shown on a single row and stretching across the adjacent cells.

Here are some of the methods I have tried:
excelFile.MarkRowForAutofit(rowCounter, true, 1);
excelFile.AutofitRow(rowCounter, true, 1 );
excelFile.AutofitRow(rowCounter, false, 1 );
excelFile.AutofitMarkedRowsAndCols(true, false, 1);
excelFile.AutofitRowsOnWorkbook(true, true, 1);

It just dawned on me to try to set WrapText = true on the format for the cell and this resolved the issue. If this isn't the "proper" fix for this please let me know. Thanks!

Indeed, for the cell to show multiple lines (even if you have \n in the text), the cell must be WrapText = true.  (and it must not be merged, as Excel won't autofit merged cells).

If all you care is the file showing fine when you open it in Excel, you don't need to call Autofit at all in FlexCel. When you open the file in Excel, Excel will autofit it. FlexCel autofit is needed only if you want to directly export to pdf or print preview for example. But Excel will always autofit the files when it opens them, so there is no real need to do a FlexCel autofit first.