During my working live I am experiencing a very often repeating situation. Users of Sparx Enterprise Architect copy their diagrams into Word document. This document is afterwards used as a documentation. If there is a change in any particular diagram they have to update the diagram in the document as well. They open the document, find the proper picture and replace it by copy and paste operation. Well, one diagram is nothing to get excited about. But what to do when there are dozens of diagrams? Use Active Diagram add-in for Word!
Are you already hooked? Go on reading.
There are four new buttons on Add-in ribbon in button group named EA Active Diagrams after the installation of Active Diagrams:
Your first step is the linking your document with the EA repository (EAP file or database link). Just press Link with EAP button and enter the repository location (connection string):
Now, it is the time to insert a diagram. Press Add New Diagram button, a dialog with a repository structure appears:
Please note that a first showing of this dialog consumes a little bit more time (seconds) because a new instance of EA for opened document is creating in memory. This instance is ready for next adding of diagram until the document is closed. That means the diagram will be shown much more quicker next time.
Select a diagram and press OK. Selected diagram will be inserted into the document.
Described dialog has three tabs. Second one is for future version and the third one allows you to add a diagram GUID directly. You can find this GUID in Enterprise Architect in Project Browser. Select a context menu of the diagram a choose Copy | Paste à Copy Node GUID to Clipboard item. The GUID is copied into the clipboard.
Since now, every time you press Refresh button, all diagrams inserted by Active Diagram will be updated. It doesn’t matter if you have one diagram in the document or sixty five. This button will update all of them!
If you select a diagram inserted by Active Diagrams, you can see additional information about a diagram:
In case you don’t see this information pane, just check the check box Show Task Pane on Add-in ribbon. If you can’t see all values, just refresh the diagrams. Internal version will be changed from 1 to 2 or higher and all metadata will be shown.
If you want to use Active Diagrams you need to have installed this software on your computer:
- Microsoft Word 2013 or higher
- Sparx Enterprise Architect
Good news: Even if you use Active Diagrams the document can be edited by users without this add-in and without Enterprise Architect. They can see the diagrams, they only cannot update them.
Linking with Enterprise Architect Repository
- A user open a dialog to insert repository location (see the screenshot shown above).
- A user inserts a location.
- Active Diagrams add-in stores the location with the document in a user property called EAPFILE.
You can check the location in document’s properties (standard Word dialog).
When a GUID of a diagram is inserted, Active Diagrams add-in asks Sparx EAP to save the diagram to the temporary file (.emf format) on a disk. After that the diagram is inserted into document as a linked image and is saved with the document. This allows reading a document to other users without the need of having Active Diagrams or Sparx EA on their computer.
When a Refresh button is pressed Active Diagrams goes through the whole document and all images inserted by this add-in.
How the Active Diagram add-in does know that a picture was inserted by him? It checks picture’s AlternativeText property whether it contains a string according to a pattern shown below (GUID used there is just an example):
I have problems with installation of the add-in. What’s wrong?
First of all, you have to have the right permission for installing software. If you can’t obtain it (for instance due to company policies), try to ask a service desk.
Some users cannot install a new version when the previous one is installed. In this case, remove the previous version in Control Panel.
Why Word doesn’t want to accept the add-in?
You should allow installing add-ins without a certificate signed by trusted publisher. You can make it in Word settings File | Options | Trust Center | Trust Center Setting… | Add-ins and there uncheck Require Application Add-ins to be signed by Trusted Publisher. In several cases (typically company policies) you cannot change the settings. In this case, you can change these setting in Registry in HKEY_CURRENT_USER\Software\Policies\Microsoft\office\15.0\word\security: enter a DWORD value named requireaddinsig and set the value to zero or run this registry file.
I use Active Diagrams. Can another user without this add-in or Sparx EA edit a document with diagrams inserted by Active Diagrams?
Yes. Documents with diagrams inserted by Active Diagrams add-in can be edited by any user just with Word only. There is only one limitation – diagrams cannot be updated by this user.
Active Diagrams add-in is free of charge. On the other hand, a small donation is appreciated.
Download and installation
Download ActiveDiagrams.zip file, unzip it, run
setup.exe and follow the instructions.
Source code can be found on GitHub.