Using variables in Conditional Style

前端 未结 3 974
栀梦
栀梦 2020-12-19 06:26

I have a Title band with a Text Field containing a calculated Variable $V{avg_perc}. The Text Field has the evaluati

相关标签:
3条回答
  • 2020-12-19 06:33

    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

    0 讨论(0)
  • 2020-12-19 06:41

    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.

    0 讨论(0)
  • 2020-12-19 06:53

    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>
    
    0 讨论(0)
提交回复
热议问题