瀏覽代碼

Excel导出类型NUMERIC支持精度浮点类型

RuoYi 5 年之前
父節點
當前提交
155b585ae5

+ 1 - 1
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java

@@ -494,7 +494,7 @@ public class ExcelUtil<T>
494
         else if (ColumnType.NUMERIC == attr.cellType())
494
         else if (ColumnType.NUMERIC == attr.cellType())
495
         {
495
         {
496
             cell.setCellType(CellType.NUMERIC);
496
             cell.setCellType(CellType.NUMERIC);
497
-            cell.setCellValue(Integer.parseInt(value + ""));
497
+            cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
498
         }
498
         }
499
     }
499
     }
500
 
500