Spire.XLS for .NET is a professional Excel .NET component that can be used to any type of .NET 2.0, 3.5, 4.0 or 4.5 framework application, both ASP.NET web sites and Windows Forms application.

Mon May 07, 2012 1:52 pm


I have a case where I would like to enter 2 lines in 1 single line in a cell.

This is supported by Excel if you hit ALT+ENTER

However, I cannot find how to generate that behavior with Spire...

So far I tried with \n and \r\n but it failed.

Any idea?


Posts: 1
Joined: Mon Mar 05, 2012 12:06 pm

Tue May 08, 2012 3:26 am

Hi slx,

You need to set the cell can wraptext, so please try the following codes:

sheet.Range["A1"].Text = "Hello\r\nWorld!";
sheet.Range["A1"].Style.WrapText = true;
Best regards

E-iceblue support
E-iceblue Co.,Ltd

Posts: 17
Joined: Tue Apr 24, 2012 4:53 am

Return to Spire.XLS