Spire.XLS for .NET is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) 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