Mark,
You were right ...
XWPFDocument doc = new
XWPFDocument(POIXMLDocument.openPackage("c:\\test.docx"));
CustomProperties props = doc.getProperties().getCustomProperties();
CTProperty[] ctp =
props.getUnderlyingProperties().getPropertyArray();
for (CTProperty foo : ctp) {
System.out.println(foo.toString());
}
Prints out the variables in an XML format.
Now the question is how do you update them since there is no
setProperties() method?
Thanks.
Aram
MSB wrote:
I think that the support for this task is there.
Take a look at the XWPFDocument class. You should see that it extends the
POIXMLDocument class and that this class declares method with the following
signature - public POIXMLProperties getProperties(). To quote the javadoc,
it will "Get the document properties. This gives you access to the core
ooxml properties, and the extended ooxml properties." I have never used this
myself but think it could be the best place to start looking.
To get you started, you can access an OpenXML document this way;
XWPFDocument document = new XWPFDocument(OPCPackage.create(new
java.io.File("your file")));
POIXMLProperties docProps = document.getProperties();
Yours
Mark B
Aram Mirzadeh-2 wrote:
Hello,
I have a task to update the properties (custom variables) of a DOCX file
(Office 2007). I tried looking on POI's website but I can only find a
reference to a XPFFWordExtractor but not much else in terms of docx
support. I know it's still in very early development, but I was hoping
this is a simple enough task that it was done already.
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]