Extract wmf-visio drawing from document

Hi Team,
I am able extract the jpeg, png images using the following code. I am not able to extract the wmf ,visio drawing,chem draw images using shapes.

NodeCollection shapes = doc.getChildNodes(NodeType.SHAPE, true);
for (Shape shape : (Iterable)shapes)
{
    if (shape.hasImage() && shape.getParentParagraph().getNextSibling() != null
    && shape.getParentParagraph().getPreviousSibling().getNodeType() == NodeType.SHAPE)
    {
        if (shape.getParentParagraph().getNextSibling().toString(SaveFormat.TEXT).startsWith("Fig"){
            ArrayList nodes = extractContent(shape.getParentParagraph(), shape.getParentParagraph(), true);
            filename = folder_name + "Fig" + i + "*" + name + ".docx";
            generateDocument(doc, nodes).save(filename);
            Paragraph fig = (Paragraph)shape.getParentParagraph().getNextSibling();
            /***
                ** REMOVAL OF NODE(START,END) FROM SOURCE WORD DOC START*
                ***/
            shape.getParentParagraph().insertBefore(new BookmarkStart(doc, "Image*" + i), shape);
            fig.appendChild(new BookmarkEnd(doc, "Image_" + i));
            i++;
            for (Bookmark bookmark : doc.getRange().getBookmarks())
            {
                if (bookmark.getName().startsWith("Image_"))
                {
                    bookmark.setText("");
                }
            }

Thanks in advance,
kind regards
Priyanga G

Hi there,

Thanks for your inquiry. Please check following code snippet to extract OLE Objects, hopefully it will help you to accomplish the task.

Document doc = new Document("test+(14).docx");
int i = 0;
// Get collection of shapes
NodeCollection shapes = doc.getChildNodes(NodeType.SHAPE, true);
System.out.println("No. of Shapes:" + shapes.getCount());
// Loop through all shapes
for (Shape shape : shapes)
{
    // Save OleObjects
    if (shape.getOleFormat() != null)
    {
        System.out.println(shape);
        shape.getOleFormat().save("out_" + i++ + shape.getOleFormat().getSuggestedExtension());
    }
}

Best Regards,