Alternate Band Color (Non Detail Level)

Cory Fifield -

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

mceclip0.png

 

 

2. Change the Script Language property to Visual Basic.

mceclip1.png

 

 

3. Select the band that you want to have the alternating colors on. (This example uses the GroupFooter1)

mceclip1.png

 

 

4. Expand the drop down on the Scripts property.

mceclip2.png

 

 

5. Add a new Before Print script.

mceclip4.png

 

 

6. Add the following code above the Private Sub: Private Counter as integer = 0

mceclip5.png

 

 

7. Paste the following code inside the BeforePrint script that was created:

 

If Counter = 0 Then
GroupFooter1.BackColor = Color.White
Counter = 1
Else
GroupFooter1.BackColor = Color.Orange
Counter = 0

End If

 

Code Screenshot:

mceclip6.png

 

 

8. Verify that the BeforePrint was created on the correct band. (This example used the GroupFooter1)

mceclip7.png

 

 

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)

mceclip8.png

 

10. Validate the code and preview the changes.

mceclip9.png

Have more questions? Submit a request

Comments