Free Support Forum -

Preserve HTML formatting in a Merge Field

We currently use Aspose.words and Aspose.PDF to generate PDF documents from a word document containing merge fields. Previously, the data merge into these fields has been plain text, with (simple) formatting handled by the Word document/template structure.
We now have a requirement to insert HTML fragments into the document instead of plain text. Can you tell me:
1) Is this possible and will the HTML be rendered as text, rather than expose the HTML tages etc. ?
2) Will the formatting (font, bullets, tables, etc.) encoded by the HTM be preserved in the finished document ?

Thanks in advance.


Thank you for your interest in Aspose.Words.

1) I think that you should use MergeField event to achieve this. You can find example here.

2) Yes, formatting encoded by the HTM will be preserved in the finished document.

Best regards,