2013-07-23 28 views

回答

1

在你的報告開頭使用樣式定義:

<style name="DataCellStyle" mode="Opaque" border="None"> 
    <conditionalStyle> 
    <conditionExpression> 
     <![CDATA[new Boolean($V{REPORT_COUNT}.intValue() % 2 == 0)]]> 
    </conditionExpression> 
    <style mode="Opaque" backcolor="#E0E0E0" /> 
    </conditionalStyle> 
</style> 

...並以此風格爲您的數據細胞:

<detail> 
    <band height="15"> 
    <textField> 
     <reportElement x="0" y="0" width="150" height="15" style="DataCellStyle"/> 
     <textFieldExpression class="java.lang.String"> 
     <!-- something --> 
     </textFieldExpression> 
    </textField> 
    </band> 
</detail> 

有關條件更多信息風格是here

+0

問題是關於* Java *代碼 –

+0

哦 - 對不起。我錯過了筆記... – MrD

+0

好的..我明白了。通過JRDesignConditionalStyle我們可以設置條件表達式。 –

相關問題