public boolean isEmptyRow(Row row){
if(row == null || row.toString().isEmpty()){
return true;
}else{
Iterator<Cell> it = row.iterator();
boolean isEmpty = true;
while (it.hasNext()){
Cell cell = it.next();
if(cell.getCellTypeEnum() != CellType.BLANK){
isEmpty = false;
break;
}
}
return isEmpty;
}
}
//获取列数据(三种类型判断)
cell = row.getCell(colNum);
if (cell == null) { //数据为空的列
}
else{
if(cell.getCellTypeEnum() == CellType.NUMERIC) {
val = new BigDecimal(new Double(cell.getNumericCellValue()).toString());
val = new Double(cell.getNumericCellValue()).intValue();
}
else if(cell.getCellTypeEnum() == CellType.STRING) {
val = cell.getStringCellValue();
}
else if(cell.getCellTypeEnum() == CellType.BLANK) {}
}
poi判断excel行内容是否为空
最新推荐文章于 2024-07-20 03:09:47 发布