JSON API - embedHTML

embedHTML

PREMIUM TRIAL / ADVANCED

Inserts HTML content into a Word document.

Note

You are reading the JSON API documentation. For the PHP API method please go to embedHTML.

JSON data
Key Description
html The HTML code to be translated into WordML.
addDefaultStyles True as default, if false prevents adding default styles when strictWordStyles is false.
addDefaultStylesPpr True as default, if false prevents adding default pPr styles when strictWordStyles is false.
addDefaultStylesRpr True as default, if false prevents adding default rPr styles when strictWordStyles is false.
baseURL The base URL used to complete the relative paths of links and images.
cssEntityDecode If true uses html_entity_decode to parse CSS, useful when using font families with non-ASCII names.
customListStyles If true checks if there is a custom list style with that name and uses it.
disableWrapValue If true disable using a wrap value with Tidy to prevent extra blank spaces. Default as false.
downloadImages If true inserts the images into the docx document, otherwise just links them as an external source.
embedFonts If true downloads and embeds TTF fonts from @font-face rules. False as default. Only available in Premium licenses.
filter Only renders the filtered contents. It could be an string denoting an id ('#myId'), a class ('.myClass'), a HTML tag or a valid XPath expression ('//expression').
forceNotTidy False as default. If true, avoid using Tidy. Only recommended if Tidy can't be installed.
generateCustomListStyles If true generates automatically the custom list styles from the list styles (decimal, lower-alpha, lower-latin, lower-roman, upper-alpha, upper-latin, upper-roman).
parseAnchors If true parses the anchors included in the HTML code.
parseCSSVars If true parses CSS variables.
parseDivs paragraph or table. By default the method parses the div elements as containers.
parseFloats If true preserves the floating properties of images and tables.
removeLineBreaks If true removes extra line breaks that can be generated when transforming HTML that includes strings without a parent tag.
strictWordStyles If true ignores almost all CSS styles and uses the styles set via the wordStyles option (see next).
useHTMLExtended If true allows using HTML Extended tags. False as default.
wordStyles One may associate different Word styles to HTML classes, ids or tags.
Code samples

Example #1

Example #2

Example #3

Release notes
  • phpdocx 18.0:
    • new action.