Monday, April 29, 2013

Jasper Reports: Highlight Every Other Row

Here is a quick guide to highlight every other row in a Jasper report (5.0.0).

Step 1. Get your rows formatted how you want.
Step 2.  Add a Static Text item that spans the entire length of your row.
Step 3.  Delete the default text.
Step 4.  Set the background color to whatever you want
Step 5.  Check the 'Opaque' checkbox, it should be covering your row now
Step 6.  Right click on the static text item and select 'Send to back'
Step 7.  In the Print When Expression enter: new Boolean( $V{PAGE_COUNT}.intValue() % 2 ==0 )

And that should do it. Every second row should show as highlighted.

No comments:

Post a Comment