Page 1 of 1

OpenDoPE changes in docx4j 2.7.1

PostPosted: Tue Oct 04, 2011 12:15 am
by jason
As per the post in the parent forum, I hope/plan to release docx4j 2.7.1 soon.

There have been some improvements to OpenDoPE processing in this release, so please test them out.

Get the release candidate at

Improvements include:

[1639] Change static OpenDoPEHandler design to instance-based design, with objective of making it thread-safe.

[1645] When binding, create hyperlinks out of text containing http://

[1653] Handle unwrapping correctly in ShallowTraversor, so JAXBElements stay wrapped, and we don't risk a marshalling exception for any which don't have an @XmlRootElement annotation.

[1658] Word can only resolve an XPath binding which results in an element (as opposed to a boolean, integer, string or node-set). OpenDoPE processing can handle these other results types (some of them anyway).
Up until now, that processing was done in OpenDoPEHandler. Now it is done in BindingHandler and bind.xslt, for consistency with how normal Word XPath bindings are handled by docx4j.

[1662] Bind picture correctly where parent is another content control.

To use OpenDoPE in 2.7.1, your code should look something like:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
                // Process conditionals and repeats
                 OpenDoPEHandler odh = new OpenDoPEHandler(wordMLPackage);
                OpenDoPEIntegrity odi = new OpenDoPEIntegrity();
                // Apply the bindings
                // Strip content controls: you MUST do this
                // if you are processing hyperlinks
                 RemovalHandler rh = new RemovalHandler();
                 rh.removeSDTs(wordMLPackage, Quantifier.ALL);
                SaveToZipFile saver = new SaveToZipFile(wordMLPackage);
        + "_stripped.docx");
Parsed in 0.016 seconds, using GeSHi

thanks .. Jason