poi讀取excel的時候判斷空行

    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;
    }

sheet.getFirstRowNum()// 獲取開始行位置

sheet.getLastRowNum()// 獲取結束列位置

row.getFirstCellNum() // 獲取開始列位置

row.getLastCellNum() // 獲取結束列位置

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章