I'm using DOCX4J and I have docx with template for table, that template contains variable that will be replaced.
There can be several type and in each type many reference. The type never has any quantity.
So first I want to add more cells and columns dynamically and after bind the variable with the good values (values are store in a TreeModel (DefaultTreeModel)). There is a way to do this ? Probably manipulate the XML of my docx ? Obivously I want to preserve the style of the template
Easiest to use OpenDoPE: wrap a repeat content control around "type" and another around "reference". Or you can write code yourself which uses the docx4j API to clone your table rows, then do your variable insertion.