shuhovivan Posted February 13, 2017 Share Posted February 13, 2017 I created a few conditional styles for a text field in a table cell. The styles contains custom font formatting and background color setting. So the font formatting works great, but background color is not.When i created the styles, i followed these steps:Create the style;In that style create two conditional styles with all settings (font and background);The conditions are:$F{DAY_OF_WEEK}.doubleValue() == 0$F{DAY_OF_WEEK}.doubleValue() == 1Apply the style to my Text Field ($F{DAY_OF_WEEK}).Please help me figure out what is wrong here. Link to comment Share on other sites More sharing options...
taepoop12 Posted February 13, 2017 Share Posted February 13, 2017 you can just create IF ELSE statement for your problem if my understanding is right, or left Link to comment Share on other sites More sharing options...
sanbez Posted February 13, 2017 Share Posted February 13, 2017 You have to check style mode="Opaque" in conditionalStyle with backcolorHTH Link to comment Share on other sites More sharing options...
shuhovivan Posted February 14, 2017 Author Share Posted February 14, 2017 Would you explain how can i set color in IF ELSE statement? Link to comment Share on other sites More sharing options...
shuhovivan Posted February 14, 2017 Author Share Posted February 14, 2017 Unfortunatly, style mode="Opaque" doesn't work.May be i did something wrong?<style name="StyleVacation" backcolor="#A6D3A6"> <conditionalStyle> <conditionExpression><![CDATA[$F{DAY_8}.doubleValue() == 0]]></conditionExpression> <style mode="Opaque" backcolor="#F0F04D" fill="Solid" radius="4" hTextAlign="Left" vTextAlign="Top" pattern="" isBlankWhenNull="true" fontName="DejaVu Sans Mono" fontSize="1"/> </conditionalStyle> <conditionalStyle> <conditionExpression><![CDATA[$F{DAY_8}.doubleValue() == 1]]></conditionExpression> <style mode="Opaque" backcolor="#94EBB2"/> </conditionalStyle></style><jr:detailCell style="Table_TD" height="30"><textField> <reportElement key="" style="StyleVacation" x="0" y="0" width="50" height="30" backcolor="#FFFFFF"/> <textElement markup="none"> <font fontName="DejaVu Sans"/> <paragraph lineSpacing="1_1_2"/> </textElement> <textFieldExpression><![CDATA[$F{DAY_8}]]></textFieldExpression></textField></jr:detailCell>[/code] Link to comment Share on other sites More sharing options...
avinash.eng18 Posted February 14, 2017 Share Posted February 14, 2017 you can change the code, with style mode="Opaque" Link to comment Share on other sites More sharing options...
Solution narcism Posted February 15, 2017 Solution Share Posted February 15, 2017 You need to remove the "backcolor" atribute on the reportElement from your JRXML.It takes precedence over the one coming from the style.You can manually remove the attribute:in the "Appearance" tab of the textField's Properties view by right-clicking the Backcolor color box and selecting the "Set to Null" option orfrom the "Source" tab of your report by directly editing the JRXML 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