tôi đang cố gắng lấy dữ liệu ô từ tệp .csv của tôi nhưng nó bị lỗi: jxl.read.biff.BiffException: Không thể nhận dạng dòng OLEcách giải quyết lỗi JXL: jxl.read.biff.BiffException: Không thể nhận dạng luồng OLE
Tôi không hiểu cách giải quyết vấn đề này, vui lòng cung cấp cho tôi một số giải pháp mã này dành cho jxl api & là hỗ trợ api cho .csv?
Mã để tham khảo:
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();
}
}
Đây không phải là câu trả lời, đó là công việc cắt và dán của câu trả lời phổ biến nhất được 4 năm trước nỗ lực của bạn! – DaveRlz