Preprocess OpenDoPE Word file (Macro or docx4j)

547 Views Asked by At

I have recently discovered the OpenDoPE project. From what I understand from the walkthrough, .docx files must be preprocessed to replace repeatable contents for example.

If I understand well there are 2 ways to do it :

  • Using docx4j
  • Using a Macro

I am developing a rails web platform, and I'd prefer the preprocessing to be done client-side, so with the Macro. But then If I can only do it with java, I'll go with it

Problem : when I click the "inject macro" button in the OpenDop Add-in in Word2010, nothing happens :O

So two possible answers :

  • Explain how I can install this macro in the document
  • Explain how I can have docx4j to preprocess the document. ie : from a linux terminal, what command with what parameters should I type to preprocess some document.docx file containing repeatable-contents ?
1

There are 1 best solutions below

1
On

I tried clicking the "inject macro" button in my Word 2010, and it worked, that is:

  • it prompted me to save a .docm file
  • when i opened the .docm file in Word, the macro ran

Trying to open the macro in Word's VBA editor though, I couldn't. Seems I obfuscated it :-(

I do have the source files floating around, which I'd be happy to put on GitHub.

Please note however, that it is 4yo unmaintained 'proof of concept' level code (whereas the docx4j code is actively maintained and used by a variety of companies).

For non-interactive processing using Java, see samples/ContentControlBindingExtensions.java

To invoke from a Linux command line, that would need modifying slightly; also you need of course to pass a suitable class path.

The other way you could do it is by installing this simple web app in say Tomcat.