Replies: 2   Views: 809
How to insert a table at a specific location
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 Bouillou  · 30-09-2020 - 15:05

Dear support, 

Is it possible to add a table with "addTable" method at a specific location?

With my version 9 of PHPDocX, the addTable add the new table always at the end of the document. It would be great if the table could be inserted at a variable or betwen a block location location like "$MY_TABLE$".

Best regards

Posted by admin  · 30-09-2020 - 15:27


You can use replaceVariableByWordFragment to replace a placeholder by one or more contents, for example a table, an image or others.

To add a table to a specific position in a document you can use insertWordFragment available in DOCXPath in Advanced and Premium licenses.

We recommend you to check the included samples available in the package. You just need to generate a WordFragment and call the chosen method.


Posted by Bouillou  · 01-10-2020 - 13:15

It is working.

Thank you for your support.