Archive for May 21st, 2008

21
May
08

#03 SQL Reporting Link Rendering A Report as a PDF

Once you create a SQL Reporting Services report and deploy (or upload the .rdl and .rds files) you can reference the report via a link and render it as a pdf (or Excel) via the following pattern (assumes no ssl)

http://ServerName/ReportServer?%2fFolderName%2fReportName&parm1=value&rs%3aCommand=Render&rs%3AFormat=PDF

Variables (note ‘ReportServer’ is a constant)

  • ServerName – Server housing SQL Reporting Services
  • FolderName – Typically the name of your Visual Studio Project
  • ReportName – name of the .rdl file defining your report
  • parm1=value  (ignore if not passing parms) You can add as many as you want like &parm2=value2…)

Note: The last phrase tells the report server to render as a pdf: 3aCommand=Render&rs%3AFormat=PDF You can change that last parm (Format=) to Excel from PDF to render a spreadsheet (assuming Excel is installed on your client PC)

This link can be placed in an ASP.net page or user control and redirected via the Response.Redirect command (often fired via a button click event/delegate) using string concatenation to add in any variables like a date range etc.  You could also use a Sharepoint webpart connected to some filter fields controlling any parameters sent just like a ASP.net page or user control. Another idea is that the link can be added as a static link on the Dashboard in Vision.