I am processing a template word document using docx4j and I want to remove a table from the document. I used the following code to get the table and remove the table, but seems like it doesn't remove the table. Can anyone please help me on this? Thanks.
WordprocessingMLPackage tmpl= getTemplate(templatePath);
MainDocumentPart mainDocPart = tmpl.getMainDocumentPart();
List<Object> tblList= getAllElementsForObject(mainDocPart, Tbl.class);
Tbl tmplTbl= (Tbl)tblList.get(0);
mainDocPart.getContent().remove(tmplTbl);