XmlApi - pdx:processTemplate

pdx:processTemplate

Preprocesses a given Word template in order to speed up further manipulations over it.

Description

Element definition

This element allows the preprocessing of a Word template in order to improve performance in the process of replacing placeholder variables by their corresponding values.

Due to various reasons the Word interface may split internally the placeholder variables making direct substitution impossible. Even if you may see the placeholder variable correctly displayed in the Word interface the associated XML node may contain the associated text included in a very cumbersome way (with XML tags splitting the variable name in different chunks).

Although phpdocx deals by itself with that extra complications the process may require multiple manipulations, which for documents with a very large number of placeholders variables, may considerably slow down the output.

By preprocessing the Word template you make sure that all variables are already properly cleaned so the substitution may be carried out at a very fast pace.

Code samples

Example #1

config.xml

content.xml

settings.xml

PHP code