Have you ever had the urge to create many similiar reports in Reporting Services without having to do all the busy touch up work thats involved? You know what I mean; the constant header information with your company's logo, the footer with a datetime stamp, or the table that you always have to drag and drop into the report. What about having the ability for a "new report item" to automatically come out adjusted as a landscape type report (11 x 8.5in) without always having to redefine it.
What You've Been Doing All Along
Every morning you come into work, you open your report project and you begin creating a new report. And in each one of those reports you have to enable the header and footer, place the logos and times stamps, and set the width of the report to be a landscaped version. You've done this once for every report and it takes you a good 10 minutes. You've created well over 50 reports, thats 500 minutes, that's more than 8 hours of work!
What You Can Do
Believe it or not you can create a template report and re-use it across your report projects. A template you say, what's that? Well think of a template as a starting point on a task, the bare bones is done for you so you can concentrate on the important aspects of the report. Think of it like CSS formatting on a web page so you can pay more attention to the actual contents of the page rather than what the web page looks like.
Creating A Report Template In VS
- Add a new report to your project
- Using the report designer place any objects (text boxes, tables, lines, etc) on the report that you want as a template.
- Give the report a name (anything that you can remember in the future, for instance if you want landscape reports and you create a landscape template you should then call the report LandscapeTemplate.rdl)
- Save this .rdl file to: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject\
The next time you add a report item you will notice this item in the Templates section:
That's all there is to it.
So simply design the header / footer of your report. Set the page size you would like and save this .rdl file. Place the rdl file in the path mentioned above in green. The next time you want to create one of your standard 50 reports use the template to get the bare bones of your report complete.
Thanks to Andrew Polter for pointing this tip out!