Monday, 28 July 2014

Alternating background colors in Reporting Services

One common question from many of those who are relatively new to Microsoft SQL Server Reporting Services is how to alternate the background color of detail rows in a table data region.

Although I'm sure samples of this have been posted elsewhere on the Internet, I thought I'd share a common technique in the hopes that those searching for a solution will find it, either here or elsewhere.

Let's consider an example. We have an employee phone list report as shown below.


To make the report a little easier to read horizontally, we'd like to change the background color of every other row. To do so, let's highlight the detail row of the data table in the layout tab.


In the properties window, find the BackgroundColor property for the highlighted row and choose <Expression...>. Add the following conditional formatting statement in the Edit Expression window.


Click Ok, and preview the report.


And there you go, a report that alternates the background color for each row.


No comments:

Post a Comment