在运用poi操作EXCEL中,发现只要EXCEL中有空单元格,poi便取不到 
报空指针异常
真不知道怎么解决了
哪位高手熟悉poi的,指教一下吧

解决方案 »

  1.   

    public static void size() {
    String fileToBeRead = "C:\\project_TMP\\testPrj\\新規.xls";
    try {
    HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(
    fileToBeRead));
    HSSFSheet sheet = workbook.getSheet("Sheet1"); for (int i = 0; i <= sheet.getLastRowNum(); i++) {
    HSSFRow row = sheet.getRow((short) i);
    if (null == row) {
    continue;
    } else {
    for (int j = 0; j <= row.getLastCellNum(); j++) {
    HSSFCell cell = row.getCell((short) j);
    if (null == cell) {
    continue;
    } else {
    System.out.println(cell.getStringCellValue());
    }
    }
    }
    }
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }判断一下不就行了?