#wpf #telerik #telerik-reporting #.net-framework-4.8 #.net-4.8
Вопрос:
Я использую WPF (.net 4.8) и Telerik.Reporting. Я продолжаю получать это исключение: There is no report or the report is not previewed in the viewer. Assign a report and call the RefreshReport() method prior exporting.
Но, насколько я знаю, я назначаю и обновляю.
private void ShowPrintPreview(ReportBook reportBook)
{
//http://docs.telerik.com/reporting/programmatic-exporting-report
Telerik.Reporting.Processing.ReportProcessor reportProcessor =
new Telerik.Reporting.Processing.ReportProcessor();
// set any deviceInfo settings if necessary
System.Collections.Hashtable deviceInfo =
new System.Collections.Hashtable();
//wrap the document in a report source
//http://docs.telerik.com/reporting/report-sources
var IRS = new Telerik.Reporting.InstanceReportSource();
IRS.ReportDocument = reportBook;
Telerik.Reporting.Processing.RenderingResult result =
reportProcessor.RenderReport("PDF", IRS, deviceInfo);
ReportViewer rp = new();
rp.ViewMode = ViewMode.PrintPreview;
rp.ReportSource = IRS;
rp.RefreshReport();
//rp.PrintReport(); // print dialog
rp.ExportReport("PDF", deviceInfo);
}