Learn more about SQL Server tools

mssqltips logo
giveaway
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

 

Create a Greenbar Report in SQL Server Reporting Services


By:   |   Read Comments   |   Related Tips: > Reporting Services Formatting

Problem

How can I create a "Greenbar" style report in SQL Server Reporting Services like the one shown below?

Greenbar report
Solution

We can simulate a greenbar styled report in SQL Server Reporting Services (SSRS) by alternating the BackgroundColor property for even and odd rows. For those of you not familiar with greenbar reports, these reports are printed on paper with horizontal boxes alternating between green and white to help the reader keep their eye on one line as they read from left to right.

Speaking from personal experience, if the reader of the report will only view the report online and not print the report, then alternating between green and white backgrounds will be very helpful. However, if the report is to be printed then two issues might arise. The first issue is cost since green ink is typically more expensive than black ink. The second issue is legibility when the printer only has a black ink or toner cartridge. Therefore, in this tip we will alternate between white and a light shade of gray.

In design mode, select the cells that make up the report data details row.

Select detail data cells

In the Properties window, press on the down arrow in the BackgroundColor property's value box and click on Expression...

BackgroundColor property

The Expression builder window now appears. Enter the following expression:

=iif(RowNumber(Nothing) Mod 2,"Gainsboro","White")

Expression builder

Click on OK and preview your report.

Graybar report
Next Steps

Print out one page of the report on the report user's printer to make sure it is legible. The color chosen might need to be lighter or darker, depending on the printer.

Also, check out more tips and tutorials on SSRS MSSQLTips.com.



Last Update:






About the author
MSSQLTips author Dallas Snider Dr. Dallas Snider is an Assistant Professor in the Computer Science Department at the University of West Florida and has 18+ years of SQL experience.

View all my tips





More SQL Server Solutions











Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Notify for updates 


SQL tips:

*Enter Code refresh code     



Learn more about SQL Server tools