Forum


Replies: 3   Views: 4264
Replace docvariable fields (quick parts) not working with latest version
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 danesh  · 01-10-2014 - 09:02

I have downloaded latest version and was trying to replace DOCVariable field defined as $name$ but value was not get updated by $docx->replaceVariableByText() method. When I dump variables using $docx->getTemplateVariables() method I can see $name$ listed as a variable but unable to replace it's value using replaceVariableByText() method. Please let me know whether PhpDocX able to replace DOCVariable field variables defined as placeholders similar to $name$ Cheers, Danesh

Posted by admin  · 01-10-2014 - 10:19

Hello, The placehoders must be surrounded by '$'. If you prefer to use other symbol, you need to use the setTemplateSymbol method; the same symbol must be used at the start and end of the placeholder. Please run the included example and check if the placeholders are replaced. Regards.

Posted by danesh  · 04-10-2014 - 01:42

Hi Admin, Yes placeholders are already surrounded by '$' and it does replace normal text based placeholders at Word Document. I am referring to DocVariables defined as quick part for example { DOCVARIABLE $variablename$ } that does NOT replace by PhpDocX Can you please look in to this and if PhpDocX able to replace value of "DocVariable" we will definitely going to purchase the licensed version of PhpDocX for our web application. Cheers, Danesh

Posted by admin  · 05-10-2014 - 09:40

Hello, No, DocVariables are not supported by phpdocx. Regards.