Forum


Replies: 2   Views: 3540
Addtemplatevariable info
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 acunnington  · 24-04-2013 - 12:17

Hi all



Something I noticed during development today is that PHPDocX will not accept a numeric value when using addTemplateVariable. I discovered this while automatically calculating a total cost including tax when given a cost and a tax multiplier -- when using something like: 




$docx->addTemplateVariable('totalincvat', $total * $vatrate);


PHPDocX ignores this and leaves the variable in place (showing $totalincvat$ in the document, for example). A wordaround would be:




$docx->addTemplateVariable('totalincvat', (string)($total * $vatrate));


Hopefully this helps someone.



Cheers, Aaron.


Posted by admin-phpdocx  · 12-07-2013 - 13:52

We will include the casting in future versions of the library :-)