0
点赞
收藏
分享

微信扫一扫

poi解析excel判断是否空行,有空行跳过

四月天2021 2023-12-22 阅读 34

//首先根据sheet.getRow(i)获取行
HSSFRow dataRow = sheet.getRow(i);
Boolean  aa=isRowEmpty(dataRow );
//如果aa为true则是空,如果为false,则改行有数据
public  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;
}

举报

相关推荐

0 条评论