We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to add text with a newline in it?

Thread ID:

Created:

Updated:

Platform:

Replies:

53805 Dec 20,2006 11:33 AM Dec 21,2006 05:54 AM Windows Forms 1
loading
Tags: XlsIO
Daniel Chait
Asked On December 20, 2006 11:33 AM

If I set text in an excel workbook that has a newline in it, the resulting workbook just shows a square where the \n was in the source text.

I am using

string myStr = "hello\nthere";
IRange.Text = myStr;

How can I make this work?

Melba Winshia [Syncfusion]
Replied On December 21, 2006 05:54 AM

Hi Daniel,

Could you Please try using \n inserted at the place where you need the line break and set the WrapText property to true.

[C#]

// New Line
sheet.Range["A1"].Text = "Hello\nWorld";
sheet.Range["A1"].CellStyle.WrapText= true;

Here is the sample for your reference:
WrapText.zip


Please take a look at the sample above and let me know if you have any other questions.

Best Regards,
Melba






CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;