Starting in 9.1, WordTemplate has the ability to embed well-formed HTML snippets into DOCX files. 

Template

The merge field that corresponds to the HTML snippet data must use the HTMLSnippet modifier. 

For more information on merge field modifiers, please see Creating Merge Fields

Data

The HTMLSnippet modifier takes a string of well-formed HTML. An exception will be thrown if: 

Remarks

The current version of the HTMLSnippet modifier does not convert the HTML into true Word formatting. It embeds an HTML document that contains the HTML snippet. This means that some applications may not be able to render the document completely. For example, when viewing a document with the Outlook document preview, the HTML may not be rendered correctly. 

Documents that are merged using the Document(docx) modifier can contain HTML segments that are inserted using the HTMLSnippet modifier. However, if the document is very large or contains many layers of nested DOCX, HTML, RTF files or HTML snippets, Word may experience performance issues when rendering the combined document. 

If you are looking for information on how to insert HTML snippets into DOC files, please see our article on inserting HTML with our open source project HTMLtoWord for WordApplication: Inserting HTML with WordApplication.

If you are looking for information on how to insert an entire HTML file into a DOCX document, please see our article on embedding documents in WordTemplate: Inserting an Embedded Document.