如何检查是否Excel单元格使用POI是空的? [英] How to check if an excel cell is empty using POi.?

查看:257
本文介绍了如何检查是否Excel单元格使用POI是空的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Poi.jar一个Excel工作表以输入,想知道如何检查如果单元格是空的。

I am taking input from an excel sheet using Poi.jar and wanted to know how to check if a cell is empty or not.

现在我米使用下面的code。

Right now I m using the below code.

cell = myRow.getCell(3);
            if (cell != null) {
                cell.setCellType(Cell.CELL_TYPE_STRING);

                //System.out.print(cell.getStringCellValue() + "\t\t");
                if (cell.getStringCellValue() != "")
                    depend[p] = Integer.parseInt(cell.getStringCellValue());

            }

任何人都可以请指导我吗?

Can anyone please guide me ?

推荐答案

如何

 Cell c = row.getCell(3);
 if (c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) {
    // This cell is empty
 }

这篇关于如何检查是否Excel单元格使用POI是空的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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