Turtorial 5-1. Creating “Green Bar” Reports
Let’s create a “Green Bar” report that simulates the paper style that was used to be common in business reports printed on wide paper. Every other line was shaded in a light green color. This made it easy for the reader to scan across a long line of data and not lose track of which row they were reading. We’ll use conditional formatting to simulate the green bar paper.
- Open the Crystal Reports sample report, Group By Intervals.rpt. Save it as Green Bar.rpt.
- This report has many rows within each group and the readability could be improved by shading every other row.
- In design mode, right-click on the gray area to the left of the Details section and select Section Expert from the pop-up menu. This opens the Section Expert dialog box.
- On the right side of the dialog box, click on the Color tab.
- The color tab only lets you choose the background color. You can either click on the checkbox and select a background color or click on the Formula button to apply conditional formatting. We want the background color to change dynamically, so click on the Formula button.
The Formula Workshop dialog box opens with the cursor in the text editing area. We want the formula to assign crSilver to the background color of every even row on the report.
- Type in the following formula:
The calculation divides the current row number by two and gets the remainder. If the remainder is zero, then the current row number is an even number and crSilver is assigned to its background color. If the remainder is not zero, then this is an odd row and we assign the DefaultAttribute to the background color (this is the same as telling it not to modify the original color).
- Click the Save and Close button in the top left corner to save the changes.
- Click the OK button of the Section Expert to save your changes.
- Preview the report and you’ll see that every other row now has silver shading.
This tutorial showed you how to use the Formula Workshop to create a conditional formatting formula. You’ll learn the details of using the Formula Workshop in the next section.