Extra space in excel cell when exported from jaspereports

I'm facing the issue in jasperreports when exported to excel it is creating extra space in a cell.It is working as expected for PDF as shown in picture.But when exported to excel it is creating extra space due to property stretch with overflow=true (I need to use this one as it helps for PDF exporting).I used the property net.sf.jasperreports.export.xls.column.width =1000 for the last element to increase the width while exported to excel .it helped to get the result but the extra space is created as show in picutre.Please let me the properties I need to use for this kind of situation.

The properties I used to entire report are

    <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
    <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
    <property name="net.sf.jasperreports.export.xls.white.page.background" value="false"/>
    <property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
    <property name="net.sf.jasperreports.export.xls.ignore.graphics" value="false"/>
    <property name="net.sf.jasperreports.page.break.no.pagination" value="apply"/>
    <property name="net.sf.jasperreports.export.xls.one.page.per.sheet" value="false"/>
    <property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
    <property name="net.sf.jasperreports.exports.xls.font.size.fix.enabled" value="false"/>


The properties for particular last element

<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="false"/>
                    <property name="net.sf.jasperreports.export.xls.column.width" value="1000"/>
                    <property name="net.sf.jasperreports.export.xls.wrap.text" value="true"/>

For the detail band elemets I used position Type=float

strecth type = elementgroup heigh

Looking for possible solution to remove extra space in cell

PDF export

Excel Export



jasperrocks's picture
Joined: Mar 3 2016 - 4:50pm
Last seen: 4 years 7 months ago

2 Answers:

Try to set the following property for the text element:

<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
shertage's picture
Joined: Sep 26 2006 - 8:06pm
Last seen: 11 months 3 weeks ago

That helped me with the same problem

wvombat's picture
Joined: Jun 7 2016 - 6:25am
Last seen: 2 years 2 weeks ago