Custom Class for JasperReports field

瘦欲@ 提交于 2019-12-05 05:16:45

In the Jasper report design, the field will be defined as below:

<field name="cl1_ob1" class="Class1">
   <fieldDescription><![CDATA[cl1_ob1]]></fieldDescription>
</field>

And the 2 variables of Class1 can be accessed by calling the getter method (if there is one) or you can use the variable directly, depending on it's access privileges. For Example, $F{cl1_ob1}.getCl1_f1() can be used as a text-field expression, as shown below:

<textField>
   <reportElement x="36" y="26" width="235" height="20"/>
   <textElement textAlignment="Center" verticalAlignment="Middle"/>
   <textFieldExpression><![CDATA[$F{cl1_ob1}.getCl1_f1()]]></textFieldExpression>
</textField>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!