poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Ferreira Castro <daniel.cas...@avantiprima.com.br>
Subject Doubt updating a DOCX
Date Thu, 20 Jun 2013 20:21:27 GMT

I am having difficutiles tryiing to save a document - DOCX - with the
updated value of some custom properties.

I read the custom properties
I update the value of the custom properties
I save the file with the updated values of custom properties.
When I open the saved fil on word 2007 the file open with the old value of
the custom properties and I need to right click over the filed and manually
update field.  My goal is to avoid this last step, so when I open the saved
file it already shows the actual value of the properties.

I have no idea how to do it.  I looked around internet, but nothing found.

This is the code that I am running.

public static void main(String[] args) throws IOException {
OPCPackage ocpackage =
XWPFDocument doc = new XWPFDocument(ocpackage);
FileOutputStream out = new
CustomProperties props = doc.getProperties().getCustomProperties();
List <CTProperty> ctp = props.getUnderlyingProperties().getPropertyList();
POIXMLProperties.ExtendedProperties ext = doc.getProperties()
ext.getUnderlyingProperties().setApplication("Microsoft Office Word");
for (CTProperty foo : ctp) {

Daniel Ferreira Castro

Arquiteto JEE
ITIL Foundations, BEA Enterprise Architect, BEA Portal Solutions, BEA Build
Solutions, SOA Implementation Champion, SOA Support Champion

View raw message