Hello good day,
Help me with this I know it's something simple but I can't find it.
how to print automatically without showing the report viewer a telerik report made in vb.net
the report has a parameter and I would like it to be printed automatically
1 Answer, 1 is accepted
0
Justin
Telerik team
answered on 30 Sep 2022, 05:17 PM
Hi Hector,
In order to print a report with parameters, without showing the report in the report viewer, you can use the Report Processor.
For your convenience, I have combined the approaches together into the following example.
// STEP ONE// Create ReportProcessor var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
// STEP TWO//Depending on the report definition choose ONE of the following REPORT SOURCES// Option 1 CLR (CSharp) report definitions***var reportSource = new Telerik.Reporting.TypeReportSource();
reportSource.TypeName = reportName; // reportName is the Assembly Qualified Name of the report// Option 2- If you have a TRDP report, use this//var reportSource = new Telerik.Reporting.UriReportSource();//reportSource.Uri = "MyReport.trdp";// Option 3, if you have an instance report, use this//var reportSource = new Telerik.Reporting.InstanceReportSource();//reportSource.ReportDocument = new Report1();// STEP THREE //Set any parameters
reportSource.Parameters.Add("SalesYear", 2007);
reportSource.Parameters.Add("SalesPerson", "John Doe");
// STEP FOUR//Print the report. See docs https://docs.telerik.com/reporting/knowledge-base/print-a-report-programmatically
reportProcessor.PrintReport(reportSource, new PrinterSettings());
Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you
up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.