From e368586c3d4cb8542afff7418c96bf3bb7436303 Mon Sep 17 00:00:00 2001 From: HiJack Date: Thu, 3 Nov 2016 14:48:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BAexcel=EF=BC=8C=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/github/sd4324530/fastexcel/FastExcel.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/sd4324530/fastexcel/FastExcel.java b/src/main/java/com/github/sd4324530/fastexcel/FastExcel.java index 435a8e8..8a54332 100644 --- a/src/main/java/com/github/sd4324530/fastexcel/FastExcel.java +++ b/src/main/java/com/github/sd4324530/fastexcel/FastExcel.java @@ -291,9 +291,14 @@ public boolean createExcel(List list) { Cell cell = row.createCell(j); for (Map.Entry data : fieldMap.entrySet()) { if (data.getKey().equals(s[j])) { - Field field = data.getValue(); + Field field = data.getValue(); field.setAccessible(true); - cell.setCellValue(field.get(list.get(i)).toString()); + Object object = field.get(list.get(i)); + if (object instanceof Date) { + Date date = (Date)object; + object = format.format(date); + } + cell.setCellValue(object.toString()); break; } }