Step by Step SSRS in 11 Hours: Hour 8

Step by Step SSRS in 11 Hours: Hour 8

Introduction

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

Contents

SSRS Report with Style

Step 1

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

image.png

Step 2

Select "Report" and provide the report name.

image.png

Step 3

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

image.png

Step 4

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

image.png

Step 5

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

image.png

Step 6

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

image.png

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.

image.png

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.

image.png

Step 9

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

image.png

Step 10

Provide an appropriate dataset name and select data source.

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

image.png

Step 11

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

image.png

Step 12

Provide a dataset name and select Use a shared dataset.

image.png

Step 13

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

image.png

Step 14

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

image.png

Step 15

Set the expression as follows.

image.png

Step 16

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

image.png

Step 17

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

image.png

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.

image.png

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.

image.png

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

Next >> Hour 9: Report with chart