如何自动生成MS Visio图?

12 visio

我有一种描述依赖关系图的表.有没有简单的方法将其转换为MS Visio图表?

就像Excel的.CSV格式一样......

如果MS Visio无法实现,那么是否有任何软件可以从图形依赖关系列表中绘制图表?

谢谢.

Joh*_*lla 7

graphviz非常适合这种事情.我假设您在Windows上询问Visio,所以这里是Windows二进制文件.


Tj *_*lie 5

如果您使用较新版本的Visio(2003+),则应使用数据库的反向工程工具来启动图表.它会将所有db表和关系吸收到可以修改的形状中.

这是一个链接,将引导您通过该功能:http://office.microsoft.com/en-us/visio/HA101154851033.aspx


小智 5

我写了一个名为VisioPS的PowerShell模块可以帮到你(请参阅下面的下载部分:*VisioPS模块是CodePlex上我的VisioAutomation库的一部分)

安装VisioPS后,启动PowerShell实例并执行以下操作:

Import-Module VisioPS
New-VisioApplication
New-VisioDocument
$dg = Import-VisioDirectedGraph c:\foo.xml
Invoke-VisioDraw $dg
Run Code Online (Sandbox Code Playgroud)

Direct Graph是一个像这样的简单XML文档

<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="\\isotope\public" />
      <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>
Run Code Online (Sandbox Code Playgroud)
  • VisioPS使用MSAGL执行节点的布局
  • 您可以轻松获取依赖关系表并创建所需的XML
  • 如果仔细观察我的库中的代码,您也可以直接创建渲染所需的对象,而无需完全浏览XML.