You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 14 KiB

5 years ago
10 years ago
5 years ago
10 years ago
5 years ago
9 years ago
5 years ago
7 years ago
7 years ago
5 years ago
5 years ago
5 years ago
6 years ago
5 years ago
6 years ago
5 years ago
6 years ago
5 years ago
7 years ago
7 years ago
5 years ago
7 years ago
5 years ago
10 years ago
5 years ago
10 years ago
5 years ago
10 years ago
5 years ago
10 years ago
5 years ago
10 years ago
5 years ago
10 years ago
5 years ago
10 years ago
5 years ago
5 years ago
10 years ago
10 years ago
5 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
5 years ago
10 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
5 years ago
6 years ago
5 years ago
6 years ago
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. EasyPoi - Easy utility classes of Excel and Word
  2. ===========================
  3. Easypoi, as is clear from the name, it's easy for a developer who never even used poi to
  4. export/import Excel, export Excel Template and Word Template, and export PDF. We encapsulate Apache poi in the upper layers.
  5. With simple annotations and templates Language (familiar expression syntax) to accomplish previously complex coding.
  6. Website:https://opensource.afterturn.cn/
  7. Email: qrb.jueyue@foxmail.com
  8. Developer:Jueyue qrb.jueyue@foxmail.com
  9. Excellent Team, undertake project development
  10. Support Spring Boot https://gitee.com/lemur/easypoi-spring-boot-starter
  11. [Official website](https://opensource.afterturn.cn)
  12. [中文介绍](https://gitee.com/lemur/easypoi/blob/master/README-cn.md)
  13. **The Dev Guide**
  14. **[https://opensource.afterturn.cn/doc/easypoi.html](http://opensource.afterturn.cn/doc/easypoi.html)**
  15. Next steps
  16. - Internationalization, translate documents and code-commenting
  17. - Change all PDF export to Template export
  18. - Synchronise Word tmplate function with the Excel
  19. [User feedback](https://github.com/jueyue/easypoi/issues/2)
  20. ## cn.afterturn:easypoi for enterprise
  21. Available as part of the Tidelift Subscription
  22. The maintainers of cn.afterturn:easypoi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/maven-cn-afterturn-easypoi?utm_source=maven-cn-afterturn-easypoi&utm_medium=referral&utm_campaign=readme)
  23. Display in order of registration. If you are using Easypoi, please register on https://gitee.com/lemur/easypoi/issues/IFDX7 which is only as a reference for the open source, no other purposes.
  24. - [beyondsoft](http://www.beyondsoft.com)
  25. - [turingoal](http://www.turingoal.com)
  26. - [863soft](http://www.863soft.com/cn/)
  27. - [163](http://www.163.com)
  28. - [towngas](http://www.towngas.com.cn/)
  29. - [weifenghr](https://www.weifenghr.com/)
  30. - [ic-credit](http://sic-credit.cn/)
  31. - [getto1](https://www.getto1.com/)
  32. - [choicesoft](http://www.choicesoft.com.cn/)
  33. - [timeyaa](https://www.timeyaa.com/)
  34. Version introduction
  35. [history.md](https://gitee.com/lemur/easypoi/blob/master/history.md)
  36. Basic demo
  37. [basedemo.md](https://gitee.com/lemur/easypoi/blob/master/basedemo.md)
  38. [Demo project](http://git.oschina.net/lemur/easypoi-test): http://git.oschina.net/lemur/easypoi-test
  39. ---------------------------
  40. Advantages of EasyPoi
  41. --------------------------
  42. 1.Exquisite Design, easy to use
  43. 2.Various Interfaces, easy to extend
  44. 3.Coding less do more
  45. 4.Support Spring MVC, easy for WEB export
  46. ---------------------------
  47. Main Features
  48. --------------------------
  49. For Excel, self-adapt xls and xlsx format. For Word, only docx.
  50. 1.Excel Import
  51. - Annotation Import
  52. - Map Import
  53. - Big data Import, sax mode
  54. - Save file
  55. - File validation
  56. - Field validation
  57. 2.Excel Export
  58. - Annotation Export
  59. - Template Export
  60. - HTML Export
  61. 3.Excel convert to HTML
  62. 4.Word Export
  63. 5.PDF Export
  64. ---------------------------
  65. which methods for which scenarios
  66. ---------------------------
  67. - Export
  68. 1. Normal excel export (simple format, moderate amount of data, within 50,000)
  69. annotation way: ExcelExportUtil.exportExcel(ExportParams entity, Class<?> pojoClass,Collection<?> dataSet)
  70. 2. uncertain columns, but also with simple format and small amount of data
  71. customize way: ExcelExportUtil.exportExcel(ExportParams entity, List<ExcelExportEntity> entityList,Collection<?> dataSet)
  72. 3. big data(greater than 50,000, less than one million)
  73. annotation way ExcelExportUtil.exportBigExcel(ExportParams entity, Class<?> pojoClass,IExcelExportServer server, Object queryParams)
  74. customize way: ExcelExportUtil.exportBigExcel(ExportParams entity, List<ExcelExportEntity> excelParams,IExcelExportServer server, Object queryParams)
  75. 4. complex style, the amount of data not too large
  76. Template: ExcelExportUtil.exportExcel(TemplateExportParams params, Map<String, Object> map)
  77. 5. Export multiple sheets with different styles at one time
  78. Template ExcelExportUtil.exportExcel(Map<Integer, Map<String, Object>> map,TemplateExportParams params)
  79. 6. One template but many copies to export
  80. Template ExcelExportUtil.exportExcelClone(Map<Integer, List<Map<String, Object>>> map,TemplateExportParams params)
  81. 7. If Template can't satisfy your customization, try HTML
  82. Build your own html, and then convert it to excel: ExcelXorHtmlUtil.htmlToExcel(String html, ExcelType type)
  83. 8. Big data(Over millions), please use CSV
  84. annotation way: CsvExportUtil.exportCsv(CsvExportParams params, Class<?> pojoClass, OutputStream outputStream)
  85. customize way: CsvExportUtil.exportCsv(CsvExportParams params, List<ExcelExportEntity> entityList, OutputStream outputStream)
  86. 9. Word Export
  87. Template: WordExportUtil.exportWord07(String url, Map<String, Object> map)
  88. 10. PDF Export
  89. Template: TODO
  90. - Import
  91. If you want to improve the performance, the concurrentTask of ImportParams will help with concurrent imports;Only support single line, minimum 1000.
  92. For some special reading for single cell, you can use the readSingleCell parameter
  93. 1. no need verification, moderate amount of data, within 50,000
  94. annotation or map: ExcelImportUtil.importExcel(File file, Class<?> pojoClass, ImportParams params)
  95. 2. the amount of data not too large
  96. annotation or map: ExcelImportUtil.importExcelMore(InputStream inputstream, Class<?> pojoClass, ImportParams params)
  97. 3. For big data or with lots of importing operations; Less memory, only support single line
  98. SAX: ExcelImportUtil.importExcelBySax(InputStream inputstream, Class<?> pojoClass, ImportParams params, IReadHandler handler)
  99. 4. Big data(Over millions), please use CSV
  100. small data: CsvImportUtil.importCsv(InputStream inputstream, Class<?> pojoClass,CsvImportParams params)
  101. big data: CsvImportUtil.importCsv(InputStream inputstream, Class<?> pojoClass,CsvImportParams params, IReadHandler readHandler)
  102. ---------------------------
  103. The difference between XLS and XLSX for Excel Export
  104. ---------------------------
  105. 1. For export time, XLS is 2-3 times faster than xlsx.
  106. 2. For export size, XLS is 2-3 or more times than xlsx.
  107. 3. Export need to consider both network speed and local speed.
  108. ---------------------------
  109. Packages Guide
  110. ---------------------------
  111. 1.easypoi -- Parent package
  112. 2.easypoi-annotation -- Basic annotation package, action on entity objects,
  113. it's convenient for Maven multi-project management after splitting
  114. 3.easypoi-base -- Import and export package, realize Excel Import/Export, Word Export
  115. 4.easypoi-web -- Based on AbstractView, Coupled with spring MVC, greatly simplifies the export function
  116. 5.sax -- Optional, Export uses xercesImpl, Word Export uses poi-scratchpad
  117. If you don't use spring MVC, only easypoi-base is enough.
  118. --------------------------
  119. maven
  120. --------------------------
  121. https://oss.sonatype.org/content/groups/public/
  122. ```xml
  123. <dependency>
  124. <groupId>cn.afterturn</groupId>
  125. <artifactId>easypoi-spring-boot-starter</artifactId>
  126. <version>4.1.3</version>
  127. </dependency>
  128. <dependency>
  129. <groupId>cn.afterturn</groupId>
  130. <artifactId>easypoi-base</artifactId>
  131. <version>4.1.3</version>
  132. </dependency>
  133. <dependency>
  134. <groupId>cn.afterturn</groupId>
  135. <artifactId>easypoi-web</artifactId>
  136. <version>4.1.3</version>
  137. </dependency>
  138. <dependency>
  139. <groupId>cn.afterturn</groupId>
  140. <artifactId>easypoi-annotation</artifactId>
  141. <version>4.1.3</version>
  142. </dependency>
  143. ```
  144. --------------------------
  145. pom
  146. --------------------------
  147. ```xml
  148. <!-- sax: optional, using for import -->
  149. <dependency>
  150. <groupId>xerces</groupId>
  151. <artifactId>xercesImpl</artifactId>
  152. <version>${xerces.version}</version>
  153. <optional>true</optional>
  154. </dependency>
  155. <dependency>
  156. <groupId>org.apache.poi</groupId>
  157. <artifactId>poi-scratchpad</artifactId>
  158. <version>${poi.version}</version>
  159. <optional>true</optional>
  160. </dependency>
  161. <!-- Word: optional, using for export -->
  162. <dependency>
  163. <groupId>org.apache.poi</groupId>
  164. <artifactId>ooxml-schemas</artifactId>
  165. <version>1.3</version>
  166. <optional>true</optional>
  167. </dependency>
  168. <!-- Verification: optional -->
  169. <dependency>
  170. <groupId>org.hibernate</groupId>
  171. <artifactId>hibernate-validator</artifactId>
  172. <version>5.1.3.Final</version>
  173. <optional>true</optional>
  174. </dependency>
  175. <dependency>
  176. <groupId>org.apache.bval</groupId>
  177. <artifactId>org.apache.bval.bundle</artifactId>
  178. <version>1.1.0</version>
  179. </dependency>
  180. <!-- PDF: optional, using for export-->
  181. <dependency>
  182. <groupId>com.itextpdf</groupId>
  183. <artifactId>itextpdf</artifactId>
  184. <version>5.5.6</version>
  185. <optional>true</optional>
  186. </dependency>
  187. <dependency>
  188. <groupId>com.itextpdf</groupId>
  189. <artifactId>itext-asian</artifactId>
  190. <version>5.2.0</version>
  191. <optional>true</optional>
  192. </dependency>
  193. ```
  194. -----------------
  195. Current test coverage
  196. ----------------
  197. |Package|Class|Method|Line|
  198. |----|----|----|----|
  199. cn|100% (0/0)|100% (0/0)|100% (0/0)
  200. cn.afterturn|100% (0/0)|100% (0/0)|100% (0/0)
  201. cn.afterturn.easypoi|0% (0/1)|0% (0/1)|0% (0/3)
  202. cn.afterturn.easypoi.cache|100% (6/6)|83% (10/12)|60% (40/66)
  203. cn.afterturn.easypoi.cache.manager|100% (3/3)|62% (5/8)|54% (29/53)
  204. cn.afterturn.easypoi.configuration|0% (0/2)|0% (0/1)|0% (0/5)
  205. cn.afterturn.easypoi.entity|100% (1/1)|83% (15/18)|66% (26/39)
  206. cn.afterturn.easypoi.entity.vo|100% (0/0)|100% (0/0)|100% (0/0)
  207. cn.afterturn.easypoi.excel|100% (3/3)|73% (19/26)|59% (44/74)
  208. cn.afterturn.easypoi.excel.annotation|100% (0/0)|100% (0/0)|100% (0/0)
  209. cn.afterturn.easypoi.excel.entity|83% (5/6)|66% (85/127)|63% (185/290)
  210. cn.afterturn.easypoi.excel.entity.enmus|100% (3/3)|88% (8/9)|92% (13/14)
  211. cn.afterturn.easypoi.excel.entity.params|100% (6/6)|84% (94/111)|75% (160/211)
  212. cn.afterturn.easypoi.excel.entity.result|100% (2/2)|76% (16/21)|65% (26/40)
  213. cn.afterturn.easypoi.excel.entity.sax|100% (1/1)|33% (2/6)|45% (5/11)
  214. cn.afterturn.easypoi.excel.entity.vo|100% (1/1)|100% (1/1)|100% (3/3)
  215. cn.afterturn.easypoi.excel.export|100% (2/2)|94% (17/18)|84% (202/238)
  216. cn.afterturn.easypoi.excel.export.base|100% (2/2)|97% (33/34)|88% (353/399)
  217. cn.afterturn.easypoi.excel.export.styler|100% (4/4)|86% (19/22)|97% (122/125)
  218. cn.afterturn.easypoi.excel.export.template|100% (3/3)|95% (43/45)|92% (422/457)
  219. cn.afterturn.easypoi.excel.graph|100% (0/0)|100% (0/0)|100% (0/0)
  220. cn.afterturn.easypoi.excel.graph.builder|0% (0/1)|0% (0/8)|0% (0/92)
  221. cn.afterturn.easypoi.excel.graph.constant|100% (0/0)|100% (0/0)|100% (0/0)
  222. cn.afterturn.easypoi.excel.graph.entity|0% (0/3)|0% (0/26)|0% (0/49)
  223. cn.afterturn.easypoi.excel.html|100% (2/2)|92% (24/26)|84% (242/287)
  224. cn.afterturn.easypoi.excel.html.css|100% (2/2)|100% (10/10)|94% (166/175)
  225. cn.afterturn.easypoi.excel.html.css.impl|100% (6/6)|60% (9/15)|74% (111/149)
  226. cn.afterturn.easypoi.excel.html.entity|100% (0/0)|100% (0/0)|100% (0/0)
  227. cn.afterturn.easypoi.excel.html.entity.style|100% (3/3)|100% (53/53)|100% (87/87)
  228. cn.afterturn.easypoi.excel.html.helper|80% (4/5)|77% (24/31)|67% (154/228)
  229. cn.afterturn.easypoi.excel.imports|100% (2/2)|92% (26/28)|79% (361/454)
  230. cn.afterturn.easypoi.excel.imports.base|100% (1/1)|100% (9/9)|89% (102/114)
  231. cn.afterturn.easypoi.excel.imports.sax|100% (2/2)|100% (8/8)|70% (56/80)
  232. cn.afterturn.easypoi.excel.imports.sax.parse|100% (1/1)|77% (7/9)|58% (44/75)
  233. cn.afterturn.easypoi.exception|100% (0/0)|100% (0/0)|100% (0/0)
  234. cn.afterturn.easypoi.exception.excel|50% (1/2)|20% (3/15)|18% (6/32)
  235. cn.afterturn.easypoi.exception.excel.enums|50% (1/2)|44% (4/9)|40% (9/22)
  236. cn.afterturn.easypoi.exception.word|0% (0/1)|0% (0/3)|0% (0/6)
  237. cn.afterturn.easypoi.exception.word.enmus|0% (0/1)|0% (0/4)|0% (0/10)
  238. cn.afterturn.easypoi.handler|100% (0/0)|100% (0/0)|100% (0/0)
  239. cn.afterturn.easypoi.handler.impl|100% (1/1)|33% (2/6)|44% (4/9)
  240. cn.afterturn.easypoi.handler.inter|100% (0/0)|100% (0/0)|100% (0/0)
  241. cn.afterturn.easypoi.hanlder|0% (0/1)|0% (0/1)|0% (0/17)
  242. cn.afterturn.easypoi.pdf|100% (1/1)|50% (1/2)|33% (1/3)
  243. cn.afterturn.easypoi.pdf.entity|100% (1/1)|52% (10/19)|47% (17/36)
  244. cn.afterturn.easypoi.pdf.export|100% (1/1)|100% (14/14)|85% (131/153)
  245. cn.afterturn.easypoi.pdf.styler|100% (1/1)|100% (4/4)|56% (9/16)
  246. cn.afterturn.easypoi.test|100% (0/0)|100% (0/0)|100% (0/0)
  247. cn.afterturn.easypoi.test.en|100% (3/3)|93% (15/16)|93% (31/33)
  248. cn.afterturn.easypoi.test.entity|91% (11/12)|50% (62/122)|57% (117/202)
  249. cn.afterturn.easypoi.test.entity.check|100% (2/2)|50% (8/16)|69% (18/26)
  250. cn.afterturn.easypoi.test.entity.groupname|75% (3/4)|46% (25/54)|52% (48/92)
  251. cn.afterturn.easypoi.test.entity.img|100% (1/1)|100% (8/8)|100% (16/16)
  252. cn.afterturn.easypoi.test.entity.samename|100% (1/1)|100% (6/6)|100% (10/10)
  253. cn.afterturn.easypoi.test.entity.statistics|100% (1/1)|100% (12/12)|100% (19/19)
  254. cn.afterturn.easypoi.test.entity.temp|80% (4/5)|94% (32/34)|38% (52/134)
  255. cn.afterturn.easypoi.test.web|100% (0/0)|100% (0/0)|100% (0/0)
  256. cn.afterturn.easypoi.test.web.cfg|0% (0/1)|0% (0/1)|0% (0/4)
  257. cn.afterturn.easypoi.tohtml|0% (0/1)|0% (0/4)|0% (0/13)
  258. cn.afterturn.easypoi.util|100% (11/11)|85% (84/98)|73% (668/908)
  259. cn.afterturn.easypoi.view|0% (0/13)|0% (0/27)|0% (0/376)
  260. cn.afterturn.easypoi.word|100% (1/1)|33% (1/3)|20% (1/5)
  261. cn.afterturn.easypoi.word.entity|100% (2/2)|44% (4/9)|45% (27/60)
  262. cn.afterturn.easypoi.word.entity.params|50% (1/2)|22% (5/22)|14% (8/56)
  263. cn.afterturn.easypoi.word.parse|100% (1/1)|91% (11/12)|94% (97/103)
  264. cn.afterturn.easypoi.word.parse.excel|100% (2/2)|90% (10/11)|70% (95/135)