Unter Verwendung von Code, ich bekomme jxl.read.biff.BiffException: Unable to recognize OLE stream
. Ich möchte XLS- und XLSX-Formatdateien verwenden. Wie löst man das?Erhalten Jxl.read.biff.BiffException Ausnahme beim Lesen .xls und .xlsx-Format Excel-Dateien
Service.java
@Override
public boolean facultyDump(String path, HttpSession httpSession) {
Session session=sessionFactory.openSession();
session.beginTransaction();
File inputWorkbook = new File(path);
Workbook w;
try{
w = Workbook.getWorkbook(inputWorkbook);
Sheet sheet = w.getSheet(0);
for (int i = 1; i < sheet.getRows(); i++) {
for (int j = 0; j < sheet.getColumns(); j++) {
Cell cell = sheet.getCell(j, i);
if (j == 0) {
String name= cell.getContents().trim();
}
}
}
}catch(Exception ex){
ex.printStackTrace();
}finally{
session.close();sessionFactory.close();
}
return false;
}
Ausnahme bei Console:
jxl.read.biff.BiffException: Unable to recognize OLE stream
at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:116)
at jxl.read.biff.File.<init>(File.java:127)
at jxl.Workbook.getWorkbook(Workbook.java:221)
at jxl.Workbook.getWorkbook(Workbook.java:198)
at com.slv.daoimpl.RegistrationDaoImpl.facultyDump(RegistrationDaoImpl.java:2845)
at com.slv.controller.SuperAdminController.facultyDumpExcel(SuperAdminController.java:327)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
prüfen diese Frage [ „Kann nicht OLE-Stream erkennen“ excepion während in Excel verbinden ] (http://stackoverflow.com/questions/5497681/nicht erkennbare-ole-stream-exception-while-connecting-to-excel) – Rhain