Excel导入异常:Cannot get a text value from a numeric cell
2017-09-04 17:16
627 查看
POI操作Excel时偶尔会出现Cannot get a text value from a numeric cell的异常错误,这不,小编就碰上了。
异常原因
Excel数据Cell有不同的类型,当我们试图从一个数字类型的Cell读取出一个字符串并写入数据库时,就会出现Cannot get a text value from a numeric cell的异常错误。
小编出现此异常的问题代码如下:
解决办法
先设置Cell的类型,然后就可以把纯数字作为String类型读进来了:
异常原因
Excel数据Cell有不同的类型,当我们试图从一个数字类型的Cell读取出一个字符串并写入数据库时,就会出现Cannot get a text value from a numeric cell的异常错误。
小编出现此异常的问题代码如下:
row.getCell(0).getStringCellValue();
解决办法
先设置Cell的类型,然后就可以把纯数字作为String类型读进来了:
if(row.getCell(0)!=null){ row.getCell(0).setCellType(Cell.CELL_TYPE_STRING); stuUser.setPhone(row.getCell(0).getStringCellValue()); }
相关文章推荐
- Excel导入异常Cannot get a text value from a numeric cell解决
- 【POI】 Excel导入异常Cannot get a text value from a numeric cell解决
- Excel导入异常Cannot get a text value from a numeric cell解决
- [转]Excel导入异常Cannot get a text value from a numeric cell解决
- 使用poi 强制数字转字符串以及Excel导入异常Cannot get a text value from a numeric cell解决
- Excel导入异常Cannot get a text value from a numeric cell解决
- 导入Excel出现Cannot get a text value from a numeric cell异常
- Excel导入异常Cannot get a text value from a numeric cell解决
- Excel导入异常Cannot get a text value from a numeric cell解决
- 使用POI导入Excel并解决Cannot get a text value from a numeric formula cell
- POI操作Excel时出现异常:Cannot get a text value from a numeric cell
- poi导入excel表格数据时Cannot get a text value from a numeric cell
- POI操作Excel时出现Cannot get a text value from a numeric cell的异常错误
- java使用poi解析Excel遇到Cannot get a text value from a numeric cell
- POI 读取Excel时:Cannot get a text value from a numeric cell
- Cannot get a text value from a numeric cell
- java读写excel时出现Cannot get a NUMERIC value from a STRING cell的解决方法
- Cannot get a text value from a numeric cell “Poi”
- HSSFCell:You cannot get a string value from a numeric cell
- java.lang.IllegalStateException: Cannot get a numeric value from a text cel