Replaces a single variable by HTML.


Element definition

This element allows the insertion of HTML into a template. You may insert it as a "block", e.g. removing the corresponding paragraph and substituting it by the block of WordML, or "inline", e.g. just replacing the variable by inline WordML.

Practically all HTML tags and CSS styles are supported.

This element transforms HTML directly into WordML and it is compatible with OpenOffice and PDF conversion.

You may find a more detailed explanation of this useful element in the HTML to Word section of the API documentation.

Attributes and sub-elements


The template variable name to be replaced by the HTML content.


The substitution type, it can be:

  • "block": the variable, together with its containing paragraph, is replaced by the HTML content or
  • "inline": only the variable is replaced by the inline HTML content.


The HTML code to be translated into WordML


key Description
isFile True for files and false for strings.
addDefaultStyles True as default, if false prevents adding default styles when strictWordStyles is false.
baseURL The base URL used to complete the relative paths of links and images.
customListStyles If true checks if there is a custom list style with that name and uses it.
downloadImages If true inserts the images into the docx document, otherwise just links them as an external source.
filter Could be an string denoting the id, class or tag to be filtered or an array with a list of filters, if you want only a class introduce .classname, #idName for an id or for a particular tag, if you use the plain name it will search in ids, classes and tags.
parseAnchors If true parses the anchors included in the HTML code.
parseDivsAsPs If true parses the div elements as paragraphs.
parseFloats If true preserves the floating properties of images and tables.
strictWordStyles If true ignores all CSS styles and uses the styles set via the wordStyles option (see next).
useHTMLExtended If true allows using HTML Extended tags. Disable as default. Only available in Premium licenses.
wordStyles One may associate different Word styles to HTML classes, ids or tags.
Code samples
#Example 1




The resulting Word document looks like: