CELL_TYPE_STRING cannot be resovled or is not a field
程序员文章站
2022-04-27 23:43:40
...
参考链接:https://*.com/questions/52514468/cell-type-string-cannot-be-resolved-or-is-not-a-field
参考链接:https://blog.csdn.net/weixin_43209201/article/details/86519522
Java操作Excel之POI: HSSFCell.CELL_TYPE_STRING、HSSFCell.CELL_TYPE_BOOLEAN和HSSFCell.CELL_TYPE_NUMERIC无定义
解决办法
导入CellType包import org.apache.poi.ss.usermodel.CellType;
使用CellType.STRING代替HSSFCell.CELL_TYPE_STRING
同理,HSSFCell.CELL_TYPE_BOOLEAN、HSSFCell.CELL_TYPE_NUMERIC等无定义的解决办法与上面类似。
switch (cell.getCellType()) {
case NUMERIC:{
cellValue = String.valueOf(cell.getNumericCellValue());
break;
}
case STRING:{
cellValue = cell.getStringCellValue();
break;
}
case BOOLEAN:{
break;
}
case FORMULA:{
break;
}
default:
break;
}
推荐阅读
-
Property or field ‘XXX‘ cannot be found on null
-
java菜鸟疑问1:为什么我的代码总出现cannot be resolved or is not a field这种问题
-
CELL_TYPE_STRING cannot be resovled or is not a field
-
APPLICATION_JSON cannot be resolved or is not a field
-
Property or field 'LevelName' cannot be found on null
-
Property or field 'demoService1' cannot be found
-
Property or field 'str' cannot be found on object of type 'com.yubai.EL.DemoService' - maybe not pub
-
SpringBoot踩坑记录:@Cacheable报错EL1007E: Property or field 'code' cannot be found on null
-
raw cannot be resolved or is not a field解决