Play! Excel Module


License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

com.google.code.maven-play-plugin.org.playframework.modules.excel
ArtifactId

ArtifactId

play-excel
Last Version

Last Version

1.2.3
Release Date

Release Date

Type

Type

jar
Description

Description

Play! Excel Module
Play! Excel Module
Source Code Management

Source Code Management

https://github.com/greenlaw110/play-excel

Download play-excel

How to add to project

<!-- https://jarcasting.com/artifacts/com.google.code.maven-play-plugin.org.playframework.modules.excel/play-excel/ -->
<dependency>
    <groupId>com.google.code.maven-play-plugin.org.playframework.modules.excel</groupId>
    <artifactId>play-excel</artifactId>
    <version>1.2.3</version>
</dependency>
// https://jarcasting.com/artifacts/com.google.code.maven-play-plugin.org.playframework.modules.excel/play-excel/
implementation 'com.google.code.maven-play-plugin.org.playframework.modules.excel:play-excel:1.2.3'
// https://jarcasting.com/artifacts/com.google.code.maven-play-plugin.org.playframework.modules.excel/play-excel/
implementation ("com.google.code.maven-play-plugin.org.playframework.modules.excel:play-excel:1.2.3")
'com.google.code.maven-play-plugin.org.playframework.modules.excel:play-excel:jar:1.2.3'
<dependency org="com.google.code.maven-play-plugin.org.playframework.modules.excel" name="play-excel" rev="1.2.3">
  <artifact name="play-excel" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.google.code.maven-play-plugin.org.playframework.modules.excel', module='play-excel', version='1.2.3')
)
libraryDependencies += "com.google.code.maven-play-plugin.org.playframework.modules.excel" % "play-excel" % "1.2.3"
[com.google.code.maven-play-plugin.org.playframework.modules.excel/play-excel "1.2.3"]

Dependencies

compile (4)

Group / Artifact Type Version
net.sf.jxls : jxls-core jar 1.0-RC-2
org.apache.poi : ooxml-schemas jar 1.0
org.apache.poi : poi jar 3.7
org.apache.poi : poi-ooxml jar 3.7

provided (1)

Group / Artifact Type Version
com.google.code.maven-play-plugin.org.playframework : play jar 1.2

runtime (3)

Group / Artifact Type Version
net.sf.jxls : jxls-reader jar 1.0-RC-2
commons-digester : commons-digester jar 2.1
org.apache.xmlbeans : xmlbeans jar 2.5.0

Project Modules

There are no modules declared in this project.

Excel module

The Excel module allows you to render Excel document. It is rather simple to use as it only requires to import a static file.

The tool uses the jxls library.

In order to use the Excel module, you need to create an Excel based template – see http://jxls.sourceforge.net for details instruction.

What’s New in v1.0a

  • support Play 1.1-RC1
  • jxls update to 1.0-RC1 along with it’s dependencies
    • POI 3.6
    • Jexl 2.0

Enable the Excel module for the application

In the /conf/application.conf file, enable the Excel module by adding this line:

# The Excel module
module.Excel=${play.path}/modules/Excel
excel.template.root=app/views

note, please change the excel.template.root from app/views to some where else when you use excel module with Play version 1.02 or before. Otherwise your application will not be able to startup on product mode.

Using the Excel module

The renderExcel() method:

import static play.modules.excel.Excel.*;

And then use the renderExcel() method as you would use the render() method.

The renderExcel() behavior is almost the same as that of render() except the following differences:

  1. the template should be an excel file with “.xls” suffix rather than a text file with “.html”
  2. You can use renderArgs.put(“fileName”, “your-file.xls”) to indicate the name of the excel file to be generated

Known Issue

  • While using chrome and IE, the filename is not the one specified by “fileName” but the last string in the url. E.g. if the url is http://localhost:9000/1/namecard, the file name will be namecard instead of 1.xls which is specified in the program. There is not such problem in FF.

Please refer to the sample for an example.

Versions

Version
1.2.3