Browse Source

修复07版仅有样式的空行 默认不忽略的bug

developing
Jiaju Zhuang 5 years ago
parent
commit
737de9553f
  1. 5
      src/main/java/com/alibaba/excel/analysis/v07/handlers/RowTagHandler.java
  2. 4
      src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
  3. 2
      update.md

5
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);

4
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<Object> list = EasyExcel.read(file).useScientificFormat(false).sheet().headRowNumber(0).doReadSync();
List<Object> list = EasyExcel.read(file).ignoreEmptyRow(true).sheet().headRowNumber(0).doReadSync();
LOGGER.info("数据:{}", list.size());
for (Object data : list) {
LOGGER.info("返回数据:{}", JSON.toJSONString(data));

2
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)

Loading…
Cancel
Save