An Update on Creating Visio Diagrams using MSAGL (via XML or programmatically)

Previously as I was developing my VisioAutomation library I made two blog posts that showed how to automatically draw Visio diagrams using MSAGL.

  • The first post was about a program called “MakeFlowChart.exe”. It was a standalone tool that read an input XML file and then rendered that flowchart in Visio.
  • The second post was about a demo program called “DemoMSAGLToVisio” which showed how to programmatically do the same thing in code.

Since those two posts, a lot has changed in the codebase and I forgot to let people know what the current story is.


This is now done via the VisioPS powershell module.

1. Launch Powershell 2.0

2. Type "Import-module .\VisioPS.dll"

3. Type "Draw-Flowchart c:\foo.xml" – to load and draw the flowchart described in foo.xml

The samples and the schema for the XML file is described in this Visio diagram can be found here:!1421&parid=1FF099EDB1C7EBFA!1409



The code is part of a library called “VisioAutomation.DOM”. Rather than pasting the code here, download the source code from and look for the “TestVisioAutomation” project. Inside it you’ll find a unit test called “AutoLayoutTests” – these unit tests show how to use objects in the “VisioAutomation.DOM.AutoLayout” namespace. These classes are the ones that interface to MSAGL to do the drawing.

Comments (0)