Friday, October 2, 2015

Custom Report Template in SSRS




SQL Server Reporting Services (SSRS) allows us to create custom report templates with the customize report layout and after creating that we can use that custom template every time when we creating a new report.
Go through below steps :
1. First of all open Visual Studio 2010 and open any ssrs project.In Solution Explorer Right Click on Reports and select Add –> New Item.
Custom Report Template in SSRS-1
2. Then select Report from Installed Templates and Give Name of that Report.
Custom Report Template in SSRS-2
3. Then click on Add button. So your blank report is added.Now right click on report area and select Add Page Header.
Custom Report Template in SSRS-3
After that again right click on report area and select Add Page Footer.
4. Now your Report Design will look like below :
Custom Report Template in SSRS-4
5. Now right click on Page Header area and select Insert –> Image.
Custom Report Template in SSRS-5
6. A Image Properties window pop-up.In that specify name of Image and then import any image from your hard drive.You can also give size of Image from this window.
Custom Report Template in SSRS-6
Then click on OK.
7. Now we will add some Built-In fields in Page Header and Footer.In Page Header we will add Report Name and in Footer we will add Execution Time, Overall Page Number & Overall Total Pages.You will find these built in fields under Built-In-Fields in Report Data Page.
After adding these fields in header and footer, your report design will look like below :
Custom Report Template in SSRS-7
So we are done with our custom template.
Now we need to place it in appropriate location so that it appears in Report Templates while creating a new project.
For Sql Server 2012 location is
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject
For Sql Server 2008 location is
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject
Now you need to copy your custom template (which is CustomTemplate.rdl file in your Report Project Folder) to above location.
8. Once you copied custom report template to appropriate location it will start showing as a report template on the New Item or Report Dialog box.
To check this ,try to add new item or report.
Custom Report Template in SSRS-8
9. Then click on Add button.So now your Report Layout automatically look like below :
Custom Report Template in SSRS-9
Congratulations! We successfully created Custom Report Template in SSRS.