Saturday, April 30, 2011

Crystal Reports : Alternating background color

To make a report easier to read, you can alternate the background color to help different lines stand out. (Think of the old green and white striped paper you used to put in your tractor printer years ago)

To make this happen, we will need to format the Details Section of our report.

Step #1 : From the top-level menu, select Format Section.
Step #2 : Select the "Detail" section on the left hand side.
Step #3 : Click on the "Color" tab on the right hand side.
Step #4 : Click the [formula] button with the "x-2"on it to bring up the formula editor.
Step #5 : Paste in the following : if RecordNumber mod 2 = 0 then crSilver else crNoColor

This will alternate a white and silver background for each row printed.

Pro Tip : To alternate color for Group rows, paste the following into the Group section color formula: if GroupNumber mod 2 = 0 then crSilver else crNoColor

No comments: