使用POI导入Excel异常Cannot get a text value from a numeric cell 解决
POI操作Excel时因为Excel数据Cell有不同的类型,会出现Cannot get a text value from a numeric cell的异常错误。
异常原因:Excel数据Cell有不同的类型,当我们试图从一个数字类型的Cell读取出一个字符串并写入数据库时,就会出现Cannot get a text value from a numeric cell的异常错误。
此异常常见于类似如下代码中:row.getCell(i).getStringCellValue();
解决办法:先设置Cell的类型,将其他类型先转换成String类型
HSSFCell cell = row.getCell(j);
                    if (row.getCell(j)!=null) {
                        row.getCell(j).setCellType(Cell.CELL_TYPE_STRING);
                    }                    
                    String value = cell.getStringCellValue();
使用POI导入Excel异常Cannot get a text value from a numeric cell 解决的更多相关文章
- Java使用POI导入Excel异常Cannot get a text value from a numeric cell 解决
		
异常原因:Excel数据Cell有不同的类型,当我们试图从一个数字类型的Cell读取出一个字符串并写入数据库时,就会出现Cannot get a text value from a numeric c ...
 - POI操作Excel异常Cannot get a text value from a numeric cell
		
控制台抛出异常:java.lang.IllegalStateException: Cannot get a text value from a numeric cell 在java中用POI解析exc ...
 - Excel导入异常Cannot get a text value from a numeric cell解决及poi导入时注意事项
		
POI操作Excel时偶尔会出现Cannot get a text value from a numeric cell的异常错误. 异常原因:Excel数据Cell有不同的类型,当我们试图从一个数字类 ...
 - [转]Excel导入异常Cannot get a text value from a numeric cell解决
		
原文地址:http://blog.csdn.net/ysughw/article/details/9288307 POI操作Excel时偶尔会出现Cannot get a text value fro ...
 - Excel导入异常Cannot get a text value from a numeric cell解决
		
POI操作Excel时偶尔会出现Cannot get a text value from a numeric cell的异常错误. 异常原因:Excel数据Cell有不同的类型,当我们试图从一个数字类 ...
 - Excel异常Cannot get a text value from a numeric cell
		
POI操作Excel时数据Cell有不同的类型,当我们试图从一个数字类型的Cell读取出一个字符串并写入数据库时,就会出现Cannot get a text value from a numeric ...
 - 使用poi读取excel文件 Cannot get a text value from a numeric cell
		
我这样转换得到一个excel文本域的值 Cell cell = row.getCell(c); cell.setCellType(Cell.CELL_TYPE_STRING); String park ...
 - 异常Cannot get a text value from a numeric cell
		
POI操作Excel时偶尔会出现Cannot get a text value from a numeric cell的异常错误. 异常原因:Excel数据Cell有不同的类型,当我们试图从一个数字类 ...
 - poi导入Excel,数字科学记数法转换
		
在这里分享一下使用poi 导入Excel时 把数字转换为科学记数法的解决方法: 就是使用DecimalFormat对 i 进行了格式化 结果为:
 
随机推荐
- (C++) Interview in English. -  Constructors/Destructors
			
Constructors/Destructors. 我们都知道,在C++中建立一个类,这个类中肯定会包括构造函数.析构函数.复制构造函数和重载赋值操作:即使在你没有明确定义的情况下,编译器也会给你生成 ...
 - (C#) 判断相等?
			
值类型直接用 == 号判断就好. 但是对于引用类型,需要实现IComparable 接口,或者重写 Equal 方法,来实现自己的比较目的. 因为对于引用类型,==号比较的是入口地址,对于同一个cla ...
 - DBA_Oralce Enterprise Manager OEM管理应用介绍(案例)
			
2014-08-16 BaoXinjian
 - OAF_VO系列4 - Row Imp的分析(概念)
			
20150706 Created By BaoXinjian
 - linux命令(9)设定固定ip
			
一.使用命令设置ubuntu的ip地址 1.修改配置文件blacklist.conf禁用IPV6: sudo vi /etc/modprobe.d/blacklist.conf 2.在文档最后添加 b ...
 - [实变函数]5.2 非负简单函数的 Lebesgue 积分
			
1 设 $$\bex \phi(x)=\sum_{i=1}^j c_i\chi_{E_i}(x),\quad c_i\geq 0, \eex$$ 其中 ...
 - 关于 MySQL 的 boolean 和 tinyint(1) (转)
			
boolean类型MYSQL保存BOOLEAN值时用1代表TRUE,0代表FALSE,boolean在MySQL里的类型为tinyint(1),MySQL里有四个常量:true,false,TRUE, ...
 - eclipse ide for java ee developers 开发环境搭建(j2ee)
			
转载自:http://www.iteye.com/topic/982182 真的是一片很不错的文章啊! 使用eclipse真的有年头了,相信java程序员没有不知道它的,最近在给团队中新来的应届生做指 ...
 - (C) Windows 32 API程序设计目录
			
(一)第一个窗口程序 01 创建第一个窗口. (二)输出文本 01 获取Windows图形构件大小信息
 - 织梦CMS站点favicon.ico图标的放置
			
1.在线制作一个ico图标,推荐制作网站:http://ico.55.la/.制作好后,将favicon.ico图标放在站点模板默认目录下的images文件夹里. 2.在index.htm的<h ...