private String getValue(Cell cell,int row, int cl) {
String value = "";
try {
switch (cell.getCellType()) {
case Cell.CELL_TYPE_NUMERIC:
if(DateUtil.isCellDateFormatted(cell)){
Date d=cell.getDateCellValue();
DateFormat formater=new SimpleDateFormat("yyyy-MM-dd");
value=formater.format(d);
}else{
value = String.valueOf(cell.getNumericCellValue());
}
break;
case Cell.CELL_TYPE_STRING:
value = cell.getStringCellValue();
break;
case Cell.CELL_TYPE_BOOLEAN:
value = String.valueOf(cell.getBooleanCellValue());
break;
case Cell.CELL_TYPE_FORMULA:
//value = cell.getCellFormula();
try{
value=String.valueOf(cell.getNumericCellValue());
}catch(Exception e){
value=String.valueOf(cell.getRichStringCellValue());
}
break;
default:
break;
}
} catch (Exception e) {
System.out.println("第"+row+"行,第"+cl+"列输入错误");
e.printStackTrace();
}
return value;
}