Forum


Replies: 3   Views: 1964
Unable to set default font style using replacevariablebyhtml() function.
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 turnercmt  · 13-05-2020 - 15:10

Hello, We have a premium license. We are using replaceVariableByHTML() function to replace the place holder with HTML. But when we get updated docx file after replacing the place holder the font size and font family not keep as document default stayling. Example: the deafult docx have a font family as "Times New Roman" and there is marker "$NAME$". Now we are replacing the "$NAME$" place holder by using replaceVariableByHTML() function to "John Doe". Now when we get new docx after replacing the "$NAME$"  as "John Doe" then the font family of the "John Doe" word is not keep as  "Times New Roman" it shows in "Calibri" font family and font size is 12.

So how we can keep default font styling of the docs file which get generated after replacing the place holder.

There is option to pass the font style for place holder value while calling replaceVariableByHTML() function. For using this we can set font style to the replaced text. But how we will get default style of the document.