Hi,
I want to use the Reportingservices to create a PDF out of my web
application. I don't want to show it in the Report viewer. It should be just
downloadable.
The Report should be created localy without using the webservice of the
reporting services.
i've seen lots of samples and tried do get the thing to work but it
doesn't...
(in the Report Designer everything looks good and works fine)
here ist my last try of getting the report to work:
sing System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using Microsoft.Reporting.WebForms;
using System.Diagnostics;
using System.Data;
namespace Intranet.Reports
{
public class ssrsReports
{
public void test(HttpResponse MyResponse)
{
Microsoft.Reporting.WebForms.LocalReport lr = new
Microsoft.Reporting.WebForms.LocalReport();
DataSet mydataset = new DataSet();
//repView.LocalReport.ReportPath = "C:\\ssrs_test\\Test\\Test";
lr.ReportPath = @":\mk_work\Experimental\ssrs_test\Test\Test\report2.rdl";
//lr.DataSources.Add(new ReportDataSource("DataSource1", mydataset));
//repView.LocalReport.ReportEmbeddedResource =
"C:\\ssrs_test\\Test\\Test\\report2.rdlc";
//ReportDataSource reportDataSource = new ReportDataSource(dataSetName + "_"
+ dataTableName, dsReport.Tables[0]);
//repView.LocalReport.DataSources.Add(reportDataSource);
//Show();
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension = "";
try
{
byte[] bytes = lr.Render("PDF", null, out mimeType, out encoding, out
extension, out streamids, out warnings);
MyResponse.Clear();
MyResponse.ContentType = "application/pdf";
MyResponse.AddHeader("Content-disposition", "filename=output.pdf");
MyResponse.OutputStream.Write(bytes, 0, bytes.Length);
MyResponse.OutputStream.Flush();
MyResponse.OutputStream.Close();
MyResponse.Flush();
MyResponse.Close();
}
catch (Exception e)
{
Exception inner = e.InnerException;
while (inner != null)
{
Debug.Print(inner.Message);
inner = inner.InnerException;
}
}
}
}
}
any ideas?
Regards,
Michael
Norman Yuan - 08 Jul 2008 18:18 GMT
Since you use "LocalReport", so, it has nothing to do with SSRS. Your
problem is that your code try to open a "*.rdl" as local report. *.rdl
report is designed for Reporting Services, not local report. You need to
design a local report, not using SSRS report designed, but using VS2005/8's
built-in report designer. That is, in the project, select "Add new Item..."
and tehn select Report, which is in *.rdlc format.
> Hi,
>
[quoted text clipped - 122 lines]
>
> Michael
Michael Kugler - 10 Jul 2008 07:28 GMT
Hi Norman,
that was exactly my fault... now it is running
Thanks.
Michael