如何解决 JXL 错误: jxl.read.biff.BiffException: 无法识别 OLE 流
我正在尝试从我的.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();
}
}