getTemplateVariables
getTemplateVariables
Returns the template placeholder variables as an array.
This method returns all phpxlsx 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 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.
Array with the template variables included in the Excel template
Example #1
- phpxlsx 2.0:
- don't return duplicated placeholder names.
- phpxlsx 1.0:
- new method.