Save SSRS Reports i.e. from (.rdl and .rdlc)

Introduction:

What is RDL?

A report definition contains data retrieval and layout information for a report. Report Definition Language (RDL) is an XML representation of this report definition. RDL is an open schema; developers can extend RDL with additional attributes and elements.

The standard file extension for report definition files is .rdl. Its MIME type is text/xml.

What is RDLC?

The ReportViewer control supports a local processing mode that allows you to run client report definition (.rdlc) files using the built-in processing capability of the control. The RDLC is Report Definition Language Client.

The standard file extension for report definition files client is .rdlc. Its MIME type is text/xml.

Purpose:

The purpose of this is to allow user to save reports in various extensions. In case where the reports should be internally generated, without previewing it, the ReportArtifact class can be used.

The scenarios can be as follows:

1) A server side report has to be saved. The only option is use Report Manager, render the report and then save it. This will require all the users in production environment to have the permission in the Report Manager. It’s not possible to grant permissions to all to generate report.

2) A client side report has to be saved. It could be achieved by using Report Viewer, after previewing the report in it.

Granting a resource the permissions, to save reports, is just, reserving a resource on client side production environment. This will even require the resource to be trained for the same.

Instead the saving the reports could be made much simpler and easy to generate.

Prerequisite:

1) .Net 2.0 or above,

2) Minimum Permission in Report Manager (SQL Server Reporting Services 2005).

Description:

ReportType categorizes into the following:

· RDL (Report Definition Language – Server side reports)

· RDLC (Report Definition Language Client – Client side reports)

The ReportArtifact class is used to save reports in the specified path with specified extensions.

RDLC saves report with the help of report viewer UI control of .net.

RDL saves report by picking up the deployed reports on the report server.

Steps:

(1) Add web reference http://REPORTSERVERNAME/reportserver/ReportExecution2005.asmx.

where REPORTSERVERNAME : Report server name. Specify the same in the SaveRDLReport method. If the report server is on your system, then specify "localhost".

(2) Fill the objects of SaveParameter by specifying the extension, report type and the report save path.

(3) Fill the objects of ConfigurationDetail by specifying the various network and database configuration details.

(4) Call the SaveReport method of the class ReportArtifact.

(5) Pass the filled objects in Step (2) and (3) to the Save Report.

(6) The report is saved in the specified path and with appropiate extension.

Class Diagram:

clip_image002

Class descriptions: (Appendix A, Section 1)

1) ReportArtifact – Class used to save RDL or RDLC reports in various extensions by validating parameters and applying appropiate data source credentials.

Parameters: (Appendix A, Section 2)

1) SaveParameter – Class declares the following properties required to save a report.

(i) SaveFileExtension : Specifies the extension, of the format, of the report to be saved in.

(ii) SaveFilePath : Fully qualified path where the report gets saved.

(iii) SaveReportType : The type of the report (RDL or RDLC)

(iv) RDLCLocalReport : Local report of report viewer for RDLC

2) ConfigurationDetail – Class capturing the configuration details required for the reports using the following reports.

(i) ReportServerName : Report server Name

(ii) DataSourceName : Database’s Data Source Name

(iii) DataSourceUserName : Specifies database User Name (if any)

(iv) DataSourcePassword : Specifies database password (if any)

(v) NetworkCredentialsRequired : Network credentials required or not.

(vi) NetworkDomainName : Network domain

(vii) NetworkUserName : Network User Name

(vii) NetworkPassword : Network Password

Methods: (Appendix A, Section 1)

1) SaveRDLReport – Saves RDL report into specified FileExtension.

Supported extensions include XML, PDF, MHT, Excel, CSV and MHTML.

2) SaveRDLCReport – Saves RDLC report into specified FileExtension.

Supported extensions include Excel and PDF.

Things to remember:

1) The RDL reports to be saved should be deployed on the report server along with the data source.

2) User saving the reports should have rights in the report server else specify the Network credentials. Specify the network user name and password of the user with rights in the report server.

Report with Report Parameter:

If the report is having report parameter, you can extend the class. Providing a sample code in Appendix A: Section 5.

Limitations:

1) RDLC reports can only be saved in the specific formats (PDF and Excel).

It does not support other extensions.

References:

http://msdn.microsoft.com/en-us/library/ms252109.aspx

http://msdn.microsoft.com/en-us/library/ms251839(vs.80).aspx

ASP.NET & SSRS – Render report to PDF format

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: