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

Free Support Forum - aspose.com

How to determine contains a visio graphics in the word document?

How to determine contains a visio graphics in the word document?

Hi Li,


Thank you for contacting support. I’m sorry to share with you that Aspose.Diagram API does not support loading Word documents. You can see API details there: Aspose.Diagram for .NET

However, you can use Aspose.Words API to determine Visio shapes inside a Microsoft Office Word document. This sample code may help you in this regard:

Document doc = new Document(@“c:\MyWord.docx”);<o:p></o:p>

// Get collection of shapes

NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);

int i = 0;

//Loop through all shapes

foreach (Shape shape in shapes)

{

if (shape.OleFormat != null)

{

if (!shape.OleFormat.IsLink)

{

//Extract OLE Word object

if (shape.OleFormat.ProgId == "Visio.Drawing.15")

{

MemoryStream stream = new MemoryStream();

shape.OleFormat.Save(stream);

Aspose.Diagram.Diagram diagram = new Aspose.Diagram.Diagram(stream);

diagram.Save(string.Format(@"C:\outEmbeded_{0}.vdx", i), Aspose.Diagram.SaveFileFormat.VDX);

i++;

}

}

}

}


In case, it does not help then please share your sample Word document in this forum thread. We'll take a closer look and guide you accordingly.