Browse Source

Merge remote-tracking branch 'origin/2.1.x' into 2.1.x

pull/1178/head
Jiaju Zhuang 5 years ago
parent
commit
6c0f26d211
  1. 4
      src/test/java/com/alibaba/easyexcel/test/demo/read/NoModelDataListener.java
  2. 4
      src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java
  3. 4
      src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java

4
src/test/java/com/alibaba/easyexcel/test/demo/read/NoModleDataListener.java → src/test/java/com/alibaba/easyexcel/test/demo/read/NoModelDataListener.java

@ -16,8 +16,8 @@ import com.alibaba.fastjson.JSON;
* *
* @author Jiaju Zhuang * @author Jiaju Zhuang
*/ */
public class NoModleDataListener extends AnalysisEventListener<Map<Integer, String>> { public class NoModelDataListener extends AnalysisEventListener<Map<Integer, String>> {
private static final Logger LOGGER = LoggerFactory.getLogger(NoModleDataListener.class); private static final Logger LOGGER = LoggerFactory.getLogger(NoModelDataListener.class);
/** /**
* 每隔5条存储数据库实际使用中可以3000条然后清理list 方便内存回收 * 每隔5条存储数据库实际使用中可以3000条然后清理list 方便内存回收
*/ */

4
src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java

@ -249,9 +249,9 @@ public class ReadTest {
* 不创建对象的读 * 不创建对象的读
*/ */
@Test @Test
public void noModleRead() { public void noModelRead() {
String fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx"; String fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx";
// 这里 只要,然后读取第一个sheet 同步读取会自动finish // 这里 只要,然后读取第一个sheet 同步读取会自动finish
EasyExcel.read(fileName, new NoModleDataListener()).sheet().doRead(); EasyExcel.read(fileName, new NoModelDataListener()).sheet().doRead();
} }
} }

4
src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java

@ -460,9 +460,9 @@ public class WriteTest {
* 不创建对象的写 * 不创建对象的写
*/ */
@Test @Test
public void noModleWrite() { public void noModelWrite() {
// 写法1 // 写法1
String fileName = TestFileUtil.getPath() + "noModleWrite" + System.currentTimeMillis() + ".xlsx"; String fileName = TestFileUtil.getPath() + "noModelWrite" + System.currentTimeMillis() + ".xlsx";
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
EasyExcel.write(fileName).head(head()).sheet("模板").doWrite(dataList()); EasyExcel.write(fileName).head(head()).sheet("模板").doWrite(dataList());
} }

Loading…
Cancel
Save