Package org.docx4j.model.datastorage
Class UpdateXmlFromDocumentSurface
java.lang.Object
org.docx4j.model.datastorage.UpdateXmlFromDocumentSurface
public class UpdateXmlFromDocumentSurface
extends java.lang.Object
Copy content control content back to the custom XML part.
Microsoft Word does this automatically for a content control
which has a w:databinding element.
It doesn't do it for a rich text control. Here we also
do that, ie for a content control with a tag such as:
'od:progid=Word.Document'
The content is converted back to escaped WordML, and
injected following the relevant XPath.
This class provides a way
to update the XML part for cases
where editing is done in something other
than Word.
Of course, this class won't work if RemovalHandler
has been used to remove all SDTs or the XML part!
Limitations:
- only the Main Document Part (for escaped WordML)
Replaces Enterprise's BindInverse.
- Since:
- 6.0.0
- Author:
- jharrop
-
Constructor Summary
Constructors Constructor Description UpdateXmlFromDocumentSurface(WordprocessingMLPackage wordMLPackage, boolean supportStylesInWordAltChunkProcessing)Copy contents of OpenDoPE content controls, including rich text content controls with tag 'od:progid=Word.Document' (ie as escaped Flat OPC XML), back into their associated custom XML part element. -
Method Summary
Modifier and Type Method Description WordprocessingMLPackagegetPkg()static voidmain(java.lang.String[] args)java.util.List<CustomXmlPart>updateCustomXmlParts()Update the contents of the relevant custom XML parts, with any edits made by the user in a rich text content control with a tag containing od:progid=Word.Document (and an OpenDoPE XPath, of course).
-
Constructor Details
-
UpdateXmlFromDocumentSurface
public UpdateXmlFromDocumentSurface(WordprocessingMLPackage wordMLPackage, boolean supportStylesInWordAltChunkProcessing) throws Docx4JExceptionCopy contents of OpenDoPE content controls, including rich text content controls with tag 'od:progid=Word.Document' (ie as escaped Flat OPC XML), back into their associated custom XML part element. Styles and NDP are not required in Flat OPC emitted by docx4j for that Flat OPC to be imported into another docx based on those same styles/ndp; but those styles & NDP are necessary for Word 2010 altChunk processing (if the fragment is to use those styles). Setting this option to false gives smaller file sizes.- Parameters:
wordMLPackage-supportStylesInWordAltChunkProcessing-- Throws:
Docx4JException
-
-
Method Details
-
getPkg
-
updateCustomXmlParts
Update the contents of the relevant custom XML parts, with any edits made by the user in a rich text content control with a tag containing od:progid=Word.Document (and an OpenDoPE XPath, of course). The WordML package itself is updated, and the parts are returned for convenience.- Returns:
- Throws:
Docx4JException
-
main
- Throws:
Docx4JException
-