java.lang.IllegalStateException: Cannot get a STRING value from a NUMERIC cell 個人用
阿新 • • 發佈:2020-08-26
出現這種 就 新增 以下程式碼
CellType.STRING string 型別
row.getCell(0).setCellType(CellType.STRING);
CellType.NUMERIC 數字單元格型別(整數,小數,日期)
row.getCell(1).setCellType(CellType.NUMERIC);
row.getCell(2).setCellType(CellType.STRING);
row.getCell(3).setCellType(CellType.STRING);
row.getCell( 4).setCellType(CellType.STRING);
row.getCell(5).setCellType(CellType.STRING);
獲取
獲取時間型別的 getDateCellValue()
Date createTime = row.getCell(1).getDateCellValue();
System.out.println("createTime==="+createTime);
getStringCellValue() 獲取時間型別的
String idcard = row.getCell(2).getStringCellValue();
String car = row.getCell(3).getStringCellValue();
String sex = row.getCell(4).getStringCellValue();
String phone= row.getCell(5).getStringCellValue();