XML API - pdx:replaceVariableByExternalFile

pdx:replaceVariableByExternalFile

Replaces an array of variables by external files.

Note

You are reading the XML API documentation. For the PHP API method please go to replaceVariableByExternalFile.

Description

Element definition

With the help of this element one may replace a single placeholder variable by a whole external document.

This element accepts the following document formats: DOCX, RTF, HTML and MHT.

This element is not compatible with the phpdocx PDF conversion plugin.

Attributes and sub-elements

variableName

The placeholder variable and the path to the corresponding external document as value.

options

Key Description
firstMatch If the variable appears more than once within the Word document and firstMatch is set to true, phpdocx will only replace the first ocurrence of the variable within the Word document.
matchSource If true (default value) tries to preserve as much as possible the formatting of the inserted document.
Code samples

Example #1

config.xml

content.xml

settings.xml

PHP code

The resulting Word document looks like: