Alternate Band Color (Non Detail Level)
Trouble Viewing Images? Click On Them To Enlarge.
In this article we cover the process of setting up alternating colors between bands. This article will deal with cases that do not use the Detail Band. These cases would include Group Headers, Footers and more. The alternating colors for the group bands are done differently than those at the detail level. For information on alternating colors at the detail level, click here.
Setting Up Alternate Colors
1. Select the XtraReport by using the Report Explorer or clicking outside the report area (indicated by orange box) then change the Script Language to Visual Basic
2. Change the Script Language property to Visual Basic.
3. Select the band that you want to have the alternating colors on. (This example uses the GroupFooter1)
4. Expand the drop down on the Scripts property.
5. Add a new Before Print script.
6. Add the following code above the Private Sub: Private Counter as integer = 0
7. Paste the following code inside the BeforePrint script that was created:
If Counter = 0 Then
GroupFooter1.BackColor = Color.White
Counter = 1
GroupFooter1.BackColor = Color.Orange
Counter = 0
8. Verify that the BeforePrint was created on the correct band. (This example used the GroupFooter1)
9. Verify the correct bands/labels are specified within the code. (This example used GroupFooter1, if you used GroupHeader2, these would need to say GroupHeader2 instead)
10. Validate the code and preview the changes.
Please sign in to leave a comment.