Hello,
I create ReportViewer with report in my code and place it in Panel. In Javascript I start the printing by calling function PrintReport(). Something like that:
ReportViewer viewer = new Telerik.ReportViewer.WebForms.ReportViewer();
InstanceReportSource source = new InstanceReportSource();
source.ReportDocument = book;
viewer.ReportSource = source;
Panel retControl = new System.Web.UI.WebControls.Panel();
retControl.Controls.Add(viewer);
But I have the problem with the device information settings for rendering in PDF format. I define them in config file and it works fine, but I need to change them for some cases dynamicaly. I find that I can put hashtable with device info into RenderReport, but it looks there are not accessible any render methods in ReportViewer. Is it possible to these property in my program?
Many thanks
5 Answers, 1 is accepted
Rendering extensions can be configured with different parameters by:
- Adding the settings in the application configuration file - settings are applied for all viewers in the application;
- Exporting programmatically with ReportProcessor instance, where settings are applied only for the currently processed report.
I hope the provided information is helpful.
Regards,
Stef
Telerik
Hi Stef,
I know about these possibilities, but configuration file is used always the same and I need different setup for different users/browsers. I need to do it programmatically, but I don't have the ReportProcessor instance in my code. I use ReportBook, InstanceReportSource and ReportViewer. I expect that I can access ReportProcessor via ReportViewer, but I cannot find it. Is it possible?
ThanksYou need to have a reference to Telerik.Reporting.dll to create an instance of the ReportProcessor. Then you can pass an InstanceReportSource that wraps the ReportBook - Exporting Report Programmatically.
The viewer must use a separate report source instance that wraps a separate ReportBook instance.
Regards,
Stef
Telerik
You said that I need to use separate report source for viewer so it looks there is no possibility how to pass parameters to ReportViewer.
I don't use method ReportProcessor.RenderReport, but I create ReportViewer in my code and later method ReporViewer.PrintReport is called in Javascript. So it looks I must change the logic in my code and replace ReportViewer by ReportProcessor. Am I right?
Thank you
That is correct. The viewer will take into account only extensions' settings from the application's configuration file. If you need to control the extensions' settings per report, you will have to export programmatically the report instead of relying on the viewer's export capabilities.
Regards,
Stef
Telerik