如何确定空行?
问题描述:
如何使用 Apache POI 确定 .xls 文档中的空行?
How I can determine empty rows in .xls documents using Apache POI?
答
我在我的 POI 项目中使用了以下方法并且它运行良好.这是泽勒解决方案的变体.
I'm using the following method in my POI project and it's working well. It is a variation of zeller's solution.
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;
}