com.github.kevin-wang001:poi-el

excel import and export tool

License

License

GroupId

GroupId

com.github.kevin-wang001
ArtifactId

ArtifactId

poi-el
Last Version

Last Version

2.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

excel import and export tool
Project URL

Project URL

https://github.com/kevin-wang001/poi-el
Source Code Management

Source Code Management

https://github.com/kevin-wang001/poi-el

Download poi-el

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.kevin-wang001/poi-el/ -->
<dependency>
    <groupId>com.github.kevin-wang001</groupId>
    <artifactId>poi-el</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.kevin-wang001/poi-el/
implementation 'com.github.kevin-wang001:poi-el:2.0.1'
// https://jarcasting.com/artifacts/com.github.kevin-wang001/poi-el/
implementation ("com.github.kevin-wang001:poi-el:2.0.1")
'com.github.kevin-wang001:poi-el:jar:2.0.1'
<dependency org="com.github.kevin-wang001" name="poi-el" rev="2.0.1">
  <artifact name="poi-el" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.kevin-wang001', module='poi-el', version='2.0.1')
)
libraryDependencies += "com.github.kevin-wang001" % "poi-el" % "2.0.1"
[com.github.kevin-wang001/poi-el "2.0.1"]

Dependencies

compile (10)

Group / Artifact Type Version
org.apache.poi : poi-ooxml jar 3.7
org.reflections : reflections jar 0.9.9-RC1
org.slf4j : slf4j-api jar 1.7.12
org.slf4j : jcl-over-slf4j jar 1.7.12
org.slf4j : log4j-over-slf4j jar 1.7.12
com.alibaba : fastjson jar 1.2.54
org.apache.commons : commons-lang3 jar 3.3.2
commons-collections : commons-collections jar 3.2.2
com.google.guava : guava jar 15.0
joda-time : joda-time jar 2.9.7

provided (1)

Group / Artifact Type Version
org.springframework : spring-expression jar 4.1.6.RELEASE

test (3)

Group / Artifact Type Version
ch.qos.logback : logback-core jar 1.1.2
ch.qos.logback : logback-classic jar 1.1.2
junit : junit jar 4.10

Project Modules

There are no modules declared in this project.

poi-el

excel导出与导入神器,poi-el。

  • poi-el支持强大的excel模板导出功能
  • poi-el能很方便的支持导出函数扩展(EL的特性)
  • poi-el支持方便的excel导入API

maven 依赖

<dependency>
  <groupId>com.github.kevin-wang001</groupId>
  <artifactId>poi-el</artifactId>
  <version>2.0.1</version>
</dependency>

excel模板导出

使用poi + spEl,支持各种普通模板和复杂模板的导出功能

Quick Start:

参考:
com.kvn.poi.export_test.ForeachTest.java
com.kvn.poi.export_test.MixTemplateTest.java
com.kvn.poi.export_test.MultiPoiForeachTest.java

API:

PoiExporter.export2Destination(InputStream templateInputStream, Map<String, Object> rootObjectMap, OutputStream des)

模板示例

普通模板:

foreach

多sheet模板

foreach

复杂模板——多个foreach模板:

多个foreach

复杂模板——混合模板:

混合模板

导出函数扩展

  • 注册扩展函数到上下文中 poi-el默认会去读取 META-INF/poi-el/poi-el-functions 文件,里面存放扩展函数类的全限定名。
    poi-el内部默认注册了 InternalUtils
# 内部函数
com.kvn.poi.exp.function.InternalUtils

当然,开发者也可以将自定义的函数扩展添加到自己的工程目录文件 META-INF/poi-el/poi-el-functions 下 使用形如:(参考:03_Template_混合模板.xlsx

${#fmtDate(endDate,'yyyy-MM-dd')}
  • 直接使用没有注册到上下文中的函数
    我们可以直接使用没有注册到上下文中的函数,不过需要指定方法的全限定名:(EL调用函数,是不是很强大^_^)
    例如:
#{ T(com.kvn.poi.exp.function.NotRegistedFunction).fmtString(keyName) }

excel模板导入

支持简洁易用的excel导入API

Quick Start:

参考:
com.kvn.poi.import_test.ImportRawTest.java
com.kvn.poi.import_test.ImportGenericTest.java

API

PoiSheetVo sheetVo = PoiImporter.importFirstSheetFrom(is);
PoiGenericSheetVo<OrderImportVo> genericSheetVo = PoiImporter.importFirstSheetFrom(is, OrderImportVo.class);

计划

  1. 后续可以考虑使用MyBatis解析动态SQL的思想,来扩展属性占位符(${}、#{}等)和数据来源(rootObjectMap,可以有多来源),将属性占位符和数据来源解耦

Versions

Version
2.0.1