Using variables in Conditional Style

旧街凉风 提交于 2019-11-29 10:38:26

I finally found the solution for my problem. Adding

<property name="net.sf.jasperreports.style.evaluation.time.enabled" value="true"/>

at the report level causes a Conditional Style to be performed at the moment at which the element is evaluated. See this answer in the Jaspersoft Community for more information.

in your view ireport designer.

click on the field and in the properties panel.: markup = styled selected

Right click on the fied. edit expression:

($F{fila1}.equals("c") ? "<style forecolor='red'>"+ $F{fila1}+"</style>" : $F{fila1})

or xml

<textFieldExpression><![CDATA[($F{fila1}.equals("c") ? "<style forecolor='red'>"+ $F{fila1}+"</style>" : $F{fila1})]]></textFieldExpression>

Modify this code based on your requirement

<style name="alternateStyle" fontName="Arial">
    <conditionalStyle>
        <conditionExpression><![CDATA[new Boolean($V{AMOUNT}.intValue() == 0)]]></conditionExpression>
        <style mode="Opaque" backcolor="#FF0000" isBold="true"/>
    </conditionalStyle>
</style>

And also refer this link : Link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!