Browse Source

* 修复使用1+版本的写法,第1条开始读修改为第0条开始读

developing v2.1.7
Jiaju Zhuang 5 years ago
parent
commit
ff851219a6
  1. 2
      pom.xml
  2. 2
      src/main/java/com/alibaba/excel/ExcelReader.java
  3. 10
      src/test/java/com/alibaba/easyexcel/test/temp/read/HeadReadTest.java
  4. 27
      src/test/java/com/alibaba/easyexcel/test/temp/read/TestListener.java
  5. 3
      update.md

2
pom.xml

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId> <artifactId>easyexcel</artifactId>
<version>2.1.6</version> <version>2.1.7</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>easyexcel</name> <name>easyexcel</name>

2
src/main/java/com/alibaba/excel/ExcelReader.java

@ -136,6 +136,8 @@ public class ExcelReader {
readWorkbook.setReadCache(new MapCache()); readWorkbook.setReadCache(new MapCache());
readWorkbook.setConvertAllFiled(Boolean.FALSE); readWorkbook.setConvertAllFiled(Boolean.FALSE);
readWorkbook.setDefaultReturnMap(Boolean.FALSE); readWorkbook.setDefaultReturnMap(Boolean.FALSE);
// The previous logic was that Article 0 started reading
readWorkbook.setHeadRowNumber(0);
excelAnalyser = new ExcelAnalyserImpl(readWorkbook); excelAnalyser = new ExcelAnalyserImpl(readWorkbook);
} }

10
src/test/java/com/alibaba/easyexcel/test/temp/read/HeadReadTest.java

@ -1,6 +1,7 @@
package com.alibaba.easyexcel.test.temp.read; package com.alibaba.easyexcel.test.temp.read;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
@ -8,7 +9,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.cache.Ehcache; import com.alibaba.excel.cache.Ehcache;
import com.alibaba.excel.support.ExcelTypeEnum;
/** /**
* 临时测试 * 临时测试
@ -18,6 +21,13 @@ import com.alibaba.excel.cache.Ehcache;
@Ignore @Ignore
public class HeadReadTest { public class HeadReadTest {
private static final Logger LOGGER = LoggerFactory.getLogger(HeadReadTest.class); private static final Logger LOGGER = LoggerFactory.getLogger(HeadReadTest.class);
@Test
public void testread() throws Exception {
FileInputStream fileInputStream = new FileInputStream("D://test/t1.xlsx");
ExcelReader excelReader = new ExcelReader(fileInputStream, ExcelTypeEnum.XLSX, null, new TestListener());
excelReader.read();
}
@Test @Test
public void test() throws Exception { public void test() throws Exception {

27
src/test/java/com/alibaba/easyexcel/test/temp/read/TestListener.java

@ -0,0 +1,27 @@
package com.alibaba.easyexcel.test.temp.read;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
/**
* TODO
*
* @author JiaJu Zhuang
* @date 2020/4/9 16:33
**/
@Slf4j
public class TestListener extends AnalysisEventListener {
@Override
public void invoke(Object o, AnalysisContext analysisContext) {
log.info("解析一条:{}", JSON.toJSONString(o));
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
}
}

3
update.md

@ -1,3 +1,6 @@
# 2.1.7
* 修复使用1+版本的写法,第1条开始读修改为第0条开始读
# 2.1.6 # 2.1.6
* 修复填充只有`sheetName`会抛异常 * 修复填充只有`sheetName`会抛异常

Loading…
Cancel
Save