From 937dee76ff8989e5dc1c7e175ceefe71a59ae363 Mon Sep 17 00:00:00 2001 From: JackeyXps <599591947@qq.com> Date: Sat, 17 Apr 2021 17:17:01 +0800 Subject: [PATCH] =?UTF-8?q?fix=20issue1702=20=E4=B8=8D=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E7=9A=84=E5=86=99=EF=BC=8C=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=86=99=E5=85=A5=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alibaba/excel/write/executor/ExcelWriteAddExecutor.java | 2 +- .../com/alibaba/easyexcel/test/demo/write/WriteTest.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java index 84b9821d..63ed5ce3 100644 --- a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java +++ b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java @@ -93,7 +93,7 @@ public class ExcelWriteAddExecutor extends AbstractExcelWriteExecutor { if (dataIndex >= oneRowData.size()) { return; } - if (headMap.size() != 0) { + if (dataIndex != 0) { cellIndex++; } int size = oneRowData.size() - dataIndex; diff --git a/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java b/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java index 15811fcf..f914f87d 100644 --- a/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java +++ b/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java @@ -503,14 +503,14 @@ public class WriteTest { } @Test - public void noModelSimpleWriteWithOneHead() { + public void noModelWriteWithOneHead() { // 写法1 String fileName = TestFileUtil.getPath() + "noModelSimpleWrite" + System.currentTimeMillis() + ".xlsx"; // 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭 - EasyExcel.write(fileName).head(noModelSimpleOneHead()).sheet("模板").doWrite(dataList()); + EasyExcel.write(fileName).head(noModelOneHead()).sheet("模板").doWrite(dataList()); } - private List> noModelSimpleOneHead() { + private List> noModelOneHead() { List> list = new ArrayList>(); List head0 = new ArrayList(); head0.add("表头1");