POI does not support the Open Document Format (odt, ods, etc) files irrespective of which application created them. If you are looking for a Java api that will support this type of file then you need to use the ODFToolkit - http://odftoolkit.openoffice.org/
Yours Mark B Bugzilla from [email protected] wrote: > > https://issues.apache.org/bugzilla/show_bug.cgi?id=49222 > > Summary: Cant read odt file created in both OpenOffice 3.2 and > MicrosoftOffice2007 > Product: POI > Version: 3.6 > Platform: PC > OS/Version: Windows XP > Status: NEW > Severity: normal > Priority: P2 > Component: XWPF > AssignedTo: [email protected] > ReportedBy: [email protected] > > > When I try to open odt file poi throws Exception as follows: > Exception in thread "main" org.apache.poi.POIXMLException: > org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should > contain a content type part [M1.13] > at org.apache.poi.util.PackageHelper.open(PackageHelper.java:55) > at > org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:98) > at pl.macio.WordGenerator.generate(WordGenerator.java:109) > at pl.macio.WordGenerator.main(WordGenerator.java:87) > Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: > Package > should contain a content type part [M1.13] > at > org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:147) > at > org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585) > at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:201) > at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:178) > at org.apache.poi.util.PackageHelper.open(PackageHelper.java:53) > ... 3 more > > WordGenerator is my class in which I try to open some odt file: > line 108 is: InputStream fis = new FileInputStream(inFileName); > line 109 is: XWPFDocument doc = new XWPFDocument(fis); > > This exception is thrown in fact by ZipPackage.getPartsImpl(). > As this method is looking for entry with name ("[Content_Types].xml" - > ContentTypeManager.CONTENT_TYPES_PART_NAME), but in files stored in both > OpenOffice and MSOffice there is nothing like this. > > -- > Configure bugmail: > https://issues.apache.org/bugzilla/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You are the assignee for the bug. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > -- View this message in context: http://old.nabble.com/DO-NOT-REPLY--Bug-49222--New%3A-Cant-read-odt-file-created-in-both-OpenOffice-3.2-and-MicrosoftOffice2007-tp28401625p28409035.html Sent from the POI - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
