java - Can not read .xlsm file - POI -


i have written code access .xlsm file fails so. have tried same file using both xssfworkbook , generic workbook done using workbookfactory.

scenario 1:

org.apache.poi.ss.usermodel.workbook workbook = workbookfactory.create(new  file(                 "/filename.xlsm")); 

error:

the supplied spreadsheet seems encrypted .xlsx file. must decrypted before use xssf, cannot used hssf.

so left generic way of reading file , used xssf.

scenario 2:

 xssfworkbook workbook = new xssfworkbook(new fileinputstream(new      file("/filename.xlsm"))); 

error:

org.apache.poi.poixmlexception: org.apache.poi.openxml4j.exceptions.invalidformatexception: package should contain content type part [m1.13]

both scenarios work on .xlsm files. properties , data working , non working files same.

can in fixing this.?

promoting comment answer... need upgrade version of apache poi!

you can view apache poi changelog here, , see quite how many changes there have been since 3.9 came out 3 years ago. it's quite number of pages of fixes! , need @ least 1 of those...


Comments