zoukankan      html  css  js  c++  java
  • java 读取excel 文件 Unable to recognize OLE stream 错误

    使用 java 代码读取 excel 文件代码时报错如下:

    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:268)
        at jxl.Workbook.getWorkbook(Workbook.java:253)
        at test1.main(test1.java:25)

    java 代码:

            Workbook wb = null;
            InputStream is = new FileInputStream("e://b2.xlsx");
            try {
                wb = Workbook.getWorkbook(is);
                Sheet rs = wb.getSheet(0);
                int colNum = 11;
                for (int i = 0; i < rs.getRows(); i++) {
                    String[] nextLine = new String[colNum];
                    for (int j = 0; j < colNum; j++) {
                        nextLine[0] = rs.getCell(j, i).getContents().trim();
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();        
            }

    原因:不支出读取 excel 2007 文件(*.xlsx)。只支持 excel 2003 (*.xls)。

  • 相关阅读:
    ansible-palybook剧本
    ansible服务的部署与使用
    keepalived实现nginx高可用
    Linux下通过uptime判断负载情况
    2个无线路由器怎么连接
    Delphi FastReport动态加载图片 (转载)
    SQLite 日期 & 时间
    SuperObject使用
    php int 与 datetime 转换
    sqlserver 2005/2008 导入超大sql文件
  • 原文地址:https://www.cnblogs.com/toSeeMyDream/p/4233679.html
Copyright © 2011-2022 走看看