Forum


Replies: 2   Views: 242
Make replacetablevariable accept html
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 ascendware  · 15-05-2020 - 15:45

Hi, I would like to ask if the replaceTableVariable function can now accept HTML contents. I have read previous posts but they were old posts (2015). I would like to update if it is now available and how can I achieve this.

Thank you.

Posted by admin  · 15-05-2020 - 15:56

Hello,

phpdocx 6.5 added support for using WordFragments in replaceListVariable and replaceTableVariable methods. You can create a WordFragment from HTML and add it as any other content.

Please check the included sample Templates/replaceTableVariable/sample_3.php that illustrates how to add WordFragments with replaceTableVariable. This sample adds link and image WordFragments, but you can create a WordFragment from almost any content, for example from HTML:

$htmlWordFragment = new WordFragment($docx);
$htmlWordFragment->embedHTML($html);

Regards.

Posted by ascendware  · 16-05-2020 - 07:37

Hi, it is working now. Thank you very much.