乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > 解决POI读取Excel如何判断行是不是为空

解决POI读取Excel如何判断行是不是为空

作者:乔山办公网日期:

返回目录:excel表格制作


项目zhidao中常用的写法:
public static boolean isRowEmpty(Row row) {
for (int c = row.getFirstCellNum(); c < row.getLastCellNum(); c++) {
Cell cell = row.getCell(c);
if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK)
return false;
}
return true;
}

项目中常用的写法
public static boolean isRowEmpty(Row row) {
for (int c = row.getFirstCellNum(); c < row.getLastCellNum(); c++) {
Cell cell = row.getCell(c);
if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK)
return false;
}
return true;
}
poi没有提供原生的方法,需要自己写,参考我写的。publicstaticbooleanisRowEmpty(Rowrow){for(intc=row.getFirstCellNum();c

if(row == null){
continue;
}

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网