| void SaveReport(Telerik.Reporting.Report report, string fileName) |
| { |
| ReportProcessor reportProcessor = new ReportProcessor(); |
| RenderingResult result = reportProcessor.RenderReport("PDF", report, null); |
| using (FileStream fs = new FileStream(fileName, FileMode.Create)) |
| { |
| fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); |
| } |
| } |
SubReport
oSubRep = new SubReport();
Report oEntriesRep = ExpenseEntriesReportBuilder.GetReport(); // Create the sub report (see extract below)
oSubRep.Width =
new Unit(735, UnitType.Pixel);
oEntriesRep.DataSource = dsData.Tables[1];
oSubRep.ReportSource = oEntriesRep;
oSubRep.Parameters.Add(
"parExpenseFormId","Fields.[expense_form_id]");
oDetails.Items.Add(oSubRep); // Add the subreport to the details section of the report
2. This is how I generate the actual sub Report
ExpenseEntriesReportBuilder. GetReport()
{
Report oRep = new Report();
oRep.PageSettings = GetPageSettings();
oRep.Items.Add(GetHeaderSection());
oRep.Items.Add(GetDetailSection());
oRep.Items.Add(GetFooterSection());
oRep.Filters.Add(
new Filter("=Fields.[expense_form_id]", FilterOperator.Equal, "=Parameters.parExpenseFormId"));
return oRep;
}
Thanks in advance