Yes. Switching to ooxml-schemas-1.1 fixed the problem and I can now
access and change the properties on an Excel 2007 spreadsheet.
I tried to apply the same logic for a Powerpoint 2007 slideshow:
FileInputStream pptFileStream = new FileInputStream(pptxInput);
OPCPackage pkg = OPCPackage.open(pptFileStream);
XSLFSlideShow ss = new XSLFSlideShow(pkg);
pkg.close();
pptFileStream.close();
// Retrieve the custom properties from the file
//
POIXMLProperties p = ss.getProperties();
CTProperty[] properties =
p.getCustomProperties().getUnderlyingProperties().getPropertyArray();
for (int i = 0; i < properties.length; i++)
{
if (properties[i].getLinkTarget() == null)
{
if (properties[i].isSetLpwstr())
{
properties[i].setLpwstr(" ");
}
}
}
p.commit();
OutputStream out = new FileOutputStream(pptxInput);
ss.write(out);
out.close();
But the p.commit() method call causes an exception:
org.apache.poi.openxml4j.exceptions.InvalidOperationException:
Operation not allowed, document open in read only mode!
What am I neglecting to do that will allow the code to write out the file
with the blank properties?