Create a Greenbar Report in SQL Server Reporting Services


By:   |   Updated: 2015-03-31   |   Comments   |   Related: > 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 Updated: 2015-03-31


get scripts

next tip button



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





Comments For This Article





download





Recommended Reading

SQL Server Reporting Services (SSRS) Controlling Report Page Breaks

Alternate Row Background Color in SQL Server Reporting Services Tablix and Matrix

Display a fixed number of rows per page for an SSRS report

Creating a Tabbed Report in SSRS

Conditional Formatting for SQL Server Reporting Services Reports








get free sql tips
agree to terms


Learn more about SQL Server tools