processTemplate

processTemplate

BASIC / ADVANCED / PREMIUM

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

Description
public void processTemplate()
public void processTemplate(HashMap> variables)

This method 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 Javadocx 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.

It is convenient to run this method independently and keep the resulting document in a separate repository of processed templates.

Parameters

variables

You can generate automatically this HashMap with the getVariables method.

Code samples

Example #1