getTemplateVariables

getTemplateVariables

BASIC / ADVANCED / PREMIUM

Returns the template placeholder variables as an array.

Description
public getTemplateVariables ()

This method returns all phpdocx placeholder variables of the current template.

In order to work properly with this method, it is recommended not to use the symbol chosen for delimiting the placeholders in other contents of the document. It is preferable to have a unique symbol in the document or ${} for placeholders.

The parseMode option can be enabled in CreateDocxFromTemplate to get template placeholders. The parse mode is slower than the default one, but it's more accurate when the template includes placeholder symbols as regular contents.

Return values

Array with the template variables included in the Word template.

Code samples

Example #1

The resulting output looks like:

Example #2