I'm developing a Windows Form Application with C#, and I have already implemented Interop for Excel on it to create a worksheet with some data.
I can already create the excel document but when I open it, the size of the cells look like this:
I have already implemented some functions on the code to try to fix this problem:
char[] NosCharsToRemove = "\n".ToCharArray();
ExcelWorkSheet.Cells[row, col] = norm.comments.TrimStart(NosCharsToRemove);
Or,
ExcelWorkSheet.Cells[row, col] = norm.comments.TrimStart();
Or,
ExcelWorkSheet.Cells[row, col] = norm.comments.Replace(System.Environment.NewLine, "");
But no one has worked.
If I go to the Excel document and I tap double click in one of the "ugly" cells, and then, I focus another random cell, the "ugly cell" is fixed "magically".
Does anyone know how can I fix this problem programatically?
I will appreciate so much their help!