cant find close() method on Apache WorkbookFactory

后端 未结 2 377
[愿得一人]
[愿得一人] 2021-01-26 03:04

i read about Apache WorkbookFactory

the guide are saying to close workbook when done. \"Workbook should be closed after use\"

but i dont have a close method to c

2条回答
  •  爱一瞬间的悲伤
    2021-01-26 03:49

    Workbook.close() was implemented in poi 3.11 version.

    You have to close your output stream after work with workbook is done and it was written.

    From POI user guide:

    Workbook wb = new XSSFWorkbook();
    FileOutputStream fileOut = new FileOutputStream("workbook.xlsx");
    wb.write(fileOut);
    fileOut.close();
    

    Don't forget to close workbook as well:

    wb.close();
    

提交回复
热议问题