java读取文件异常

java读取文件异常,第1张

java读取文件异常

读取excel时报错:Exception in thread “main” java.lang.IllegalStateException: Cannot get a text value from a numeric cell

问题代码在这一行row.getCell(j).getStringCellValue();

原因时类型问题,需要先把格式转成为string,所以在这行代码上面添加

row.getCell(j).setCellType(Cell.CELL_TYPE_STRING);
fields[j] = row.getCell(j).getStringCellValue();

则可以解决

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5684547.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存