Package org.docx4j.model.fields
Class FieldsPreprocessor
java.lang.Object
org.docx4j.model.fields.FieldsPreprocessor
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 Summary
Modifier and TypeMethodDescriptionstatic Pcanonicalise(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.static voidcomplexifyFields(JaxbXmlPart part) Convert any w:fldSimple in this part to complex field.static booleanisCharType(Object o2, STFldCharType charType)
-
Method Details
-
complexifyFields
Convert any w:fldSimple in this part to complex field.- Parameters:
part-- Throws:
Docx4JException
-
canonicalise
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
-