1、EasyExcel是一个基于Java的简单、省内存的读写Excel的开源项目
a.POI非常耗内存(大的excel需要上G的内存) 系统容易出现OOM
b.POI代码也相当复杂,后面在进行维护的时候也不大好操作
2、在往Excel写入数据时出现如下错误
com.alibaba.excel.exception.ExcelGenerateException: java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.CellStyle.setVerticalAlignment(Lorg/apache/poi/ss/usermodel/VerticalAlignment;)V
at com.alibaba.excel.write.ExcelBuilderImpl.addContent(ExcelBuilderImpl.java:64)
at com.alibaba.excel.ExcelWriter.write(ExcelWriter.java:161)
at com.alibaba.excel.ExcelWriter.write(ExcelWriter.java:146)
at com.alibaba.excel.write.builder.ExcelWriterSheetBuilder.doWrite(ExcelWriterSheetBuilder.java:179)
at com.atguigu.easyexcel.EasyExcelTest.testWriteExcel(EasyExcelTest.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.CellStyle.setVerticalAlignment(Lorg/apache/poi/ss/usermodel/VerticalAlignment;)V
at com.alibaba.excel.util.StyleUtil.buildDefaultCellStyle(StyleUtil.java:29)
at com.alibaba.excel.util.StyleUtil.buildHeadCellStyle(StyleUtil.java:49)
at com.alibaba.excel.write.style.HorizontalCellStyleStrategy.initCellStyle(HorizontalCellStyleStrategy.java:43)
at com.alibaba.excel.write.style.AbstractCellStyleStrategy.afterSheetCreate(AbstractCellStyleStrategy.java:63)
at com.alibaba.excel.util.WriteHandlerUtils.afterSheetCreate(WriteHandlerUtils.java:86)
at com.alibaba.excel.context.WriteContextImpl.initSheet(WriteContextImpl.java:158)
at com.alibaba.excel.context.WriteContextImpl.currentSheet(WriteContextImpl.java:131)
at com.alibaba.excel.write.ExcelBuilderImpl.addContent(ExcelBuilderImpl.java:53)
... 26 more
Process finished with exit code -1
标签:lang,java,ss,excel,alibaba,write,apache,com From: https://www.cnblogs.com/chuangsi/p/17341739.html