From 01d54cedc3d5c9cc751dc7ba0786cc4cc878f768 Mon Sep 17 00:00:00 2001 From: Jiaju Zhuang Date: Tue, 22 Oct 2019 22:49:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A8=A1=E6=9D=BF=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E6=B5=81=E5=88=9B=E5=BB=BA=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metadata/holder/WriteWorkbookHolder.java | 2 +- .../easyexcel/test/temp/simple/Wirte.java | 16 ++++++++++++++++ update.md | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/alibaba/excel/write/metadata/holder/WriteWorkbookHolder.java b/src/main/java/com/alibaba/excel/write/metadata/holder/WriteWorkbookHolder.java index d8020852..7614489f 100644 --- a/src/main/java/com/alibaba/excel/write/metadata/holder/WriteWorkbookHolder.java +++ b/src/main/java/com/alibaba/excel/write/metadata/holder/WriteWorkbookHolder.java @@ -146,7 +146,7 @@ public class WriteWorkbookHolder extends AbstractWriteHolder { byte[] templateFileByte = null; if (writeWorkbook.getTemplateFile() != null) { templateFileByte = FileUtils.readFileToByteArray(writeWorkbook.getTemplateFile()); - } else if (writeWorkbook.getTemplateInputStream() == null) { + } else if (writeWorkbook.getTemplateInputStream() != null) { try { templateFileByte = IoUtils.toByteArray(writeWorkbook.getTemplateInputStream()); } finally { diff --git a/src/test/java/com/alibaba/easyexcel/test/temp/simple/Wirte.java b/src/test/java/com/alibaba/easyexcel/test/temp/simple/Wirte.java index 27bea33c..49240d1b 100644 --- a/src/test/java/com/alibaba/easyexcel/test/temp/simple/Wirte.java +++ b/src/test/java/com/alibaba/easyexcel/test/temp/simple/Wirte.java @@ -5,12 +5,15 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.alibaba.easyexcel.test.core.large.LargeData; +import com.alibaba.easyexcel.test.core.simple.SimpleData; import com.alibaba.easyexcel.test.demo.write.DemoData; import com.alibaba.easyexcel.test.util.TestFileUtil; import com.alibaba.excel.EasyExcel; @@ -18,6 +21,8 @@ import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.fastjson.JSON; +import net.sf.cglib.beans.BeanMap; + /** * 测试poi * @@ -27,6 +32,17 @@ import com.alibaba.fastjson.JSON; public class Wirte { private static final Logger LOGGER = LoggerFactory.getLogger(Wirte.class); + @Test + public void simpleWrite1() { + LargeData ss = new LargeData(); + ss.setStr23("ttt"); + Map map = BeanMap.create(ss); + System.out.println(map.containsKey("str23")); + System.out.println(map.containsKey("str22")); + System.out.println(map.get("str23")); + System.out.println(map.get("str22")); + } + @Test public void simpleWrite() { // 写法1 diff --git a/update.md b/update.md index 2ae7d28f..9bbd87ab 100644 --- a/update.md +++ b/update.md @@ -1,3 +1,7 @@ +# 2.1.0-beta2 +* 修改模板通过流创建报错的bug +* + # 2.1.0-beta1 * 新增支持导入、导出支持公式 * 新增支持读取单元格类型、写入指定单元格类型