Hi Dave, Thank you, I actually didn't know this existed either. The properties that I need to modify are actually "Custom" properties. These are human added variables. They are stored in custom.xml under docProps in the docx zip package.
Please let me know if I missed it in the code, but I couldn't find any setters for the customVariables. Thanks. Aram P.S. An example of custom.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" name="customerLongName"><vt:lpwstr>Customer Long Names</vt:lpwstr></property><property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="3" name="SomethingElse"><vt:lpwstr>123</vt:lpwstr></property></Properties> Dave Fisher wrote: > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
