jxl.read.biff.BiffException:无法识别OLE流

时间:2015-05-14 11:40:25

标签: java android excel xlsx

我想在Android应用程序中打开一个Excel文件。我已将文件复制到资产文件夹(asset/Referance/myfile_db.xlsx)。在创建工作簿时,我收到错误jxl.read.biff.BiffException: Unable to recognize OLE stream。这是我的代码,

       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());
        }

1 个答案:

答案 0 :(得分:0)

此库在导入时不支持.xlsx文件格式。

相关问题