Forum


Replies: 1   Views: 1288
Font changes when using replacevariablebytext
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 dannyguest  · 05-05-2021 - 09:19

We have recently updated our version of PHPDOCX and since then some of our variable replacements using replaceVariableByText are seeing the font become "Times New Roman" instead of the font "Calibri" which is placeholder is set to in the template. Was this changed? Do we need to do a word fragment for each piece of text and manually set the font? 

We have tried $docx->setDefaultFont('Calibri'); which did not work. 

Any help would be appreciated.

Posted by admin  · 05-05-2021 - 09:46

Hello,

The replaceVariableByText method doesn't change existing styles, changes are done replacing only the placeholder keeping the current styles.

We have done some quick tests and everything is working correctly. Please send to contact[at]phpdocx.com the most simple script and template that illustrate your issue so we can check them; we need to run them so please send the most simple script without external connections (such as databases, webservices, frameworks...).

The setDefaultFont method sets the default font family in a DOCX that can be overwritten using default styles, custom styles and inline styles.

Regards.