Browse Source

升级新版本,修复bug,提供编辑工具,提升模型转换性能

pull/150/head
jipengfei.jpf 6 years ago
parent
commit
f0568c1783
  1. 1
      src/test/java/com/alibaba/easyexcel/test/ReadTest.java
  2. 5
      src/test/java/com/alibaba/easyexcel/test/WriteTest.java
  3. 4
      src/test/java/com/alibaba/easyexcel/test/util/DataUtil.java
  4. BIN
      src/test/resources/2007.xlsx

1
src/test/java/com/alibaba/easyexcel/test/ReadTest.java

@ -80,6 +80,7 @@ public class ReadTest {
ExcelListener excelListener = new ExcelListener();
ExcelReader excelReader = EasyExcelFactory.getReader(inputStream,excelListener);
List<Sheet> sheets = excelReader.getSheets();
System.out.println("llll****"+sheets);
System.out.println();
for (Sheet sheet:sheets) {
if(sheet.getSheetNo() ==1) {

5
src/test/java/com/alibaba/easyexcel/test/WriteTest.java

@ -31,14 +31,19 @@ public class WriteTest {
sheet1.setHead(createTestListStringHead());
//or 设置自适应宽度
//sheet1.setAutoWidth(Boolean.TRUE);
writer.write1(createTestListObject(), sheet1);
//写第二个sheet sheet2 模型上打有表头的注解,合并单元格
Sheet sheet2 = new Sheet(2, 3, JavaModel1.class, "第二个sheet", null);
sheet2.setTableStyle(createTableStyle());
//writer.write1(null, sheet2);
writer.write(createTestListJavaMode(), sheet2);
writer.merge(5,20,1,1);

4
src/test/java/com/alibaba/easyexcel/test/util/DataUtil.java

@ -58,8 +58,8 @@ public class DataUtil {
List<JavaModel1> model1s = new ArrayList<JavaModel1>();
for (int i = 0; i <10000 ; i++) {
JavaModel1 model1 = new JavaModel1();
model1.setP1("第一列,第"+i+"行");
model1.setP2("222"+i);
model1.setP1("第一列,第行");
model1.setP2("121212jjj");
model1.setP3(33+i);
model1.setP4(44);
model1.setP5("555");

BIN
src/test/resources/2007.xlsx

Binary file not shown.
Loading…
Cancel
Save