Jump to content
We've recently updated our Privacy Statement, available here ×

Is there a way to set xcel output sheet name?


patricia.williams

Recommended Posts

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 8 months later...

That link hints that you can use net.sf.jasperreports.export.xls.sheet.name to obtain that, but does not really explain how.

A little trial&error testing in Jasper Studio 6.4.0.final using a simple report with column header and detail band, revealed that JS was very picky about where to place it. I could only get it to work if I placed it inside a reportElement:

<detail>
        <band height="14" splitType="Stretch">
            <textField>
                <reportElement x="0" y="0" width="70" height="14" uuid="e0777908-52d5-4c52-8fb3-fcb3c31633bb">
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <propertyExpression name="net.sf.jasperreports.export.xls.sheet.name"><![CDATA[$V{SheetDetail}]]></propertyExpression>
                </reportElement>
                <textFieldExpression><![CDATA[$F{REP_AAR}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="70" y="0" width="85" height="14" uuid="b0d57d3b-0c00-4eb2-a106-d845732c8015"/>
        

$V{SheetDetail} is just a variable I created to hold the name of the sheet. It could also be a field. 

Furthermore, it did not matter in which field i placed the "sheet name", so I just placed it in the first field.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...