views:

89

answers:

0

I try to export a report as excel. I am using a report viewer control in a aspx page, the report is on a SSRS 2005 server. The report is rendered ok, I can see it in the browser, I can export it but I cannot open the xls file (neither pdf file). If I open the report directly from SSRS and export from there than the file is readable.

I have this on Page_Load:

repViewer.ProcessingMode = ProcessingMode.Remote;
                ServerReport report = repViewer.ServerReport;
                report.ReportServerUrl = new System.Uri(ApplicationSettings.CurrentSettings.SqlServerReportingSettings.Url);
                report.ReportServerCredentials = new ReportServerCredentials(ApplicationSettings.CurrentSettings.SqlServerReportingSettings.UserName,
                        ApplicationSettings.CurrentSettings.SqlServerReportingSettings.Password, ApplicationSettings.CurrentSettings.SqlServerReportingSettings.Domain);
                report.ReportPath = string.Format("/{0}/{1}", ApplicationSettings.CurrentSettings.SqlServerReportingSettings.SQLReportDirectory, reportName);

Also, the size of the file exported when the report is open in browser is not the same with the size of the file when is generated directly from SSRS.

Why the file is not exported correctly?