We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Remove Table Caption from docx

Table.zip (2.7 MB)

Hi team,
Requiring a work around solution in JAVA to remove table caption starting with “Fig”.

Regards
Priya Dharshini J P

Hi Priya,

Thanks for your inquiry. Please use following code example to achieve your requirement.

Document doc = new Document(MyDir + "Problem1.docx");

ArrayList nodes = new ArrayList();
for (Paragraph  paragraph : (Iterable<Paragraph>) doc.getChildNodes(NodeType.PARAGRAPH, true))
{
    if(paragraph.toString(SaveFormat.TEXT).trim().startsWith("Figure"))
    {
        paragraph.remove();
    }
}

doc.save(MyDir + "output.docx");

Best Regards,
Tahir Manzoor

Thanking You @tahir.manzoor

Regards
Priya Dharshini