Page 1 of 1

CustomXmlDataStoragePart gets overwritten to customXml

PostPosted: Wed Sep 07, 2016 7:10 pm
by MatthiasH
Hi,

I want to add a CustomXmlDataStoragePart to the .docx to store the value of about 100 hash codes that I later need to retrieve.

I looked into this example: https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ContentControlsAddCustomXmlDataStoragePart.java

Unzipping the document looks fine, even if I put my own PartName argument in line 77.

However, after altering the content of the document and saving it, the PartName of the added CustomXmlDataStoragePart switches back to: customXml/item1.xml and customXml/itemProps1.xml.

Can this behavior be changed?

Re: CustomXmlDataStoragePart gets overwritten to customXml

PostPosted: Thu Sep 08, 2016 9:17 am
by jason
You mean after editing in word?

No, word names the parts as it sees fit. The identifier in the item props file should not changed, so you can use that to find the custom XML part.

Or you can look through them to find the one with your root element.