java operation document tool framework

Links: Use of poi, easypoi and easyexcel .

Note that when using, please pay attention to dependency version conflicts such as poi! !

apache then

The Apache project encapsulates common document operations and can also manipulate the underlying XML structure.
easypoi, easyexcel, and Poi-tl are all based on apache poi for secondary development.

easypoi

Link: easypoi-easypoi-excel and -word easy tools

- 导出
    1.正规excel导出 (格式简单,数据量可以,5W以内吧)
        注解方式:  ExcelExportUtil.exportExcel(ExportParams entity, Class<?> pojoClass,Collection<?> dataSet) 
    2.不定多少列,但是格式依然简单数据库不大
        自定义方式: ExcelExportUtil.exportExcel(ExportParams entity, List<ExcelExportEntity> entityList,Collection<?> dataSet)
    3.数据量大超过5W,还在100W以内
        注解方式 ExcelExportUtil.exportBigExcel(ExportParams entity, Class<?> pojoClass,IExcelExportServer server, Object queryParams)
        自定义方式: ExcelExportUtil.exportBigExcel(ExportParams entity, List<ExcelExportEntity> excelParams,IExcelExportServer server, Object queryParams)
    4.样式复杂,数据量尽量别大
        模板导出 ExcelExportUtil.exportExcel(TemplateExportParams params, Map<String, Object> map)
    5.一次导出多个风格不一致的sheet
        模板导出 ExcelExportUtil.exportExcel(Map<Integer, Map<String, Object>> map,TemplateExportParams params) 
    6.一个模板但是要导出非常多份
        模板导出 ExcelExportUtil.exportExcelClone(Map<Integer, List<Map<String, Object>>> map,TemplateExportParams params)
    7.模板无法满足你的自定义,试试html
        自己构造html,然后我给你转成excel  ExcelXorHtmlUtil.htmlToExcel(String html, ExcelType type)
    8.数据量过百万级了.放弃excel吧,csv导出
        注解方式: CsvExportUtil.exportCsv(CsvExportParams params, Class<?> pojoClass, OutputStream outputStream)
        自定义方式: CsvExportUtil.exportCsv(CsvExportParams params, List<ExcelExportEntity> entityList, OutputStream outputStream)
    9.word导出
        模板导出: WordExportUtil.exportWord07(String url, Map<String, Object> map)
    10.PDF导出
        模板导出: TODO 
- 导入 
    如果想提高性能 ImportParams 的concurrentTask 可以帮助并发导入,仅单行,最小1000
    excel有单个的那种特殊读取,readSingleCell 参数可以支持
    1. 不需要检验,数据量不大(5W以内)
        注解或者MAP: ExcelImportUtil.importExcel(File file, Class<?> pojoClass, ImportParams params)
    2. 需要导入,数据量不大
        注解或者MAP: ExcelImportUtil.importExcelMore(InputStream inputstream, Class<?> pojoClass, ImportParams params)
    3. 数据量大了,或者你有特别多的导入操作,内存比较少,仅支持单行
       SAX方式  ExcelImportUtil.importExcelBySax(InputStream inputstream, Class<?> pojoClass, ImportParams params, IReadHandler handler)
    4. 数据量超过EXCEL限制,CSV读取
        小数据量: CsvImportUtil.importCsv(InputStream inputstream, Class<?> pojoClass,CsvImportParams params)
        大数据量: CsvImportUtil.importCsv(InputStream inputstream, Class<?> pojoClass,CsvImportParams params, IReadHandler readHandler)

easyexcel (maintained by Ali, trustworthy)

github link: easyexcel
github link: Easy Excel official documentation
Link: Practical technology is aimed at the Excel operation guide commonly used in projects
Link: EasyExcel, the best open source project for connecting Excel with JAVA, official documentation and .jar package download

insert image description here

Poi-tl

Word template engine, based on Apache POI, provides a more friendly API
low-code, just prepare document templates and data
Link: Poi-tl .Link
: Poi-tl github address .

insert image description here

insert image description here
insert image description here
insert image description here

htuool (simple to use)

Link: Excel Generated .

Generated based on Freemarker templates (deprecated)

  • Only supports text, very limited and not recommended,
  • Extremely complex styles and templates are available, and XML-structured code is difficult to maintain
  • The essence is still an xml format file, and the mobile app will fail to open it

ureport report (it has not been maintained for a long time, please use it with caution)

Link: ureport project address
Link: ureport document

UReport2 is a pure Java high-performance reporting engine based on Spring, which can realize arbitrarily complex Chinese-style reports by iterating cells. In UReport2, a new web-based report designer is provided, which can run in various mainstream browsers such as Chrome, Firefox, Edge (except IE browser). Using UReport2, you can complete the design and production of various complex reports by opening the browser. UReport2 is the first Chinese report engine based on the Apache-2.0 open source protocol

  • It is good to use with low-code platform, if you have the ability to open the second
  • Support preview report, what you see is what you get

pdf

PDFBox is a PDF document collaboration class library implemented in Java, which provides functions for creating, processing and extracting document content from PDF documents, and also includes some command-line utilities.
github link: PDFBox .
github link: pdfbox documentation .

Guess you like

Origin blog.csdn.net/qq_41604890/article/details/122890098