Java POI the supplied data appears to be in the Office 2007+ XML

后端 未结 3 2014
陌清茗
陌清茗 2020-12-03 07:22

I am getting this error:

org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are call

3条回答
  •  Happy的楠姐
    2020-12-03 08:01

    well actually there is no OPCPackage, I am using https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml/3.5-beta5 so you have to:

    import org.apache.poi.openxml4j.opc.Package;
    ....
    Package fs = Package.open(new ByteArrayInputStream(container.getContent()));
                XSSFWorkbook wb = new XSSFWorkbook(fs);
                XSSFSheet sheet = wb.getSheetAt(0);
                XSSFRow row;
                XSSFCell cell;
    

提交回复
热议问题