sdandekar Posted August 9, 2011 Share Posted August 9, 2011 I am using iReport3.5.2 and have a repot where Iwould like to have alternate row colors. I have searched this forum and googled it, found several alternatives. In my case I found that it could be done with styles applied to a frame. However, when I applied it in my report, it did not work either in PDF or on the Excel or RTF outputs.What do I need to do to get the alternate row color?Code: <style name="EvenOddRowStyle" isDefault="false" backcolor="#DFE5FF"> <conditionalStyle> <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue() %2 == 0)]]></conditionExpression> <style isDefault="false"/> </conditionalStyle> </style> <detail> <band height="20"> <frame> <reportElement style="EvenOddRowStyle" x="0" y="0" width="692" height="20"/> <textField isBlankWhenNull="true"> <reportElement x="223" y="0" width="66" height="20" forecolor="#404040" backcolor="#FFFFFF"/> <textElement textAlignment="Center" verticalAlignment="Middle" markup="styled"> <font fontName="Arial" size="10"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{sumItems}]]></textFieldExpression> </textField> </frame> </band> </detail> Link to comment Share on other sites More sharing options...
szaharia Posted August 10, 2011 Share Posted August 10, 2011 Hi,You have to write properly the conditional style. The backcolor should be set within the conditional style itself, or it gets applied everywhere.HTH,sandaCode:<style name="EvenOddRowStyle" isDefault="false" mode="Opaque"> <conditionalStyle> <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue() %2 == 0)]]></conditionExpression> <style backcolor="#DFE5FF"/> </conditionalStyle></style> Link to comment Share on other sites More sharing options...
afaquecena Posted June 17, 2015 Share Posted June 17, 2015 11) Simply take a rectangle set its print when expression as $V{REPORT_COUNT}%2==02) keep all the fields inside that rectangle in detail band3) choose appropriate backcolor for rectangle Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now