简体   繁体   中英

Microsoft reporting rdlc performance issues exporting to pdf

I'm using Microsoft.Reporting.WebForms to generate pdf files but it is taking too long to create even a simple file, so far I tried to create a simple report with a parameter 'Name' and a textbox to render it, just that and it takes about 4 secs, any help on the subject would be appreciated, this is the sample code:

public byte[] GenerateReport(string name)
{
   var report = new LocalReport();
   var deviceInfo = string.Format(@"<DeviceInfo><OutputFormat>{0}</OutputFormat></DeviceInfo>", "pdf");
   report.ReportEmbeddedResource = "namespace.TestReport.rdlc"
   report.SetParameters(new ReportParameter("Name", name));
   return report.Render("pdf", deviceInfo);
}

and it takes about 4 secs to run just that, I have a slightly more complex report and it takes a little more than 6 seconds, Thanks in advance

Please try these...

reportViewer.LocalReport.ReportPath = "Report1.rdlc";
reportViewer.LocalReport.ExecuteReportInCurrentAppDomain(
      Assembly.GetExecutingAssembly().Evidence);
reportViewer.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("Contoso.Utilities, 
      Version=1.0.271.0, Culture=neutral, PublicKeyToken=89012dab8080cc90");

as provided in

http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.localreport.executereportincurrentappdomain(v=vs.100).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM