10.07.2015 Views

Automate Microsoft Office with Python - Mil-OSS

Automate Microsoft Office with Python - Mil-OSS

Automate Microsoft Office with Python - Mil-OSS

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Visio Automation (Iron<strong>Python</strong>)import clrclr.AddReference("<strong>Microsoft</strong>.<strong>Office</strong>.Interop.Visio")import <strong>Microsoft</strong>.<strong>Office</strong>.Interop.Visio as IVisiovisapp = IVisio.ApplicationClass()doc = visapp.Documents.Add("")page = visapp.ActivePagestencilname = "basic_u.vss"stencildocflags = IVisio.VisOpenSaveArgs.visOpenRO | IVisio.VisOpenSaveArgs.visOpenDockedstencildoc = visapp.Documents.OpenEx(stencilname , stencildocflags )masterrect = stencildoc.Masters.ItemU("rectangle")mastercircle = stencildoc.Masters.ItemU("circle")masterconnector= stencildoc.Masters.ItemU("dynamic connector")shape1 = page.Drop(masterrect, 1,1)for i in range(3):shape2 = page.Drop(mastercircle, 3+2*i,3+2*i)connector = page.Drop(masterconnector, -1,-1)connector.CellsU("BeginX").GlueTo(shape1.CellsSRC(1, 1, 0))connector.CellsU("EndY").GlueTo(shape2.CellsSRC(1, 1, 0))shape1 = shape2GTRI_B-‹#›

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!