Hour 8. Report with Style
Introduction
This article shows how to create a style for an SSRS report.
SSRS Report with Style
Step 1
To add the report, right-click on "Reports", select "Add" and click on "New Item".
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/add new item.jpg)
Step 2
Select "Report" and provide the report name.
![select report](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/selct report.jpg)
Step 3
Right-click on the design surface then select "Insert" and click on "Page Header".
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/insert page header.jpg)
Step 4
Right-click on the design surface then select "Insert" and click on "Page Footer".
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/insert page footer.jpg)
Step 5
Right-click on the page header, select "Insert" and click on "TextBox".
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/insert textbox.jpg)
Step 6
Create two textboxes, one is for "Report Header" and another is for "Report Header Detail".
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/two textboxes.jpg)
Step 7
Create a table in the database where we have EntityName with style parameters like "BackgroundColor", "Font" and so on. For each parameter create one column.
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/sql table.jpg)
Step 8
Now we set style parameter values for each entity in the database table. We set Black as the background color and White as the font color for the Header Title.
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/parameter values.jpg)
Step 9
Right-click on "Shared Datasets" and select "Add New Dataset".
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/add new dataset.jpg)
Step 10
Provide an appropriate dataset name and select data source.
Provide a Stored Procedure name that selects the data from the preceding table.
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/dataset properties.jpg)
Step 11
Add a dataset in the report data, right-click on "Datasets" and click on "Add Dataset".
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/add dataset.jpg)
Step 12
Provide a dataset name and select Use a shared dataset.
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/dataset name.jpg)
Step 13
Select the "Report Header" text box and go to properties.
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/report header properties.jpg)
Step 14
In properties, select "BackgroundColor" and click on "Expression…".
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/backgroundcolor.jpg)
Step 15
Set the expression as follows.
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/set expression.jpg)
Step 16
In the same way set the expression for the font color.
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/set expression for color.jpg)
Step 17
Now click on preview and you can see that the report header has a Black background and White font.
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/reportheader preview.jpg)
Step 18
Now change the background color and font color in the database for HeaderTitle. Here we change the background color from Black to Red and the font color from White to Black.
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/change color.jpg)
Step 19
In the preview tab click on the refresh button and your report style is changed based on the data you changed in the database.
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-801092019123748/Images/refresh button.jpg)
Using the same pattern you can apply a dynamic style for all the entities in the entire report.
Author
Akshay Patel
58
28.6k
7.7m