修改:读取数值整数的时候去掉 ’.0‘

This commit is contained in:
lxy 2020-07-14 20:00:20 +08:00
parent a667e888f0
commit 4d3afd565e

View File

@ -1,7 +1,6 @@
package net.tccn.kit.poi;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
import org.apache.poi.ss.formula.functions.T;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
@ -304,7 +303,8 @@ public class ExcelKit {
}
if (cell.getCellType() == CellType.NUMERIC) {
map.put(fields[j], cell.getNumericCellValue() + "");
double v = cell.getNumericCellValue();
map.put(fields[j], (v%1 == 0 ? (long)v : v + ""));
} else {
map.put(fields[j], cell.getStringCellValue());
}
@ -346,7 +346,8 @@ public class ExcelKit {
}
if (cell.getCellType() == CellType.NUMERIC) {
map.put(field, cell.getNumericCellValue() + "");
double v = cell.getNumericCellValue();
map.put(field, (v%1 == 0 ? (long)v : v + ""));
} else {
map.put(field, cell.getStringCellValue());
}