I thought that too. I have tried:
OPCPackage pkg = OPCPackage.open(filepath);
List parts = pkg.getParts();
for(PackagePart part : parts) {
if(part.getContentType().equals(XWPFRelation.TEMPLATE.getContentType())) {
ZipPackagePart zipPart = (ZipPackagePart)part;
zipPart.setContentType(XWPFRelation.DOCUMENT.getContentType());
}
}
}
However, I'm not allowed to change it. Do you have any example?
"Exception in thread "main"
org.apache.poi.openxml4j.exceptions.InvalidOperationException: You can't
change the content type of a part."
I also tried to remove it and add a new, but then document.xml in the zipped
docx file is zero kb.
Johan
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/Open-dotx-and-save-as-docx-tp4270908p4271227.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]