XmlApi - pdx:addExternalFile

pdx:addExternalFile

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

Description

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 you are generating with phpdocx, 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

options

key Description
src The path to the document (.docx) that you 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 backup copy first.

Code samples

Example #1

config.xml

content.xml

settings.xml

PHP code

The resulting Word document looks like: