templatesplaceholderphpword

How to get a list of placeholders / variables in a word template


using phpword, I would like to get a list of all the placeholders ${var_name} that is in a template

I have searched here and in the documentation but I have not been able to find a function that can give a list of placeholders / variables


Solution

  • I'm assuming you're referring to the PHPWord TemplateProcessor.It actually does provide a method that returns an array of all the variables in the template, which is $phpWord->getVariables() as refer to the source code. I found it when digging into the source code. The official documentation is long out of date.

    Hope it helps!