Class VariablePrepare

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

public class VariablePrepare extends 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.
  • Field Details

    • log

      private static org.slf4j.Logger log
    • FLAG_NONE

      public static final int FLAG_NONE
      See Also:
    • FLAG_REMOVE_PROOF_ERRORS

      public static final int FLAG_REMOVE_PROOF_ERRORS
      See Also:
    • FLAG_REMOVE_CONTENT_CONTROLS

      public static final int FLAG_REMOVE_CONTENT_CONTROLS
      See Also:
    • FLAG_REMOVE_RSIDS

      public static final int FLAG_REMOVE_RSIDS
      See Also:
    • FLAG_REMOVE_BOOKMARKS

      public static final int FLAG_REMOVE_BOOKMARKS
      See Also:
    • _RT_QNAME

      private static final QName _RT_QNAME
  • Constructor Details

    • VariablePrepare

      public VariablePrepare()
  • Method Details