We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Add new line or wrapping text in the cell

I am new to Aspose cells and I am using it with c#. For the life of me I can’t add a newline to a cell and I need it for a report I’m building. Does anyone know how to do this?


Thanks for considering Aspose.

Please use Cell.Style.IsTextWrapped to set it to true. May the following code help you for your need:

Sample code:

Workbook wb = new Workbook();
Worksheet ws = wb.Worksheets["Sheet1"];
Cells cell = ws.Cells;
cell.SetColumnWidth(0, 35);
cell[0, 0].PutValue("Voor meer informatie\nga naar de Informatiepagina op\nThis is the third line");
cell[0, 0].Style.IsTextWrapped = true;
wb.Save("f:\\test\\multilines.xls", FileFormatType.Excel2003);

Thank you.