Forum


Replies: 4   Views: 4145
Font size issue when using replacevariablebyhtml
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 nicks  · 22-09-2015 - 13:20

Hi Guys, I may well be having a brain block moment, though I can't seem to make the text in the replaced section a size 10 when using replaceVariableByHTML. Note I use block as the contents replacing the variable could tables and other formatting. Also I am using ckEditor as the WYSIWYG editor: $docx->replaceVariableByHTML(SECTION, "block","$VAR1") I am using p style="font-size:10px to format $VAR1, though can't paste in my exact code as it renders it on here. Am I missing something?

Posted by petitiaux  · 23-09-2015 - 14:07

Deleted by admin · 23-09-2015 - 14:08

Posted by admin  · 23-09-2015 - 14:09

Hello, We have tested it and everything seem working fine. Please run the included example Templates/replaceVariableByHTML/sample_1.php. If you want to use an exact font size, set is as pt instead of px. This example works perfectly: http://pastebin.com/3Cux25Yz Regards.

Posted by nicks  · 01-11-2015 - 17:00

Just to follow this one up, I found that the replaceVariableByHTML method would default to the Word document font if I set the strictWordStyles to true. e.g.

$docx->replaceVariableByHTML(Test', 'block',$TestWording, array('isFile' => false, 'parseDivsAsPs' => true, 'downloadImages' => true, 'strictWordStyles' => true)