Class VariablePrepare

java.lang.Object
org.docx4j.model.datastorage.migration.VariablePrepare

public class VariablePrepare
extends java.lang.Object
There are at least 3 approaches for replacing variables in a docx. 1. text replacement on the document surface. 2. using Merge Fields (see org.docx4j.model.fields.merge.MailMerger) 3. binding content controls to an XML Part (via XPath) Approach 3 is the recommended one when using docx4j. See the ContentControl* examples, Getting Started, and the subforum. Approach 1, works in simple cases only. It won't work if your KEY is split across separate runs in your docx (which often happens), or if you want to insert images, or multiple rows in a table. This class tidies up your document, so your keys should not be split across separate runs.