Error while rendering report(.rdl).

Posted by Sushavon Banerjee on Stack Overflow See other posts from Stack Overflow or by Sushavon Banerjee
Published on 2010-05-24T11:44:44Z Indexed on 2010/05/24 11:51 UTC
Read the original article Hit count: 414

Filed under:

Hi,

I have generated a .rdl report file. Now, when I am going to render the .rdl report file into pdf format,exception is throwing.

The exception is : - "An error occurred during local report processing."

The stack trace is follows : -

" at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)\r\n at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)\r\n at Microsoft.Reporting.WebForms.LocalReport.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)\r\n at SaltlakeSoft.APEX2.Controllers.TestPageController.RenderReport() in E:\Documents and Settings\Administrator\Desktop\afetbuild15thmayapex2\apex2\Controllers\TestPageController.cs:line 1626\r\n at lambda_method(ExecutionScope , ControllerBase , Object[] )\r\n at System.Web.Mvc.ActionMethodDispatcher.<>c_DisplayClass1.b_0(ControllerBase controller, Object[] parameters)\r\n at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)\r\n at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters)\r\n at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters)\r\n at System.Web.Mvc.ControllerActionInvoker.<>c_DisplayClassa.b_7()\r\n at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)"

My code is as follows : -

LocalReport report = new LocalReport();
report.ReportPath = @"E:\Report1.rdl";            
List<Employee> employeeCollection = empRepository.FindAll().ToList();            
ReportDataSource reportDataSource = new ReportDataSource("dataSource1",employeeCollection);
report.DataSources.Clear();
report.DataSources.Add(reportDataSource);
report.Refresh();
string reportType = "PDF";
string mimeType;
string encoding;
string fileNameExtension;            
string deviceInfo ="<DeviceInfo>" +"<OutputFormat>PDF</OutputFormat>" +
    "<PageWidth>8.5in</PageWidth>" + "<PageHeight>11in</PageHeight>" +
    "<MarginTop>0.5in</MarginTop>" +"<MarginLeft>1in</MarginLeft>" + 
    "<MarginRight>1in</MarginRight>" +"<MarginBottom>0.5in</MarginBottom>" +
    "</DeviceInfo>";

Warning[] warnings;
string[] streams;
byte[] renderedBytes;           
renderedBytes = report.Render(reportType,deviceInfo,out mimeType,out encoding, out fileNameExtension, out streams, out warnings);
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename=foo." + fileNameExtension);
Response.BinaryWrite(renderedBytes);
Response.End(); 

Help me please...

Thanks,

Sushavon

© Stack Overflow or respective owner

Related posts about reporting-services