微软报告了导出为pdf的rdlc性能问题



我使用Microsoft.Reporting.WebForms来生成pdf文件,但创建一个简单的文件需要很长时间,到目前为止,我尝试创建一个简单的报告,参数'Name'和一个文本框来渲染它,只是它需要大约4秒,对主题的任何帮助都会受到赞赏,这是示例代码:

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);
}

运行大约需要4秒,我有一个稍微复杂一点的报告,它需要6秒多一点,提前感谢

请试试这些…

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");

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

最新更新