How to Export Multiple Sheets from Jasper Report
来源:互联网 发布:淘宝链接怎么发微信 编辑:程序博客网 时间:2024/06/05 19:21
Environment:
Jasper Studio 5.6.2, JDK 1.7
Step 1. Ensure Pagination NOT Ignored
<jasperReport ... isIgnorePagination="false" ...> ... </jasperReport>
Step 2. Configure Excel Exporter
<property name="net.sf.jasperreports.export.xls.one.page.per.sheet" value="true"/>
Additionally, we'd better configure the IDE's excel exporter setting.
Step 3. Place Page Break
Do not forget to place page Break element on the place from where you want to split the page. <Break> is an item in the tool palette in Japser Studio.
Step 4. Ensure Sufficient Page Size
LESSON: If your page height is not big enough, your page break might not work.
Beware that big page height might cause a lot of empty rows, which would result in out of memory error, thus we need to handle the empty rows properly, like ignoring empty rows and meanwhile using a small dot for row place holder when we really want an empty row.
Step 5. Dynamic Sheet Name
According to reference [4], <Dynamic Sheet Names>, and its sample code, I added the following propertyExpression in my project and it works!
<staticText><reportElement x="0" y="120" width="100" height="20" uuid="77d497e0-0cf0-4a2f-acf7-669f052721bd"><propertyExpression name="net.sf.jasperreports.export.xls.sheet.name"><![CDATA[$F{customer_id}.toString()]]></propertyExpression></reportElement><textElement><font isBold="true"/></textElement><text><![CDATA[Account ID]]></text></staticText>
STEP 6: Jasper Server Setting
WEB-INF/classes/jasperreports.properties
# report exporter hints override export parametersnet.sf.jasperreports.export.parameters.override.report.hints=true
#com.jaspersoft.jrs.export.csv.paginated=truecom.jaspersoft.jrs.export.xls.paginated=true#com.jaspersoft.jrs.export.pdf.paginated=false#com.jaspersoft.jrs.export.docx.paginated=false#com.jaspersoft.jrs.export.rtf.paginated=false#com.jaspersoft.jrs.export.odt.paginated=falsenet.sf.jasperreports.export.xls.one.page.per.sheet=true
WEB-INF/applicationContext.xml
<!-- export parameters --> <bean id="xlsExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.XlsExportParametersBean"> <property name="detectCellType" value="true"/> <property name="onePagePerSheet" value="true"/> <property name="removeEmptySpaceBetweenRows" value="false"/> <property name="removeEmptySpaceBetweenColumns" value="false"/> <property name="whitePageBackground" value="false"/> <property name="ignoreGraphics" value="false"/> <property name="collapseRowSpan" value="true"/> <property name="ignoreCellBorder" value="false"/> <property name="fontSizeFixEnabled" value="true"/> <property name="maximumRowsPerSheet" value="0"/> <property name="xlsFormatPatternsMap" ref="formatPatternsMap"/> </bean>
STEP 7: Jasper Server Excel Export Menu
Select the option <As Excel (Paginated) > !
Reference:
[1] http://jasperreports.sourceforge.net/api/net/sf/jasperreports/export/XlsReportConfiguration.html
[2] http://jasperreports.sourceforge.net/sample.reference/nopagebreak/
[3] http://helicaltech.com/blogs/split-excel-output-into-multiple-sheets/
[4] http://jasperreports.sourceforge.net/sample.reference/xlsfeatures/
- How to Export Multiple Sheets from Jasper Report
- How to Deploy/Publish Jasper Report to Jasper Server
- Jasper Report Problem: How to share subDataSet
- How to Set isIgnorePagination in Jasper Report
- Jasper Report export Excel properties
- How to Apply Conditional Style on Jasper Main Report Variable
- How to export C++ class from dll
- How to export files from rpm file on ubuntu system
- How to export class from xml schema file
- How to build multiple targets from a single Xcode Project
- Passing parameters to a Jasper report
- Jasper report
- Jasper report
- How to export/import data with LOB type from one user/schema to another
- How to Export and Import the AWR Repository From One Database to Another (文档 ID 785730.1)
- Submit Report & Export Results to Memory
- How to Report Bugs Effectively
- How to Report Bugs Effectively
- 【Tsinsen】A1499. Theresa与数据结构 cdq分治套树状数组套平衡树
- AIX5 RAC另一节点重启后 单一节点挂起
- C# XML用法
- 白领职场中的清规戒律
- WebService 之CXF拦截器,使用 CXF 拦截器进行简单的 head 信息验证,适合入门选手
- How to Export Multiple Sheets from Jasper Report
- Git系列博客——(3)git基础
- ContentNegotiatingViewResolver解析器
- 微信那蛋疼的事件消息
- KMP的一点心得
- [^搞^日志]Fedora 20通过pppoe连接校园网
- 第14周项目6-阅读程序(4,5,6)
- 六.sudo和root密码
- OpenCV2计算机视觉应用编程手册(自学版)初级七