我正在尝试检查空的Excel工作表的单元格是否为空,方法是使用“==”但是获取Null pointer exception
。为什么?有没有办法成功地做到这一点。我使用过POI JARs
。
FileInputStream fi = new FileInputStream(new File(sss));
XSSFWorkbook workbook = new XSSFWorkbook(fi);
//Get first/desired sheet from the workbook
XSSFSheet sheet = workbook.getSheetAt(0);
row=sheet.getRow(0);
if(row.getCell(0)==null)
System.out.println("Cell is null");
else
System.out.println("Cell is not null");