Nick Burch-11 wrote:
>
>
> You could try grabbing the contents, deleting it, adding a new one with
> the new content type, then putting the contents back?
>
>
I tried that, but of course the load method is not implemented:
for(PackagePart part : parts) {
if(part.getContentType().equals(XWPFRelation.TEMPLATE.getContentType())) {
InputStream content = part.getInputStream();
PackagePartName partName = part.getPartName();
pkg.removePart(part);
part = pkg.createPart(partName,
XWPFRelation.DOCUMENT.getContentType());
part.load(content);
}
}
Exception in thread "main"
org.apache.poi.openxml4j.exceptions.InvalidFormatException: Method not
implemented
at
org.apache.poi.openxml4j.opc.internal.MemoryPackagePart.load(MemoryPackagePart.java:114)
Don't know if this would help anyway. I tried to unzip the dotx file and
manually change the content-type for word/document.xml from template to
document. Then I renamed it. However, still can't open it in office 2010.
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/Open-dotx-and-save-as-docx-tp4270908p4271290.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]