Hi
I am trying to insert some number of rows (depend on my list size) between header and last row of my table.
Please find the attachment for more details.
Any inputs would be highly appreciated
Note: I am doing this in Docx4j easily. (refer expected output in my attachment)
Hi there,
Thanks for your inquiry. You can use NodeCollection.insert method to insert a node into the collection at the specified index. Please check the following code example. Hope this helps you.
<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>Document doc = new Document(MyDir + “Test.in.docx”);
Table table = (Table)doc.getChild(NodeType.TABLE, 1, true);
//Clone the row and insert it
table.getRows().insert(2, table.getRows().get(2).deepClone(true));
doc.save(MyDir + “output.docx”);
Table table = (Table)doc.getChild(NodeType.TABLE, 1, true);
//Clone the row and insert it
table.getRows().insert(2, table.getRows().get(2).deepClone(true));
doc.save(MyDir + “output.docx”);