如何确定空行? [英] How to determine empty row?

查看:27
本文介绍了如何确定空行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 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;
}

这篇关于如何确定空行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆