Cannot get a text value from a numeric cell
2014-12-04 10:45
441 查看
在使用poi读取excel时报错为:Cannot get a text value from a numeric cell
刚开始的写法为:
Cell cell = row.getCell(j);
if (cell == null) {
continue;
}
switch(cell.getCellType()){
case Cell.CELL_TYPE_BOOLEAN :
cell.getBooleanCellValue();
case Cell.CELL_TYPE_STRING :
cell.getStringCellValue();
case Cell.CELL_TYPE_NUMERIC:
cell.getNumericCellValue();
}
后改为:
Cell cell = row.getCell(j);
if (cell == null) {
continue;
}
cell.setCellType(Cell.CELL_TYPE_STRING);
str = cell.getStringCellValue();
就不报错了。
刚开始的写法为:
Cell cell = row.getCell(j);
if (cell == null) {
continue;
}
switch(cell.getCellType()){
case Cell.CELL_TYPE_BOOLEAN :
cell.getBooleanCellValue();
case Cell.CELL_TYPE_STRING :
cell.getStringCellValue();
case Cell.CELL_TYPE_NUMERIC:
cell.getNumericCellValue();
}
后改为:
Cell cell = row.getCell(j);
if (cell == null) {
continue;
}
cell.setCellType(Cell.CELL_TYPE_STRING);
str = cell.getStringCellValue();
就不报错了。
相关文章推荐
- 使用POI导入Excel并解决Cannot get a text value from a numeric formula cell
- Cannot get a text value from a numeric cell “Poi”
- 使用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解决
- 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 cell
- 【POI】 Excel导入异常Cannot get a text value from a numeric cell解决
- 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的异常错误
- java.lang.IllegalStateException: Cannot get a numeric value from a text cel
- HSSFCell:You cannot get a string value from a numeric cell
- Exception in thread "main" java.lang.IllegalStateException: Cannot get a text value from a numeric c