Free Support Forum - aspose.com

RTF merge field with RTF tag

Hi,

I tried to add rtf tag such as "\line " and "\bullet " in the data of merge field and it looks like aspose does not interpret them as rtf tag. Is there a way to do it?

Thanks,

Hi Jiebo,

Thanks for your inquiry.

There is no way to insert a fragment of RTF directly. The closest thing to doing this is to set up a mail merge handler as described in the API here and then insert a RTF document using the InsertDocument method.

What do you need this functionality for? We may be able to provide some other suggestions.

Thanks,

Hi, we collect merge fields from UI. User may type in two lines of text in one merge field and we need to add line break in that case, and sometimes use copy a paragraphy with bullets and we need to make sure these bullets show up in the merged document.

Thank you!

Hi Jiebo,

Thanks for the additional information.

You may need to replace a part of the the text string being merged into the document that acts as the new line character with the appropriate ControlChar which are listed here.

Regarding bullet points, the formatting of the string which describes these bullet points may depend on how you are gathering the text in your UI. Could you please post a screenshot here of how the string looks like in memory during debugging before it is merged into the document.

Thanks,

Hi, when user copy a paragrahy from a word document, bullets are copied as ascii code 149, I replace it with "\bullet " and it works fine with RTFTemplate. (http://rtftemplate.sourceforge.net/). Same idea for line break. Can I do something similar with aspose words?

Thanks.

Hi Jiebo,

You should just be able to insert the text straight into the document using Aspose.Words without the need to replace it with any RTF tags.

Thanks,