Inserts an external document (DOCX, HTML, RTF or MHT) into the current Word document.


Element definition

This element allows the insertion of an external DOCX, HTML, RTF or MHT document within the current Word document.

When inserting a DOCX document, it is recommended that the page layout of the inserted DOCX coincides with the one of the Word document we are generating with xmldocx, if not you may expect certain formatting problems.

This element is not compatible with the conversion plugin: the inserted DOCX will not render at all in the resulting PDF, DOC, RTF, ODT or HTML document.

Attributes and sub-elements


key Description
src The path to the document (.docx) that we want to insert within our current Word document.
matchSource If true (default value) tries to preserve as much as possible the styles of the DOCX to be included.
preprocess If true does some preprocessing on the DOCX file to add.

Beware that the DOCX to insert gets modified so please make a safeguard copy first.

Code samples
#Example 1




The resulting Word document looks like: