How to get image in visio file?


#1

I use aspose.diagram for java,i want to get the image in visio file.please help me,thanks.
else.zip (112.1 KB)


#2

@Delaba

Please use following code snippet to extract image from your Visio Diagram file:

Diagram diagram = new Diagram(dataDir + "else.vsdx");
// Enter page index i.e. 0 for first one
for (Shape shape : (Iterable<Shape>) diagram.getPages().getPage(0).getShapes())
{
    // Filter shapes by type Foreign
    if (shape.getType() == TypeValue.FOREIGN)
    {
        FileOutputStream fos = new FileOutputStream(dataDir+ "ExtractAllImages" + shape.getID() + "_Out.bmp");
        fos.write(shape.getForeignData().getValue());
        fos.close();
    }
}