Git Product home page Git Product logo

poi-el's Introduction

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,可以有多来源),将属性占位符和数据来源解耦

poi-el's People

Contributors

kevin-wang001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

poi-el's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.