I have an assignment to write a program in IronPython, that reads a Visio (2010) Document, and outputs in CMD what objects are in the active page, and how they are connected to each other.
So far, I have managed to open the Visio Document, but I can't display what's in it. This is my code until now:
import sys
import clr
import System
clr.AddReference("Microsoft.Office.Interop.Visio")
import Microsoft.Office.Interop.Visio
IVisio = Microsoft.Office.Interop.Visio
visapp = IVisio.ApplicationClass()
doc = visapp.Documents.Open("C:\\Users\\hari\\Desktop\\PythonExamples\\helloworld.vsd")
page = visapp.ActivePage
elements = page.GetContainers(0)
for entry in elements:
print entry
doc.Close()
visapp.Visible =0
visapp.Quit()
I found the method GetContainers in MSDN http://msdn.microsoft.com/en-us/library/office/ff765392(v=office.15).aspx but it's not outputing anything about the shapes that exist in the document. Does someone maybe have an idea?