Skip to content
清沐 edited this page Feb 17, 2020 · 121 revisions

MyExcel,是一个集导入、导出、加密Excel等多项功能的工具包。

Myexcel is a toolkit which can import, export and encrypt excel.

定位 | Target

  • 导入:提供简便的API,低内存读取Excel内容,并转化为List<Bean>或者List<Map>

  • Import: Provide a simple API to read excel content in low memory and convert it to list<Bean> or list <Map>.

  • 导出:可快速导出海量数据的简单列表,可生成高复杂度布局的Excel,复杂布局指的是包含多种不规则合并单元格、背景色、字体大小、斜体、下拉列表等,可自动划分Excel生成zip压缩包。

  • Export: It can quickly export a simple list of massive data, and generate excel with high complexity layout. Complex layout refers to a variety of irregular merged cells, background color, font size, italics, drop-down list, etc., which can be automatically divided into Excel to generate zip package.

测试文件,24.3M Excel,50万行,8列,循环40次读取,内存平均占用约75兆左右,与阿里easyexcel(V2.1.6)同文件测试对比,内存占用约为easyexcel的三分之一

Test file, 24.3m excel, 500000 lines, 8 columns, 40 cycles of reading, the average memory occupation is about 75 megabytes, compared with the same file test of Alibaba easyexcel (v2.1.6), the memory occupation is about one third of easyexcel.

读取内存占用

优势 | Advantages

  • 可生成任意复杂表格:本工具使用迭代单元格方式进行Excel绘制,可生成任意复杂度Excel,提供多种宽度策略;

  • 零学习成本:使用Html作为模板,学习成本几乎为零,无需关心POI本身任何操作;

  • 支持常用背景色、边框、字体等样式设置:具体参见菜单样式支持部分;

  • 支持.xls、.xlsx、.csv:支持生成.xls、.xlsx后缀的Excel以及.csv文件;

  • 支持公式导出:支持Excel模板中设置公式,降低服务端的计算量;

  • 支持低内存SXSSF模式:支持低内存的SXSSF模式,可利用极低的内存生成.xlsx;

  • 支持生产者消费者模式导出:支持生产者消费者模式导出,无需一次性获取所有数据,分批获取数据配合SXSSF模式实现真正意义上海量数据导出;

  • 支持多种模板引擎:已内置Freemarker、Groovy、Beetl、Thymeleaf等常用模板引擎Excel构建器(详情参见文档Getting started),推荐使用Beetl模板引擎(Beetl文档);

  • 提供默认Excel构建器,直接输出简单Excel:无需编写任何Html,已内置默认模板,可直接根据POJO数据列表输出;

  • 支持一次生成多sheet:以table作为sheet单元,支持一份Excel文档中多sheet导出;

  • 支持Excel容量设定:支持设定Excel容量,到达容量后自动新建Excel,可构建成zip压缩包导出;

  • Generate any complex table: This library uses iterative cell method to draw excel, which can generate any complexity excel and provide multiple width strategies.

  • Completely shield POI complexity: Using HTML as a template, the learning cost is almost zero, no need to care about any operation of POI itself, and a large number of default template free operations are provided.

  • Support common background color, border, font and other style settings: See the menu style support section for details.

  • Very low memory reading and exporting super large Excel: Very low memory reading and exporting super large Excel.

  • Support producer consumer mode export: It supports the export of producer consumer mode, and does not need to obtain all data at one time. Batch data acquisition and sxssf mode are used to realize the real export of massive data.

  • Support for multiple template engines: Built in common template engines, such as FreeMarker, groovy, Beetl and thymeleaf, excel Builder (see the document for detailsGetting started), the Beetl template engine is recommended(Beetl文档).

Clone this wiki locally