jack.bracey_1 Posted September 13, 2019 Share Posted September 13, 2019 I am looking for the ability to use the value of a parameter passed into the report to be used as the hex colour value of the background in a conditional style, does anyone know how to achieve this?My code so far:<style name="Parameterised Text Colour"> <conditionalStyle> <conditionExpression><![CDATA[$P{styling}!=null]]></conditionExpression> <style backcolor={$P{style}}/> </conditionalStyle> <conditionalStyle> <conditionExpression><![CDATA[$P{styling}==null]]></conditionExpression> <style backcolor="#000000"/> </conditionalStyle> </style>Any help is greatly appreciated Link to comment Share on other sites More sharing options...
C-Box Posted September 16, 2019 Share Posted September 16, 2019 As far as I know the color attributes are just static ones.... so you can't set these to a dynamic value concerning at a parameter or even a field expression.I created a java "PreProcessor" when loading the jrxml (per JasperAPI) and changed the style colors per JRDesignAPI (so e.g. each month could have another color defined by the user. so I created 12 styles per API and set the style background-color to the database value, afterwards I recompile the (changed) design and pass this to the normal fill manager. Works fine for my purose. :-) Perhaps just an idea for your solution (if you also call your reports from a java application)hth + regardsC-Box 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