Use of <style>..versus conditional styles


I am about to create several dynamic reports utilizing ireport but I am struggling with deciding on a standard for making dynamic fields.  It seem like the most flexible way to do was to utilize the <style>...</style> tags inside of text expression editor setting things like font size, background color etc.  This however seems to have limitations 1). Setting properties this way only sets them for the font itself not the entire text box.  For example, setting the background color only changes the text background color it does not change the entire text box.  2). I cannot use this method to dynamically set things like frames and rectangles.  The other option is Style Conditions. These  work however when you want to change to dynamically change more than one attribute (for example font size and color) the number of combinations of style conditions required become excessive.  In addition, the "code" now is distributed between the report itself and the java code calling it (to set the conditions). Is there something I am missing with either of these options or is there a third option that I am not even aware of?

jewendt's picture
Joined: Apr 27 2010 - 6:41am
Last seen: 7 years 3 months ago

1 Answer:

One think I would suggest is to use create base JRXML file with standard styles.
Then in Java or even better Groovy code parse mentioned JRXML and find needed elements. Change needed attributes on a fly and use newly dynamically created JRXML for report creation.

What do you think?

Best regards,
Taras Matyashovsky
tmatyashovsky's picture
Joined: May 30 2009 - 2:53am
Last seen: 8 years 2 months ago