Crystal Reports® Tips and Tricks: Creating a Green Bar Effect

>> Tuesday, April 13, 2010

Do you remember green bar paper? It was wide continuous feed paper meant for giant dot matrix printers used by accounting departments. The paper was printed with alternating white and light green bars. The purpose of the green bars was to make it easier to follow a single line of data across the printed sheet.

I personally prefer this method over adding grid lines to the report. In this post, I'll show you how to simulate that green bar effect in Crystal Reports®.

Here is a down and dirty report that I created from the AdventureWorks database. Very simple, it gives the last name, first name and phone number from the Contact table. As you can see it gets difficult to know which phone number belongs to which name.


 


What we need to do now is add our green bars. With the report in design mode within Crystal Reports®, right click and select section expert.


Select the details section.


Now select the color tab.


Select the formula editor button (x+2) to bring up the format formula editor and enter the following line of code:

If remainder(RecordNumber,4) in [2,3] then Color (228, 255, 223) else crNoColor


The formula divides the record number by four. If the remainder equals two or three, it prints a light green bar as a background color for the details section. Save and close, then preview the report.


That's more like it, much easier to read and follow. Hope you liked this tip. If I can answer any questions or you have comments, use the comments button below.

Til next time…

GW

0 comments:

Post a Comment

^ Scroll to Top /*---------- GOOGLE ANALYTICS --------------*/ /*--------END GOOGLE ANALYTICS ------------*/