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. Image for the cookie policy date
close icon

How to add text with a newline in it?

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

I am using

string myStr = "hellothere";
IRange.Text = myStr;

How can I make this work?

1 Reply

MW Melba Winshia Syncfusion Team December 21, 2006 10:54 AM UTC

Hi Daniel,

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

[C#]

// New Line
sheet.Range["A1"].Text = "HelloWorld";
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






Loader.
Live Chat Icon For mobile
Up arrow icon