How to change the sheet name of excel based on parameters provided.

Hi all,

Jasper studio version 6.3.1

Jasper server version 6.3.0

I am facing problem to override the sheet name based on parameter it receives. I know people have posted this question before and the solution is to use this property but on which element I should implement this property. Please help me over this and also is there any way to change the file name dynamically as well.

Thanks in advance.

gauravkumar's picture
Joined: Mar 20 2017 - 5:16am
Last seen: 5 years 4 months ago

1 Answer:

check the below jrxml.

The documentation mentioned that the last element to be rendered with this property value will become the sheet name.

so i have placed the property on a text field inside the detail band.


<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version using JasperReports Library version 6.2.0  -->
<!-- 2017-05-10T12:52:05 -->
<jasperReport xmlns="" xmlns:xsi="" xsi:schemaLocation="" name="printSheetName" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b6735bd2-5665-45f8-86c7-02b39d58c5f2">
    <property name="" value=""/>
    <parameter name="SheetName" class="java.lang.String"/>
        <![CDATA[select * from dual]]>
    <field name="DUMMY" class="java.lang.String"/>
        <band splitType="Stretch"/>
        <band height="30" splitType="Stretch">
                <reportElement x="0" y="0" width="100" height="30" uuid="fc5b9b93-e496-4cac-903c-748cb3e3bcbf"/>
        <band height="30" splitType="Stretch">
                <reportElement x="0" y="0" width="100" height="30" uuid="c59d9bdd-8524-4b14-ba30-5a833f72a1bc">
                    <propertyExpression name=""><![CDATA[$P{SheetName}]]></propertyExpression>

reportdev's picture
Joined: Oct 12 2015 - 12:05pm
Last seen: 7 months 3 weeks ago