Hi,
I have created one Standalone report with an Object Person (Which contains properties Name, Number and DOB).
Then, I'm using below code to generate PDF from this report.
var reportProcessor = new ReportProcessor();
var deviceInfo = new System.Collections.Hashtable();
var reportSource1 = new UriReportSource();
reportSource1.Uri = "/report.trdp";
var reportSource = new InstanceReportSource();
var report = new Telerik.Reporting.Report();
var objectDataSource1 = new Telerik.Reporting.ObjectDataSource();
objectDataSource1.DataSource = new Person() { DOB = DateTime.Now, Number = 1293737, Name = "test" };
objectDataSource1.Name = "PersonDataSet";
report.DataSource = objectDataSource1;
reportSource.ReportDocument = report;
reportSource.ReportDocument.ReportSources.Append(reportSource1);
RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, 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);
}
}
But, It generates only empty report.
Can anyone help me to resolve this?
Thanks,
Aravindh