PlantUML带有一个Word Add-in,可以到PlantUML Word Template下载。



  • install the right template version in Word
    • copy the (.dotm) file in to %appdata%\Microsoft\Word\STARTUP
    • note: .dotm = Word Doc Template (office 2007 and newer) with Macro’s enabled
  • copy Plantuml.jar to %appdata%\Microsoft\Word\STARTUP folder
  • install GraphViz
      • use installer if you have rights to install applications; this will install graphviz in your program files (x86)
      • use zip for portable installation
        • extract in %appdata%\GraphViz
        • (executable is then in %appdata%\GraphViz\release\bin\dot.exe)
    • if alternative portable installation, please set environment variable GRAPHVIZ_DOT to location of DOT.EXE
  • restart Word. You now should have a PlantUML menu!

但是上面的操作在Office 365的Word中并不工作。验证可以工作的方式是:

  • 将PlantUML_Template_v34.dotm 放到C:\Program Files (x86)\Microsoft Office\Office16\STARTUP目录
  • 将plantuml.jar放到%APPDATA%\Microsoft\Templates(展开以后是C:\Users\janedoe\AppData\Roaming\Microsoft\Templates)



PlantUML Word Template默认的生成的图片不是居中对齐的,如果需要居中对齐显示,需要修改模板源码,在往Word插入图片的时候调整对齐:

currentparagraph.ParagraphFormat.Alignment = wdAlignParagraphCenter

因为PlantUML_Template_v34.dotm是带宏的,默认是被禁止的(因为有macro protection)。需要放在C:\Program Files (x86)\Microsoft Office\Office16\STARTUP中打开编辑才可以。