I am trying to use this method but I am confused about what/how to pass the parameter to it.
void SaveReport(Telerik.Reporting.Report report, string fileName)
{
ReportProcessor reportProcessor = new ReportProcessor();
Telerik.Reporting.InstanceReportSource instanceReportSource =
new Telerik.Reporting.InstanceReportSource();
instanceReportSource.ReportDocument = report;
RenderingResult result =
reportProcessor.RenderReport("PDF", instanceReportSource, null);
using (FileStream fs = new FileStream(fileName, FileMode.Create))
{
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
}
}
I have tried to pass the name of the report I need to export, which is in a library in this way:
2nd Modification
protected void Button1_Click(object sender, EventArgs e)
{
string fileName = "SS";
var report = BOMreports.Report321();
SaveReport(report, fileName );
}
But I keep getting the error "cannot access method on a namespace" on the var report. I do I solve this?
SaveReportare in the wrong order? In method signature it'sreport, fileNamebut when invoked you're passingfileName, report.var report = BOMReports.Report321(); SaveReport(filename, report);on two lines. See which line gets the error.BOMreportscode.