如何解决JXL错误:jxl.read.biff.BiffException:无法识别OLE流 [英] how to solve JXL error : jxl.read.biff.BiffException: Unable to recognize OLE stream

查看:3719
本文介绍了如何解决JXL错误:jxl.read.biff.BiffException:无法识别OLE流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我的.csv文件中获取单元格数据,但它收到错误:
jxl.read.biff.BiffException:无法识别OLE流

i am trying to get cell data from my .csv file but it gets error : jxl.read.biff.BiffException: Unable to recognize OLE stream

我不明白如何解决这个问题,请给我一些解决方案
此代码适用于jxl api&是对.csv的api支持吗?

I don't understand how to solve this,please give me some solution this code is for jxl api & is that api support to .csv?

参考代码:

public void read() throws IOException, BiffException  {

    File inputWorkbook = new File(inputFile);

    try
    {
        w = Workbook.getWorkbook(inputWorkbook.getAbsoluteFile());
        // Get the first sheet
        Sheet sheet = w.getSheet(0);
        // Loop over first 10 column and lines

        for (row = 1; row < sheet.getRows(); row++) 
        {
            ReadExcelLotSizeEntity readExcelLotSizeEntity =new ReadExcelLotSizeEntity();

                cell = sheet.getCell(1,row);
                type= cell.getType();
                if (cell.getType() == CellType.LABEL)
                {

                    symbol=cell.getContents();
                    System.out.println(":::::::::::::::::"+symbol);
                    readExcelLotSizeEntity.setSymbol(symbol);
                }   

                int col=2;
                cell = sheet.getCell(col,row);
                while(!cell.getContents().equals("")||cell.getContents()!=null)
                {
                    System.out.println("||||||||||||||||"+cell.getContents());
                    cell=sheet.getCell(col,row);
                    col++;
                }
                lotSize= new Double(cell.getContents());
                readExcelLotSizeEntity.setLotSize(lotSize);
                readExcelLotSizeEntity.setCreateUserId(1L);
                readExcelLotSizeEntity.setCreateDtTm(new Date());
                readExcelLotSizeHome.persist(readExcelLotSizeEntity);
            }

    } catch (BiffException e) {
        e.printStackTrace();
    }

}


推荐答案

我之前也遇到过这个问题。我用谷歌搜索并阅读了这篇帖子和其他许多要求解决这个 BiffException 的帖子。我没有确切的解决方案,但是当我解决了我的问题时,你也可以这样做。

I was also facing this problem earlier. I googled and read this post and many other posts that were asking for solution to this BiffException. I don't have the exact solution but as I fixed my problem you can do it too, perhaps.

我试图从保存在<\\ n的Excel文件中读取数据em> MS Office 2010 我收到此错误。我将文件保存为 Excel 2003-7 ,然后没有任何问题地阅读它。可能会出现此问题发生在 Office 10 中,而不是 Office 2003-7

I was trying to read data from the Excel file saved in MS Office 2010 and I was getting this error. I saved the file as an Excel 2003-7 and then read it without any problem. It may the case that this problem occurs in Office 10 but not in Office 2003-7.

我希望这将适用于您的情况。

I hope this will work in your case.

这篇关于如何解决JXL错误:jxl.read.biff.BiffException:无法识别OLE流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆