Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

PlantUML_Template_v30 does not work

0 votes

I installed the Word template v30 according to the instructions it contains (putting the tempate in %appdata%\Microsoft\Word\STARTUP). I also installed the plantuml.jar and Graphviz as instructed.

When I start word every time I get an error "The macro cannot be found or has been disabled because of your Macro security settings". The error always shows twice. In my Macro security settings macros are set to always enabled.

I use Windows 10 and Word 2013 x64. I am logged in as an administrator. I tried the Word template v27, but with the same result.

When I open the Visual Basic the project cannot be compiled due to multiple compilation errors.

Can anyone help me?

asked Jan 11, 2016 in bug by nbrio (130 points)
edited Mar 1, 2016 by nbrio

2 Answers

0 votes
Same for me.

In my case, windows defender deleted the template by trojan alert

answered Aug 8, 2016 by anonymous
0 votes

Hey there.

I am using the Word-Add-In as well and its working fine. A colleague of mine wanted to start the Add-In yesterday (both PCs Windows 7, Word 2010). It failed with the error described above. We decided to have a look at what is going on and found an issue in the code base that resolves the execution path. I will put the needed stuff here and then inform the team. Hope this works as I am not familiar with the process on this site.

So, if you remove the template from the folder %appdata%\Microsoft\Word\STARTUP and copy it to somewhere you can open the template and are able to use the developer tools to look into the VBA code. In Module PlantUML go to function getExePath (used by getJarPath and by getDotPath). If you have a new document there the mainPath variable starts with an empty string. Afterwards the search starts and if you accidentically have the plantuml.jar in your current directory, the file is found and the resulting mainPath which is then returned is the empty string. The calling method getJarPath interprets this as not finding the file and you end up with a message box stating the error "Error : Cannot find plantuml.jar in : ...".

So, the general solution could be to remove the plantuml.jar from your default current directory. But in my opinion this should be stable working hence, we made an own version (I must look to reference it here somewhere and will do so, but put down changes here). For this we took the function getExePath and added the following lines of code between the lines 111 and 113 of the method:

    ' In case mainPath is the empty string as the active document is the empty string,
    ' and in case the plantuml.jar can be found in the current directory, the below
    ' code results in mainPath being the empty string which would work properly if
    ' the calling method would not check for an empty string as execution path
    ' and state this is wrong and has to fail. Therefore, change main path in case
    ' it is an empty string at this point with an explicit, not empty string stating to
    ' use the current folder as relative path.
    If mainPath = "" Then
        mainPath = ".\"
    End If
The comment is lengthy but I put it down to prepare giving the code back to the people here.
This fixed our issues. Hope it helps.


answered Mar 17 by anonymous
Support This Project Offer 250 Mo! Follow PlantUML on Twitter