Maven - org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException: | بلاگ

Maven - org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException:

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

i am using maven repository with dependency of apache poi-ooxml 3.15. I am able to read from excel file but when it comes to write, error is

My office is activated.

    public static void saveIntoExcel(List title, List price) throws IOException, InvalidFormatException{

            File file = new File("./file/ReadExcel.xlsx");

            FileOutputStream fis =  new FileOutputStream(file);


            XSSFWorkbook wb = new XSSFWorkbook(file);
            XSSFSheet sheet = wb.getSheetAt(0);     

            System.out.println(sheet.getPhysicalNumberOfRows());


            for(int i = 0; i < 30 ; i++){

                int j = 0;

                sheet.getRow(i+1).createCell(j).setCellValue(title.get(i).getText());
                sheet.getRow(i+1).createCell(j+1).setCellValue(price.get(i).getText());
                wb.write(fis);

            }

            wb.close();

org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException: No valid entries or contents found, this is not a valid OOXML (Office Open XML) file
    at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:290)
    at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:774)
    at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:308)
asked 1 min ago
naqash

...
نویسنده : استخدام کار بازدید : 22 تاريخ : دوشنبه 27 شهريور 1396 ساعت: 1:53