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

Free Support Forum - aspose.com

MailMerge with Line Break

I’ve seen lots of questions about line breaks, but I didn’t see my problem solved.


I have a text inside a DB where I would like to define the line break in the DB if possible.
(See pic routing.png)

Example text:
Routing No: 121100782, Account Name: Supertext USA, Inc.\nAccount No: 045180247

So I would like that there is a linkbreak after Inc. somehow, but I just get the \n in my PDF.

I’m using the standard mailmerge features in C#. Otherwise it works perfect. Any ideas on how to do that?

Hi Remy,


Thanks for your inquiry. Please replace “\n” with ControlChar.LineBreak as shown in following code example to get the desired output. Hope this helps you.

Document doc = new Document(MyDir + “in.docx”);<o:p></o:p>

doc.MailMerge.Execute(new string[] { "test" }, new object[] { @"121100782, Account Name: Supertext USA, Inc.\nAccount No: 045180247".Replace(@"\n", ControlChar.LineBreak) });

doc.Save(MyDir + "Out v16.11.0.pdf");

Cheers!

That worked like a charm!

Thanks a lot and merry Christmas.
Hi Remy,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

logic/trick still works