How to access Report Name attribute from within a report?

后端 未结 2 967
粉色の甜心
粉色の甜心 2021-01-27 11:53

In a jasper report, with iReports Designer one can set the Report Name to some value (in iReports, this is on the most top node in the report inspector).

How can the val

2条回答
  •  悲哀的现实
    2021-01-27 12:32

    With help of JASPER_REPORT parameter we can get instance of JasperReport class. This is the current template object.

    With help of JasperReport.getName() method we can get the report name.

    Example of template

    
    
        
        
            <band height="50" splitType="Stretch">
                <textField>
                    <reportElement x="110" y="0" width="290" height="25"/>
                    <textFieldExpression><![CDATA[$P{JASPER_REPORT}.getName()]]></textFieldExpression>
                </textField>
            </band>
        
    
    

    In this example the name of report is: name="Show the report name example"

    The output result in Studio

提交回复
热议问题