gpt4 book ai didi

java - 如何解决 JXL 错误 : jxl. read.biff.BiffException: Unable to recognize OLE stream

转载 作者:太空狗 更新时间:2023-10-29 22:41:49 27 4
gpt4 key购买 nike

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

我不知道怎么解决,请给我一些解决方案此代码适用于 jxl api 并且该 api 是否支持 .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 问题的文章。我没有确切的解决方案,但当我解决了我的问题时,也许你也可以这样做。

我试图从保存在 MS Office 2010 中的 Excel 文件中读取数据,但遇到此错误。我将文件保存为 Excel 2003-7,然后毫无问题地读取它。 Office 10 可能会出现此问题,但 Office 2003-7 不会出现此问题。

我希望这对你有用。

关于java - 如何解决 JXL 错误 : jxl. read.biff.BiffException: Unable to recognize OLE stream,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9799059/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com