Class FieldsPreprocessor

java.lang.Object
org.docx4j.model.fields.FieldsPreprocessor

public class FieldsPreprocessor extends Object
This class puts fields into a "canonical" representation (see FieldRef for description). It does this in 2 steps: - step 1: use XSLT to convert simple fields into complex ones - step 2: put all the instructions into a single run Currently the canonicalisation is done at the paragraph level, so it is not suitable for fields (such as TOC) which extend across paragraphs. TOC will need to be regenerated (using Word) if touched by canonicalisation.
Author:
jharrop
  • Method Details

    • complexifyFields

      public static void complexifyFields(JaxbXmlPart part) throws Docx4JException
      Convert any w:fldSimple in this part to complex field.
      Parameters:
      part -
      Throws:
      Docx4JException
    • canonicalise

      public static P canonicalise(P p, List<FieldRef> fieldRefs)
      Convert the field(s) in the input P into a predictable format, and add a FieldRef object to the list for each top level field encountered. WARNING: this method should not be used where a field in the P extends into a subsequent P.
      Parameters:
      p -
      fieldRefs -
      Returns:
      the modified P
    • isCharType

      public static boolean isCharType(Object o2, STFldCharType charType)