Class VariablePrepareRuns

java.lang.Object
org.docx4j.samples.AbstractSample
org.docx4j.samples.VariablePrepareRuns

public class VariablePrepareRuns extends AbstractSample
There are at least 3 approaches for replacing variables in a docx. 1. as shown in this example 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.
  • Field Details

    • save

      static boolean save
  • Constructor Details

    • VariablePrepareRuns

      public VariablePrepareRuns()
  • Method Details