How can i load report from file and change data source?
For example:
I have "report1.trdp", saved in "c:\reports".
MyRptService needs to open it, pass data as object collection (matching field names in report) and output to pdf.
In below example I can open report and output to pdf but I dont see any way to set different datasource
Telerik.Reporting.Processing.ReportProcessor reportProcessor =
new Telerik.Reporting.Processing.ReportProcessor();
// set any deviceInfo settings if necessary
System.Collections.Hashtable deviceInfo =
new System.Collections.Hashtable();
var uriReportSource = new Telerik.Reporting.UriReportSource();
// Specifying an URL or a file path
uriReportSource.Uri = @"C:\data\reports\Report1.trdp";
Telerik.Reporting.Processing.RenderingResult result =
reportProcessor.RenderReport("PDF", uriReportSource, deviceInfo);
string fileName = result.DocumentName + "." + result.Extension;
string path = System.IO.Path.GetTempPath();
string filePath = System.IO.Path.Combine(path, fileName);
using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create))
{
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
}