Total Pageviews

2015/11/03

[iReport] How to remove extra row and column when export to excel file

Problem
When I export report with excel format via iReport/JasperReports, the excel file always has extra blank row and extra blank column as following:

User asked to remove the unnecessary row and column. 

How-to
Add two properties to this jrxml file, and set to true

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="dbm506r1" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d1c3bf81-aa19-4e0e-ad82-0a34f472e482">
 <property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
 <property name="ireport.zoom" value="1.3310000000000004"/>
 <property name="ireport.x" value="0"/>
 <property name="ireport.y" value="0"/>
 <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
 <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>

Check the result:



Reference
[1] http://stackoverflow.com/questions/8354126/ireport-jasperreports-extra-row-issue

No comments: