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.
POI does not support .odt files, only the Microsoft binary and ooxml file formats You need to use a different library that supports the open office file formats