From 4d3afd565e5d7199541aa9c294c68f05930e6c54 Mon Sep 17 00:00:00 2001 From: lxy <237809796@qq.com> Date: Tue, 14 Jul 2020 20:00:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E6=95=B0=E5=80=BC=E6=95=B4=E6=95=B0=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=20=E2=80=99.0=E2=80=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/net/tccn/kit/poi/ExcelKit.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/net/tccn/kit/poi/ExcelKit.java b/src/net/tccn/kit/poi/ExcelKit.java index 0071495..7e8dbae 100644 --- a/src/net/tccn/kit/poi/ExcelKit.java +++ b/src/net/tccn/kit/poi/ExcelKit.java @@ -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()); }