I'm trying to add row in table.
i did add table.
but i want to add row not table.
thanks!
- Code: Select all
org.docx4j.wml.Document wmlDocumentEl = (org.docx4j.wml.Document) wordMLPackage
.getMainDocumentPart().getJaxbElement();
Body body = wmlDocumentEl.getBody();
ObjectFactory factory = Context.getWmlObjectFactory();
if (exportListItem != null) {
List<Object> tables1 = getAllElementFromObject(
wordMLPackage.getMainDocumentPart(), Tbl.class);
if (tables1 != null) {
Tbl sourceTbl = (Tbl) tables1.get(0);
Tbl newTbl = (Tbl) XmlUtils.deepCopy(sourceTbl);
//body.getContent().remove(sourceTbl.getParent());
for (int i = 0; i < exportListItem.size(); i++) {
body.getContent().add(newTbl);
}
}
}