导入excel表,若表格中为整数数字,不管单元格设置成数字格式还是文本格式,导入时都会出现小数点和0
/**
* 处理导入小数点
*/
public static String numOfImport(HSSFCell cell) {
String value = cell.toString();
int i = cell.getCellType();
if (i == 1) {//字符串类型
return value;
} else {
String[] str = value.split("\\.");
if (str.length > 1) {
String str1 = str[1];
int m = Integer.parseInt(str1);
if (m == 0) {
return str[0];
} else {
return value;
}
}else{
return value;
}
}
}