Package org.docx4j.samples
Class ContentControlsApplyBindings
java.lang.Object
org.docx4j.samples.ContentControlsApplyBindings
This simple example demonstrates
populating content controls with values
obtained from a Custom XML file in
the docx.
There will only be something to do
if the content in the XML part
is different from the content
in the content control pointing to it.
Word does this itself automatically (its
a 2 way association, so if the user edits
the document in Word, Word updates the XML part), but if you
have a Word document containing content controls,
this sample demonstrates how you could
populate those programmatically. You might
then use docx4j to generate a pdf or an html.
In the real world, you are likely to
want to change the data. For how to do that,
see:
- ContentControlsXmlEdit
- https://github.com/plutext/OpenDoPE-WAR/blob/master/webapp-simple/src/main/java/org/opendope/webapp/SubmitBoth.java
You're also likely to want to 'repeat' data,
and conditionally exclude paragraphs. See
ContentControlBindingExtensions for more on that.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
context
public static jakarta.xml.bind.JAXBContext context
-
-
Constructor Details
-
ContentControlsApplyBindings
public ContentControlsApplyBindings()
-
-
Method Details
-
main
- Parameters:
args-- Throws:
Exception
-