Step by Step SSRS in 11 Hours: Hour 8


This article shows how to create a style for a SSRS report.


Report with Style

Step 1

To add the report, right-click on "Reports", select "Add" and click on "New Item".

Step 2

Select "Report" and provide the report name.

select report

Step 3

Right-click on the design surface then select "Insert" and click on "Page Header".

Step 4

Right-click on the design surface then select "Insert" and click on "Page Footer".

Step 5

Right-click on the page header, select "Insert" and click on "TextBox".

Step 6

Create two textboxes, one is for "Report Header" and another is for "Report Header Detail".

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.

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.

Step 9

Right-click on "Shared Datasets" and select "Add New Dataset".

Step 10

Provide an appropriate dataset name and select data source.

Provide a Stored Procedure name that selects the data from the preceding table.

Step 11

Add a dataset in the report data, right-click on "Datasets" and click on "Add Dataset".

Step 12

Provide a dataset name and select Use a shared dataset.

Step 13

Select the "Report Header" text box and go to properties.

Step 14

In properties, select "BackgroundColor" and click on "Expression…".

Step 15

Set the expression as follows.

Step 16

In the same way set the expression for the font color.

Step 17

Now click on preview and you can see that the report header has a Black background and White font.

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.

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.

Using the same pattern you can apply a dynamic style for all the entities in the entire report.

Similar Articles