introduction

This template allows using PlantUML directly from MS Word 2010 without need to alter document templates or edit VBA macro's. MS Word Versions 2007 and 2013 might work, but are not tested.

If you cannot see the green boxes in this file, please use the ‘show PlantUML’ button.

Example

Installation

First time:

install this template in Word

copy this (docm) file in to %appdata%\Microsoft\Word\STARTUP

install Plantuml.jar in %appdata%

install GraphViz

http://www.graphviz.org/Download_windows.php

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%

(executable is then in %appdata%\release\bin\dot.exe)

if alternative portable installation, please set GRAPHVIZ_DOT to location of DOT.EXE

restart Word. You now should have a PlantUML menu!

Installation

First time:

install this template in Word

copy this (dotm) file in to %appdata%\Microsoft\Word\STARTUP

note: .dotm = Word Doc Template (office 2007/2010) with Macro's enabled

install Plantuml.jar in %appdata%

install GraphViz

http://www.graphviz.org/Download_windows.php

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%

(executable is then in %appdata%\release\bin\dot.exe)

if alternative portable installation, please set GRAPHVIZ_DOT to location of DOT.EXE

restart Word. You now should have a PlantUML menu!

Using

Once installed, a special menu (PlantUML) should be available in Word as tab “PlantUML”

P = : show paragraph marks

Show PlantUML: reveal (green text) of PlantUML image sources (for editing)

Hide PlantUML : hide source, just show generated pictures (before releasing a document for review/UCC)

UML.1 : Generate current diagram (cursor in green PlantUML definition)

UML.* : Generate all (note: this may take seconds up to a minute for 100+ pictures). Press Ctrl-Break to abort.

If you don’t see the toolbar, please check installation instructions. If you load the .dotm file from word (Open file, not double click from explorer) then you should also see the toolbar (or twice if you’ve installed it already).

About word template

This document contains VBA scripts (based on plantuml007.bas).

Improvements made by Adriaan van den Brand:

Easy distribution and integration (as a word.docm)

performance (no new documents created, direct writing of text files)

fixed issue of images at wrong locations

better sync with plantuml java (by using ShellandWait module)

no unnecessary delays

can be aborted with ctrl-breai

Contact:adriaan.plantuml@gmail.com

I appreciate feedback and improved versions.

Background

My name is Adriaan van den Brand and I work as system architect at Philips Innovation Services. I am using plantuml for my technical documents, and wanted to have a straightforward Word integration. This is primarily for my own work, and I gladly share it with the community. The code is not my finest (minimal changes from original vba scripts) but it seems to do the trick. If you have improvements, please contact me.

Notes for version 2.6/2.7

added @rescale keyword (see 1.5)

better support for non-English Office versions (reference to ‘normal’ style is done by magic number instead of name)

use of UTF-8 instead of ascii. This may help people using non-ascii characters, but it will cause problems with MS Word autoformatting. Consider disabling autoformat (quotes need to be straight for plantuml to work)

Version 2.7: added preferences button and support for EPS vector graphics (better print quality)
Note: preferences are stored in registry under hkeycurrentuser\PlantUML

added authors and fixed text in toolbar for UML.1

Known issues

When is at the end of a table cell, no image is inserted (at least, no image becomes visible). This seems related to the odd table structures in word. There is a next paragraph, yet it is not visible.

If an error occurs inserting the picture, the macro’s may assume that is at the end of the document. So if pictures appear at the end of the document, please check that there is a line after each

autoformat (automatic bullets/arrows) are not compatible with plantuml. Use toolbar button for quick access. Note that this will not change the autoformat as you type (--> into →).

formatting plantuml can be improved

add-ins from previous version are still created (so 2 methods of invoking plantuml after first Uml.* run)

mismatched startuml/enduml pairs will cause pictures to be inserted in the wrong place

Rescale

Plantuml supports a scale keyword. This will scale the generated png file. However, when downscaling, text may become coarse. To solve this, the @rescale (use in plantuml comment!) provides a post-processing scale. Scale is supported only as a float number between 0.1 and 10

Example: 2.4 Components (and @rescale)

Version info plantUML

The following picture should be updated when you select PlantUML (menu) UML.1 or UML.*

Check for uppdates

License information

For license information of PlantUML, please check out http://plantuml.sourceforge.net/

The code below will generate a copyright image (if correctly installed)

Authors

VBA code Shellandwait

' By Chip Pearson, chip@cpearson.com, www.cpearson.com

' This page on the web site: www.cpearson.com/Excel/ShellAndWait.aspx

' 9-September-2008

(Public domain)

VBA Registry code

Based on macro’s published on http://www.slipstick.com/developer/read-and-change-a-registry-key-using-vba/

Examples

See http://plantuml.sourceforge.net for more information and examples

Basic sequence diagram

Class example

Activity (parallel)

Components (and @rescale)

Statechart