2
Samples ................................................................................................................................................. 18
Creating a new docx .............................................................................................................................. 20
docx4j.properties .................................................................................................................................. 20
Adding a paragraph of text .................................................................................................................... 21
General strategy/approach for creating stuff ......................................................................................... 22
Formatting Properties ........................................................................................................................... 24
Creating and adding a table ................................................................................................................... 24
Selecting your insertion/editing point; accessing JAXB nodes via XPath ................................................ 25
Traversing a document .......................................................................................................................... 25
Adding a Part ......................................................................................................................................... 26
Importing XHTML .................................................................................................................................. 26
docx to (X)HTML .................................................................................................................................... 27
docx to PDF ........................................................................................................................................... 27
Image Handling - DOCX.......................................................................................................................... 28
Manual Image Manipulation .................................................................................................................. 30
Image Handling – PPTX .......................................................................................................................... 30
Adding Headers/Footers ........................................................................................................................ 30
Protection Settings ................................................................................................................................ 30
docx Table of Contents .......................................................................................................................... 31
Introduction ...................................................................................................................................... 31
Field background ............................................................................................................................... 31
TOC Content Control ......................................................................................................................... 32
TOC Field Syntax ................................................................................................................................ 33
Inserting/generating a TOC ................................................................................................................ 34
Page Number Considerations............................................................................................................. 36
Updating a TOC ................................................................................................................................. 36
Known Issues ..................................................................................................................................... 37
Text extraction ...................................................................................................................................... 37
Text substitution ................................................................................................................................... 37
Text substitution via data bound content controls ................................................................................. 38
Binding extensions for repeats and conditionals ................................................................................ 39
Binding escaped XHTML (XML + CSS) ................................................................................................. 39