Excel异常Cannot get a text value from a numeric cell
2015-06-01 16:32
246 查看
POI操作Excel时数据Cell有不同的类型,当我们试图从一个数字类型的Cell读取出一个字符串并写入数据库时,就会出现Cannot get a text value from a numeric cell的异常错误,解决办法就是先设置Cell的类型,然后就可以把纯数字作为String类型读进来了:
if(row.getCell(7)!=null){
row.getCell(7).setCellType(Cell.CELL_TYPE_STRING);
stuUser.setPhone(row.getCell(7).getStringCellValue());
}
if(row.getCell(7)!=null){
row.getCell(7).setCellType(Cell.CELL_TYPE_STRING);
stuUser.setPhone(row.getCell(7).getStringCellValue());
}
相关文章推荐
- iOS AFN请求返回错误:"Request failed: unacceptable content-type: text/html"
- Xcode出现could not build module foundation错误 解决方案
- 提高Interface Builder高效工作的8个技巧
- JavaString、StringBuilder、StringBuffer总结
- java获取request所有参数简单方法
- iOS Storyboard UI框架搭建,UITabBarController UINavigationController
- 用ImageBuilder定制自己的openwrt路由器
- Vijava 学习笔记之 CustomizationSysprep、CustomizationGuiRunOnce、CustomizationGuiUnattended
- @PathVariable和@RequestParam的区别
- Implementing NSFetchedResultsController for UICollectionView
- STL源码剖析---stack,queue
- UIKit 框架之UISearchBar、UITableViewController
- Android UI 中常用技巧总结
- SeaJS与RequireJS最大的区别
- Android---手动创建线程与GUI线程同步(一)
- system build folder Makefile & config
- SoapUI 使用教程链接
- UILabel的使用
- Blue Jeans(3080)
- iOS - ASI - ASIFormDataRequest 上传文件到服务器(转载)