Excel导入异常Cannot get a text value from a numeric cell解决
来源:互联网 发布:网络管理考试题 编辑:程序博客网 时间:2024/05/21 22:41
POI操作Excel时偶尔会出现Cannot get a text value from a numeric cell的异常错误。
异常原因: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());
}
0 0
- 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解决
- 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
- 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
- Cannot get a text value from a numeric cell
- Cannot get a text value from a numeric cell “Poi”
- 锁的种类
- html js获取系统时间
- Eclipse—使用Maven构建Web Project
- SDL编程三(音频)
- python中增加新模块
- Excel导入异常Cannot get a text value from a numeric cell解决
- Qt DLL总结【三】-VS2008+Qt 使用QPluginLoader访问DLL
- 矩阵的运算
- ExpandableListview中 解决ImageButton冲突的问题。
- OCP 1Z0 052 63
- 兼容各个浏览器的H.264播放: H.264+HTML5+FLOWPLAYER+WOWZA+RMTP
- android中调试Service的方法
- error code [1260]; %d line(s) were cut by GROUP_CONCAT();
- 《Linux驱动基础篇》- Linux内核定时器