ReportServer
Exporting a SQL Server Reporting Services Report Directly to PDF
by Bruno Rebelo on Feb.11, 2009, under C#, ReportServer
ReportViewer report = new ReportViewer(); report.ServerReport.ReportServerUrl = new Uri(@"http://localhost/reportserver"); report.ServerReport.ReportPath = "/ReportFolder/ReportName"; string mimeType, encoding, extension, deviceInfo; string[] streamids; Warning[] warnings; string format = "PDF"; //Desired format (PDF, Excel, or Image) deviceInfo = "<DeviceInfo>" + "<SimplePageHeaders>True</SimplePageHeaders>" + "</DeviceInfo>"; byte[] bytes = report.ServerReport.Render(format, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); System.IO.FileStream sw; sw = new System.IO.FileStream(@"c:\output.pdf", System.IO.FileMode.OpenOrCreate); for (int i = 0; i < bytes.Length; i++) sw.WriteByte(bytes[i]); sw.Close(); |
How to call a report (reportserver) using C#
by Bruno Rebelo on Feb.11, 2009, under C#, ReportServer
After your report been deployed, you have to add a REPORTVIEWER to your form and then :
reportURL.Text = "/REPORT1/report"; reportURL.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote; reportURL.ServerReport.ReportServerUrl = new Uri(@"http://localhost/reportserver"); reportURL.ServerReport.ReportPath = reportURL.Text; reportURL.RefreshReport(); |
voilá… there its your report
