I’m having some issues getting new lines and autofit row height to work. You can see from the output that rows 161 & 178 have autofit row height, but the new lines are not preserved. Try autofitting that row again and it will collapse back down to one line. Does Aspose.Cells support new lines (ALT-ENTER)? If so, how do I use the PutValue() method to do so? If I’m doing everything right, why is there extra space in those rows and why aren’t the new lines preserved?
Thanks for your posting and using Aspose.Cells.
We are pleased to let you know that Aspose.Cells now supports the new line (ALT-ENTER) text.
Please see the following sample code that illustrates this feature. It creates two line text inside cell A1.
You need to set the Style.IsTextWrapped property to true to make it take effect.
I have attached the output xlsx file generated by the code and screenshot for your reference. Please download and use the latest version: Aspose.Cells for .NET 7.3.4.
If you have any other question, please feel free to ask, we will help you asap.
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets;
Cell cell = worksheet.Cells[“A1”];
cell.PutValue(“This is a some text.\r\nThis is a new line.”);
Style style = cell.GetStyle();
style.IsTextWrapped = true;