Part images


Dear Team,
Can i get a workaround solution to extract part images with fig caption in java? or can i get an idea to extract part images.

Part images :: Images that do not contain legends(i.e… (a) , (b) ,( c ) ,…) below the images, but contains images one below or beside another images within single fig caption below

Attached sample : (333.0 KB)



Please ZIP and attach your expected output Word documents here for our reference. We will then provide you more information about your query along with code example.


I have attached sample output below for the above input. Please find the attachment.

Attached Sample_output:Sample (347.0 KB)



We are working over your query and will share the code example with you soon.



Please use the following code example to extract the shapes from the document. Hope this helps you.

Document doc = new Document(MyDir + "part.docx");
int i = 1;
ArrayList nodes = new ArrayList();

for (Paragraph  paragraph : (Iterable<Paragraph>) doc.getChildNodes(NodeType.PARAGRAPH, true))
        Node previousPara = paragraph.getPreviousSibling();
        while (previousPara != null
                && previousPara.getNodeType() == NodeType.PARAGRAPH
                && previousPara.toString(SaveFormat.TEXT).trim().length() == 0)
            if(previousPara != null)
            previousPara = previousPara.getPreviousSibling();

        if(nodes.size() > 0)
            //Reverse the node collection.

            //Extract the consecutive shapes and export them into new document
            Document dstDoc = new Document();
            for (Paragraph para : (Iterable<Paragraph>)nodes)
                NodeImporter importer = new NodeImporter(doc, dstDoc, ImportFormatMode.KEEP_SOURCE_FORMATTING);
                Node newNode = importer.importNode(para, true);
            //Remove the first empty paragraph
            if(dstDoc.getFirstSection().getBody().getFirstParagraph().toString(SaveFormat.TEXT).trim().length() == 0)

   + "output"+i+".docx");