Page 1 of 1

How to process a different part in docx using docx4j

PostPosted: Tue Sep 30, 2008 11:35 pm
by neversaydie

In SVN, HeaderPart and FooterPart are now JAXB XML Parts.

I haven't tested them yet, but they should work for opening an existing document (containing headers/footers).

For marshalling, i suspect tomorrow I will need to change things a little, so JAXB knows whether to marshall it as a header or a footer in a given case.



On Tue, Sep 30, 2008 at 12:23 PM, Jason Harrop <> wrote:
> It would be nice to treat the Footer as a JAXBXmlPart, not a dom4j part.
> (By way of background, when i first started this project, working from
> the OpenXML4J code which manipulated OPC packages, each part was a
> dom4j part. I'm progressively switching the parts over to being JAXB
> XML Parts. This is nearly done. In order to do it, there must be a
> JAXB object which represents the content of the part)
> Since there is a JAXB object representing a footer, namely CTHdrFtr
> (which ought to be renamed to HdrFtr), this is quite straightforward.
> It would be best to make this change, rather than work with the dom4j
> objects (which i'd like to phase out).
> I may have a chance to do it later today :)
> cheers
> Jason

>> Hello Jason,
>> If I need to replace text in a footer section of a docx file, I
>> retrieve the FooterPart. And then retrieve the document inside
>> footer. As per docx4j API, this document is a dom4J document.
>> To make any change into the dom4J document, I am proceeding with dom4J API.
>> Is there any provision of conversion from dom4j Document to docx4J document?
>> Apparently not, still would like to check with you. I will post in
>> forum subsequently.