#2 得分:0回复于: 2010-09-13 17:41:35
if (cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {
DateFormat format = new SimpleDateFormat(DateUtil.YYYY_MM_DD);
if(HSSFDateUtil.isCellDateFormatted(cell)) {
// 是否为日期型
str = format.format(cell.getDateCellValue());
} else {
// 是否为数值型
double d = cell.getNumericCellValue();
if (d - (int) d
// 是否为int型
str = Integer.toString((int) d);
} else {
System.out.println("double.....");
// 是否为double型
str = Double.toString(cell.getNumericCellValue());
}
}
System.out.println("type=="+cell.getCellType() );
System.out.println("cell=="+str);
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
str = cell.getRichStringCellValue().getString();
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA) {
str = cell.getCellFormula();
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_BLANK) {
str = " ";
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_ERROR) {
str = " ";
}
这几种 类型 都做判断了 依然还是 1.3471022771E10