@ -16,8 +16,8 @@ import com.alibaba.fastjson.JSON;
*
* @author Jiaju Zhuang
*/
public class NoModleDataListener extends AnalysisEventListener<Map<Integer, String>> {
private static final Logger LOGGER = LoggerFactory.getLogger(NoModleDataListener.class);
public class NoModelDataListener extends AnalysisEventListener<Map<Integer, String>> {
private static final Logger LOGGER = LoggerFactory.getLogger(NoModelDataListener.class);
/**
* 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收
@ -249,9 +249,9 @@ public class ReadTest {
* 不创建对象的读
@Test
public void noModleRead() {
public void noModelRead() {
String fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx";
// 这里 只要,然后读取第一个sheet 同步读取会自动finish
EasyExcel.read(fileName, new NoModleDataListener()).sheet().doRead();
EasyExcel.read(fileName, new NoModelDataListener()).sheet().doRead();
}
@ -460,9 +460,9 @@ public class WriteTest {
* 不创建对象的写
public void noModleWrite() {
public void noModelWrite() {
// 写法1
String fileName = TestFileUtil.getPath() + "noModleWrite" + System.currentTimeMillis() + ".xlsx";
String fileName = TestFileUtil.getPath() + "noModelWrite" + System.currentTimeMillis() + ".xlsx";
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
EasyExcel.write(fileName).head(head()).sheet("模板").doWrite(dataList());