Replies: 6   Views: 165
Using cloneblock to clone elements
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 admin  · 10-05-2022 - 18:48


The replaceTableVariable method fills a table replacing the placeholders (adding a new row for each array content cloning the table row). Please check the documentation available on the API documentation page ( and the included samples that detail everything about this method.
The goal of this method (replaceTableVariable) is the following: Replaces a group of variables within a set of table rows. On the practical guide ( you can also read about this method and a first sample:

Just like with the lists, you can add tables to the template by making a table with the styles that you want and define a row with the variables to replace. This row will be replaced for as many rows as needed with new values, keeping the original table styles.

cloneBlock allows cloning multiple contents and cloneWordContent allows cloning specific contents based on XPath queries. For your DOCX and table, replaceTableVariable is the recommended method.