How to check if xlsx file is password protected or not using apache poi

前端 未结 3 612
广开言路
广开言路 2020-12-07 03:42

How to check if xlsx file is password protected or not. we can check for xls file as follows

FileInputStream fin = new FileInputStream(new File(\"C:/Book1.xl         


        
3条回答
  •  旧巷少年郎
    2020-12-07 04:20

    Try using

    XSSFWorkbook wb = new XSSFWorkbook(dataStream);
    

    From Apache POI: "HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) file format. XSSF is the POI Project's pure Java implementation of the Excel 2007 OOXML (.xlsx) file format." http://poi.apache.org/spreadsheet/ You're using the HSSF (which will work for xls) on a XLSX file.

提交回复
热议问题