Unable to recognize OLE stream 的解決方法
將xlsx用excel打開並另存為2003的xls,然后再運行即可解決問題
File file = new File("E:\\work.xls"); Workbook workbook = Workbook.getWorkbook(file); //2:獲取第一個工作表sheet Sheet sheet = workbook.getSheet(0); for (int i = 0; i < sheet.getRows(); i++) { Stu bean = null; String name=""; String num=""; for (int j = 0; j < sheet.getColumns(); j++) { Cell cell = sheet.getCell(j, i); bean = new Stu(); if (j == 1) name = cell.getContents(); if (j == 4) num = cell.getContents(); } map.put(name,num); } //最后一步:關閉資源 workbook.close();