Forum


Replies: 1   Views: 177
Use a word template and replace table vars in multiple separate tables
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 GuntherG  · 17-07-2024 - 14:18

We've got our code working with a mix of replaceVariableByText or replaceVariableByHtml and whichever remains we put in a table date variable to create rows in tables from, and this works great but now i have word template where we have 3 separate tables, to illustrate its a transport table, time registration table and used material table,

The variables all get detected which is fantastic but when using replaceTableVariables, even with firstMatch false, it only adds rows and properly processes through the first table it finds.

Every other table on the docx with it's own variables (which did get detected and did get a replacement value supplied) gets ignored and we see the variables on the end result with its variablesymbols still around them...

 

Is there a way to achieve this?
I've combed through the documentation but can't find anything.

 

Thank you

Posted by admin  · 17-07-2024 - 18:00

Hello,

Doing replacements in templates that include multiple texts, tables, lists, images... is fully tested and working.

If you send to contact[at]phpdocx.com the simplest DOCX template sample that illustrates your issue, we'll check it and generate a custom sample script using it.

Please note that placeholders to be replaced are case sensitive. Maybe the placeholder names of the table aren't correct? Please send a DOCX template sample, we'll check it.

Regards.