You should already be able to do something like this:

POIXMLProperties.ExtendedProperties ext = doc.getProperties().getExtendedProperties();
ext.getUnderlyingProperties().setApplication("Microsoft Office Word");

(The Mac Office 2008 SP2 Workaround for XWPF.)

There should be setters for all the getters with all Core, Custom and Extended Properties.

https://svn.apache.org/repos/asf/poi/trunk/src/ooxml/java/org/apache/poi/POIXMLProperties.java

When you are done write the document and your property changes should be in the correct part.

Regards,
Dave


On Aug 3, 2009, at 1:04 PM, Aram Mirzadeh wrote:

Hi,

I need to update some custom properties in a docx.  I've gotten as far
as reading the variables:

public class UpdateWordDocument {

        public static void main(String[] args) throws Exception {
XWPFDocument doc = new XWPFDocument(POIXMLDocument.openPackage(fileName);
                CustomProperties props = 
doc.getProperties().getCustomProperties();
CTProperty[] ctp = props.getUnderlyingProperties().getPropertyArray();

                for (CTProperty foo : ctp) {
                        System.out.println(foo.toString());
                }
        }
}

I don't believe the code exists to update these property values and
write them back to the file.  If someone can point me to the proper
package and class, I can take a shot at providing a patch back.

Thanks.

Aram


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to