我从空单元格中得到错误。我需要显示excel中一列的所有内容。这是我试过的:
String Contents;
Contents = cell.getContents();
for(int j=1;j<=j+1;j++) {
if (Contents != null && Contents.length() != 0) {
Cell cell = sheet.getCell(i-1, j-1);
CellType type = cell.getType();
if (type == CellType.LABEL) {
System.out.println("" + cell.getContents());
}
if (type == CellType.NUMBER) {
System.out.println("" + cell.getContents());
}
}
}