getTemplateVariablesType

getTemplateVariablesType

ADVANCED / PREMIUM BASIC

Returns the template placeholder variables and their types.

Description
public getTemplateVariablesType()

This method returns all phpxlsx placeholder variables of the current template and their types.

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 spreadsheet. It is preferable to use a unique symbol or ${} for placeholders.

To extract the placeholders, the public static variable CreateXlsxFromTemplate::$regExprVariableSymbols is used. This variable contains a regular expression with the conditions to extract the variables, ([^ ]*) as default, so placeholders without empty spaces must be used to get them automatically with the getTemplateVariables method. If needed, this variable can be customized to use other regular expression.

Return values

Array with the template variables and their types (text, image) included in the Excel template.

Exceptions

Method not available.

Code samples

Example #1

Release notes
  • phpxlsx 4.5:
    • new method.