首页 新闻 会员 周边

解析Excel空白单元格问题

0
悬赏园豆:5 [已解决问题] 解决于 2016-12-08 13:23
privatestaticString getValue(Cell cell){
if(cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) //布尔型
returnString.valueOf(cell.getBooleanCellValue());
elseif(cell.getCellType() == Cell.CELL_TYPE_BLANK) //空白
return null;
elseif(cell.getCellType() == Cell.CELL_TYPE_NUMERIC) //数字、日期
if(DateUtil.isCellDateFormatted(cell)){
Date date = cell.getDateCellValue();
DateFormat format = newSimpleDateFormat("yyyy-MM-dd hh:mm:ss");
returnformat.format(date);
} else
returnString.valueOf((long)cell.getNumericCellValue());//int
else
returnString.valueOf(cell.getStringCellValue()); //文本
}

空白处理 我想让他返回null 要在 //空白

这里如何处理?

骚年,你渴望力量吗的主页 骚年,你渴望力量吗 | 初学一级 | 园豆:45
提问于:2016-12-07 10:21
< >
分享
最佳答案
0

应该是cell的属性把null过滤掉了、

收获园豆:5
Ctrl` | 老鸟四级 |园豆:3317 | 2016-12-07 11:11
其他回答(1)
0

你的代码不就是已经return null了吗

让我发会呆 | 园豆:2929 (老鸟四级) | 2016-12-08 13:21

已经解决了我

清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册