SQL Scrapbook

Short and simple SQL Server posts

Archive for March 2011

SSRS PageName Part1/2

leave a comment »

Prior to SSRS 2008 R2 when you export a multi page report to excel the sheet names are by default named as sheet1, sheet2 …sheet N. It is very difficult if not impossible to change these names to custom names.

A new feature is introduced in SSRS 2008 R2 that allows renaming sheet names. Let’s see how it works.

To begin with, I have simple report with two tables.

clip_image002

To render the tables in separate pages instead of rendering them one after the other, add a page break after the first table.

clip_image004

If you click preview and export the report to excel you will see the report rendered as sheet1 and sheet2 in excel.

But remember we wanted to give them custom names. So to do that first select the top table (or tablix whatever you want to call, I am used to call it table) and in the properties scroll down to ‘PageName’. You can enter a string here that will be the name of the sheet in excel. As you can see I named it as ReportEast. Now do the same for the bottom table in the report and name it ReportWest.

clip_image006

Preview the report and export to excel you will notice that the sheets are now named as ‘ReportEast’ and ‘ReportWest’.

clip_image008

Written by sqlscrapbook

March 26, 2011 at 11:16 am

Posted in Uncategorized