public static String getCellValue(XSSFCell cell) { if (cell == null) { return ""; } switch (cell.getCellType()) { case Cell.CELL_TYPE_STRING: String tmp = cell.getStringCellValue().trim(); return StringUtils.isEmpty(tmp) ? "" : tmp; case Cell.CELL_TYPE_NUMERIC: if (HSSFDateUtil.isCellDateFormatted(cell)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(cell.getDateCellValue()); } else { return new DecimalFormat("#.######").format(cell.getNumericCellValue()); } case Cell.CELL_TYPE_BOOLEAN: return String.valueOf(cell.getBooleanCellValue()); case Cell.CELL_TYPE_BLANK: return ""; case Cell.CELL_TYPE_ERROR: return ""; case Cell.CELL_TYPE_FORMULA: return String.valueOf(cell.getCellFormula().trim()); default: return ""; } }