2015-05-14 58 views
1

我想在我的Android應用程序中打開Excel文件。我已將該文件複製到資產文件夾(asset/Referance/myfile_db.xlsx)。在創建工作簿時,出現錯誤jxl.read.biff.BiffException: Unable to recognize OLE stream。這是我的代碼,jxl.read.biff.BiffException:無法識別OLE流

 try{ 
      InputStream is = context.getAssets().open("Referance/myfile_db.xlsx"); 
      if(is!=null){ 
       Workbook w = Workbook.getWorkbook(is); //Here am getting the Error 
       Sheet sheet = w.getSheet(0); 
       for (int j = 0; j < sheet.getRows(); j++) { 
        Cell cell = sheet.getCell(0, j); 
        System.out.println("Col "+j+": "+cell.getContents().toString()); 
        if(cell.getContents().trim().equalsIgnoreCase("Charger Rating Volts")){ 
         for (int i = 0; i < sheet.getColumns(); i++) { 
          Cell cel = sheet.getCell(i, j); 
          System.out.println("Col "+j+": "+cel.getContents().toString()); 
         } 
        } 
       } 
      } 
     }catch (Exception e) { 
      System.out.println("Error On Reading Excel : "+e.getMessage()); 
     } 

回答

0

此庫在導入時不支持.xlsx文件格式。