English 中文(简体)
How to generate MS Visio diagram automatically? [closed]
原标题:
  • 时间:2010-01-04 15:11:05
  •  标签:
  • visio

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 8 years ago.

I have some sort of a table describing a graph of dependencies. Is there any easy way to convert it into a MS Visio diagram?

Like a .CSV format for Excel...

If it is not possible with MS Visio, then is there any software which draws a diagram from a list of graph dependencies?

Thank you.

问题回答

graphviz is pretty much geared for this sort of thing. I assume you re on Windows since you asked about Visio, so here are the Windows binaries for it.

If your using a newer version of Visio (2003+) you should use the Reverse engineer tool for databases to start your diagram. It will suck all the db tables and relationships into shapes that you can then modify.

Here is a link that will walk you thru the feature: http://office.microsoft.com/en-us/visio/HA101154851033.aspx

I wrote a PowerShell module called VisioPS that may help you (See the downloads section here: * The VisioPS module is part of my VisioAutomation library on CodePlex)

After installing VisioPS, you an launch an instance of PowerShell and do this:

Import-Module VisioPS
New-VisioApplication
New-VisioDocument
$dg = Import-VisioDirectedGraph c:foo.xml
Invoke-VisioDraw $dg

The Direct Graph is a simple XML document like this

<directedgraph>
  <page>
    <renderoptions
      usedynamicconnectors="true"
      scalingfactor="20"
    />
    <shapes>
      <shape id="n1" label="FOO1" stencil="server_u.vss" master="Server" url="http://microsoft.com" />
      <shape id="n2" label="FOO2" stencil="server_u.vss" master="Email Server" url="http://contoso.com"/>
      <shape id="n3" label="FOO3" stencil="server_u.vss" master="Proxy Server" url="\isotopepublic" />
      <shape id="n4" label="FOO4" stencil="server_u.vss" master="Web Server">
        <customprop name="prop1" value="value1"/>
        <customprop name="prop2" value="value2"/>

      </shape>
      <shape id="n5" label="FOO4" stencil="server_u.vss" master="Application Server" />
    </shapes>

    <connectors>
      <connector id="c1"  from="n1" to="n2" label="LABEL1" />
      <connector id="c2" from="n2" to="n3" label="LABEL2" color="#ff0000" weight="2" />
      <connector id="c3" from="n3" to="n4" label="LABEL1" color="#44ff00" />
      <connector id="c4" from="n4" to="n5" label="" color="#0000ff" weight="5"/>
      <connector id="c5" from="n4" to="n1" label="" />
      <connector id="c6" from="n4" to="n3" label="" weight="10"/>
    </connectors>

  </page>

</directedgraph>
  • VisioPS uses MSAGL to perform the layout for the nodes
  • You could easily take your table of dependencies and create the XML needed
  • If you look closer at the code in my library, you can also directly create the objects necessary to do the rendering without having to go through the XML at all.

Visio Professional edition will import from a spreadsheet or database, but it does not appear possible to have Visio automatically draw connectors between shapes.

Not sure if that helps, but ARIS Express (http://www.ariscommunity.com/aris-express) has a feature called smart design. You enter your data as a spreadsheet and it automatically generates the diagram. Works for process models, but also for data models or organisational charts.

Graphvis is a plugin to import .gv files in dot format. It will draw the connectors and shapes can be customized, and there are a few initial layout options.

Omnigraffle can be an alternative. In Omnigraffle you won t be able to import a csv, but you will be able to insert items as a list and sort them very easily creating dependencies between elements. Then, there is a function call "Dynamic Diagram" that sorts the diagram automatically. (You can modify the type of diagram and length of connectors)





相关问题
Create C++ Code from Visio UML diagram [closed]

Visio 2010 Beta can generate static UML diagram from Native C++ project, and it s great. How is it possible to solve reverse problem: given a static UML diagram from Visio, generate header files? Or, ...

How to generate MS Visio diagram automatically? [closed]

I have some sort of a table describing a graph of dependencies. Is there any easy way to convert it into a MS Visio diagram? Like a .CSV format for Excel... If it is not possible with MS Visio, then ...

Automating reverse engineer database model with Visio

We develop and maintain our database schema with a custom tool. SQL scripts and runtime files are generated from that tool. However, it does not provide a very good visual representation. Lately I ...

Software for Sequence Diagrams? [closed]

I ve been using NClass for object/class modeling in class thus far. However, I do not believe that it is capable of sequence diagrams, which is my next task. I would prefer not to use Visio. Is ...

热门标签