/**
? * 獲取cell中的數據
? * @param cell
? * @return
? */
?private String readCell(HSSFCell cell) {
??if (null == cell) {
???return "";
??}
??SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
??switch (cell.getCellType()) {
???case HSSFCell.CELL_TYPE_STRING: {
????return Strings.trim(cell.getStringCellValue());
???}
???case HSSFCell.CELL_TYPE_NUMERIC: {
????if(HSSFDateUtil.isCellDateFormatted(cell)){
?????
?????return sdf.format(cell.getDateCellValue());
????}else{
?????return Strings.trim(new BigDecimal(cell.getNumericCellValue())
???????.toString());
????}
???}
???case HSSFCell.CELL_TYPE_BOOLEAN: {
????return Strings.trim(String.valueOf(cell.getBooleanCellValue()));
???}
???case HSSFCell.CELL_TYPE_FORMULA: {
????return Strings.trim(String.valueOf(cell.getCellFormula()));
???}
???
???default: {
????return Strings.trim(cell.getStringCellValue());
???}
??}
?}
posted on 2006-12-21 16:10
有貓相伴的日子 閱讀(1060)
評論(0) 編輯 收藏 所屬分類:
jdk