Forum


Replies: 2   Views: 4101
Html markup in table template variable
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 remo  · 14-12-2013 - 14:28

I've seen that I can add HTML to a variable using the code shown here:

http://www.phpdocx.com/blog-news/adding-html-template-variable-phpdocx



I've also seen that I can replace several variables to build a table like shown here:

http://www.phpdocx.com/blog-news/how-generate-dynamical-table-phpdocx-word-template



These are great things but I wasn't able to combine them. What we'd like to achieve is to render this variable (note the b-tag in the second array):




$docx->addTemplateVariable(
array(
array(
'NAME' => 'Product A',
'WEIGHT' => '10',
'PRICE' => '5',
),
array(
'NAME' => '<b>Product B</b>',
'WEIGHT' => '20',
'PRICE' => '30',
),
), 'table', $settings
);


Any ideas on how we can achieve this?



 


Posted by jorgelj  · 16-12-2013 - 09:15

Hello,



The easiest solution is to change the table with the needed placeholders using addTemplateVariable and then transform them using embedHTML. Or generate a new table using HTML.



Regards.