There are 2 field representations in OpenXML, simple and complex. See http://webapp.docx4java.org/OnlineDemo/ ... L/XML.html
For a simple field implementation, the body of the element contains the most recently updated field result, for example:
Using xml Syntax Highlighting
Parsed in 0.000 seconds, using GeSHi
So that's straightforward (provided you are happy with the current field result), you just remove the fldSimple element, keeping its contents.
For a complex field implementation, you have an ugly set of runs:
• fldChar with attribute fldCharType value begin,
• One or more instrText elements, which, collectively, contain a complete field,
• fldChar with attribute fldCharType value separate, which separates the field from its field result,
• Any number of runs and paragraphs that contains the most recently updated field result, and
• fldChar with attribute fldCharType value end.
So to process these, you need maintain state...
What docx4j gives you out of the box you can explore by trying the XHTML and XSL FO output.