修改:读取数值整数的时候去掉 ’.0‘
This commit is contained in:
parent
a667e888f0
commit
4d3afd565e
@ -1,7 +1,6 @@
|
|||||||
package net.tccn.kit.poi;
|
package net.tccn.kit.poi;
|
||||||
|
|
||||||
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
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.ss.usermodel.*;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||||
|
|
||||||
@ -304,7 +303,8 @@ public class ExcelKit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cell.getCellType() == CellType.NUMERIC) {
|
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 {
|
} else {
|
||||||
map.put(fields[j], cell.getStringCellValue());
|
map.put(fields[j], cell.getStringCellValue());
|
||||||
}
|
}
|
||||||
@ -346,7 +346,8 @@ public class ExcelKit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cell.getCellType() == CellType.NUMERIC) {
|
if (cell.getCellType() == CellType.NUMERIC) {
|
||||||
map.put(field, cell.getNumericCellValue() + "");
|
double v = cell.getNumericCellValue();
|
||||||
|
map.put(field, (v%1 == 0 ? (long)v : v + ""));
|
||||||
} else {
|
} else {
|
||||||
map.put(field, cell.getStringCellValue());
|
map.put(field, cell.getStringCellValue());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user