I want to render big non-graphical reports (thousands of pages) in the code level, omitting the ReportViewer
control that just jams the browser, from the .rdlc files. When I test to render a report that is somewhat 2000 pages, the Microsoft.Reporting.WebForms.LocalReport.Render
method takes approximately half an hour to finish, that is considered as bad user experience.
Are there any tricks or alternative solutions to improve the performance of the rendering: in code, re-designing the .rdlc file, or somewhere else, eg, just increasing hardware?
Example code:
LocalReport localReport = new LocalReport();
localReport.ReportPath = Server.MapPath("~/report.rdlc");
SetDataSources(ref localReport);
string reportType = "PDF";
string mimeType;
string encoding;
string fileNameExtension;
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>PDF</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0in</MarginTop>" +
" <MarginLeft>0in</MarginLeft>" +
" <MarginRight>0in</MarginRight>" +
" <MarginBottom>0in</MarginBottom>" +
"</DeviceInfo>";
}
Warning[] warnings;
string[] streams;
byte[] renderedBytes;
//Render the report
renderedBytes = localReport.Render(
reportType,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
Any help is much appreciated, thanks in advance!
Placing <trust legacyCasModel="true" level="Full"/>
inside <system.web>
tag in web.config
did it for me. More details here
返回数据表作为数据源的运行速度比对象列表快得多
Generating large PDF files requires memory but there is a trick to optimize the memory usage if you need to:
This technique is also useful as you control the progress of report generation.
Remove all the expressions in SSRS report. Any conditional formatting , coloring and alternating rows , this should reduce your download time drastically.
There is no way to improve the RDLC performance at acceptable speed level after my 5 months investigation. RDLC is created for SIMPLE report such as receipt and invoice. Using html is the best option for acceptable loading and rendering speed if the number of report pages is greater than 100 with no any internal expressions, or greater than 50 pages with dynamic internal expressions.
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.