Search code examples
c#itextmailmerge

iText - how to do search/replace on existing RTF document


Currently I'm working on a simple Mail-Merge module.

I need to load plain *.RTF template, then replace all words enclosed in [[field]] tags and at the end and print them out.

I found the iText library which is free and capable of loading/saving pdfs and rtf. I managed to load rtf, merge a few copies to one huge doc but I have no idea how to replace [[field]] by custom data like customer name/address.

Is that feature present, and if yes - how to do it? The solution platform is c#/.NET


Solution

  • Finally I decided to use *.docx and "Open XML SDK 2.0 for Microsoft Office" .NET strongly typed wrapper.