Browse Source

Merge remote-tracking branch 'origin/bugfix' into developing

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

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

@ -136,6 +136,8 @@ public class ExcelReader {
readWorkbook.setReadCache(new MapCache());
readWorkbook.setConvertAllFiled(Boolean.FALSE);
readWorkbook.setDefaultReturnMap(Boolean.FALSE);
// The previous logic was that Article 0 started reading
readWorkbook.setHeadRowNumber(0);
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;
import java.io.File;
import java.io.FileInputStream;
import org.junit.Ignore;
import org.junit.Test;
@ -9,7 +10,9 @@ import org.slf4j.LoggerFactory;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.cache.Ehcache;
import com.alibaba.excel.support.ExcelTypeEnum;
/**
* 临时测试
@ -19,6 +22,13 @@ import com.alibaba.excel.cache.Ehcache;
@Ignore
public class HeadReadTest {
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
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

@ -20,6 +20,9 @@
* 修复读取转换器的并发问题
* 填充支持多个List对象
# 2.1.7
* 修复使用1+版本的写法,第1条开始读修改为第0条开始读
# 2.1.6
* 修复写入只有`sheetName`会抛异常

Loading…
Cancel
Save