From 737de9553f6ea2e9b6abadf1d8fc591c31e3b79e Mon Sep 17 00:00:00 2001 From: Jiaju Zhuang Date: Fri, 22 May 2020 16:39:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D07=E7=89=88=E4=BB=85=E6=9C=89?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E7=9A=84=E7=A9=BA=E8=A1=8C=20=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=8D=E5=BF=BD=E7=95=A5=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alibaba/excel/analysis/v07/handlers/RowTagHandler.java | 5 ++++- src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java | 4 ++-- update.md | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/alibaba/excel/analysis/v07/handlers/RowTagHandler.java b/src/main/java/com/alibaba/excel/analysis/v07/handlers/RowTagHandler.java index 329b224..877c6a5 100644 --- a/src/main/java/com/alibaba/excel/analysis/v07/handlers/RowTagHandler.java +++ b/src/main/java/com/alibaba/excel/analysis/v07/handlers/RowTagHandler.java @@ -10,6 +10,7 @@ import com.alibaba.excel.enums.RowTypeEnum; import com.alibaba.excel.metadata.Cell; import com.alibaba.excel.read.metadata.holder.ReadRowHolder; import com.alibaba.excel.read.metadata.holder.xlsx.XlsxReadSheetHolder; +import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.util.PositionUtils; /** @@ -39,7 +40,9 @@ public class RowTagHandler extends AbstractXlsxTagHandler { @Override public void endElement(XlsxReadContext xlsxReadContext, String name) { XlsxReadSheetHolder xlsxReadSheetHolder = xlsxReadContext.xlsxReadSheetHolder(); - xlsxReadContext.readRowHolder(new ReadRowHolder(xlsxReadSheetHolder.getRowIndex(), RowTypeEnum.DATA, + RowTypeEnum rowType = + CollectionUtils.isEmpty(xlsxReadSheetHolder.getCellMap()) ? RowTypeEnum.EMPTY : RowTypeEnum.DATA; + xlsxReadContext.readRowHolder(new ReadRowHolder(xlsxReadSheetHolder.getRowIndex(), rowType, xlsxReadSheetHolder.getGlobalConfiguration(), xlsxReadSheetHolder.getCellMap())); xlsxReadContext.analysisEventProcessor().endRow(xlsxReadContext); xlsxReadSheetHolder.setColumnIndex(null); diff --git a/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java b/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java index 7a2c9d6..2771e58 100644 --- a/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java +++ b/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java @@ -32,9 +32,9 @@ public class Lock2Test { @Test public void test() throws Exception { - File file = TestFileUtil.readUserHomeFile("test/test.xlsx"); + File file = TestFileUtil.readUserHomeFile("test/test2style.xls"); - List list = EasyExcel.read(file).useScientificFormat(false).sheet().headRowNumber(0).doReadSync(); + List list = EasyExcel.read(file).ignoreEmptyRow(true).sheet().headRowNumber(0).doReadSync(); LOGGER.info("数据:{}", list.size()); for (Object data : list) { LOGGER.info("返回数据:{}", JSON.toJSONString(data)); diff --git a/update.md b/update.md index a43d3fe..5113607 100644 --- a/update.md +++ b/update.md @@ -1,7 +1,7 @@ # 2.2.4 * 撤销删除`AbstractMergeStrategy` * 修改默认用String读取数字不使用科学计数法 通过`useScientificFormat`修改 - +* 修复07版仅有样式的空行 默认不忽略的bug # 2.2.3 * 修改填充数据空数据的bug [Issue #1274](https://github.com/alibaba/easyexcel/issues/1274)