Forum


Replies: 2   Views: 4472
Replacevariablebytext problem
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by IanTechnoReadapt  · 13-06-2014 - 19:34

Deleted by IanTechnoReadapt · 13-06-2014 - 19:57

Posted by IanTechnoReadapt  · 13-06-2014 - 23:22

In your example, you are missing a closing parenthesis on the line $docx->replaceVariableByText(array('NAME' => 'John Smith'); should be $docx->replaceVariableByText(array('NAME' => 'John Smith')); Otherwise, does replaceVariableByText works in headers? I'm trying to generate a word file that have a variable company name in the headers of some pages. placing $COMPANY_NAME$ in the headers of my template doesn't do the trick.

Posted by jorge  · 16-06-2014 - 14:08

Hello, Thanks, we're going to fix the mistake. About the method, I recommend you to read the API documentation: http://www.phpdocx.com/api-documentation/templates/replace-variable-text-Word-document As you can see, the target option allows you to set where the replace the placeholders. Regards.