I have report which should contain several subreports for which some variables need to be provided. This big report should be exported to pdf.
First, I have added the subreports in the main report and everything looked beautifully, but because of requirements, I need to have the subreports in separate reports than the main report. So, I have set the "Use External Report" to true and "Sub report Page" to "Not Assigned."
I have added the following lines for the main report
Code: Select all
....
subreport.GetSubReport += new StiGetSubReportEventHandler(subreport_GetSubReport);
subreport.Compile();
subreport.Render(true);
StiExportFormat exportFormat = StiExportFormat.Pdf;
subreport.ExportDocument(exportFormat, pdfFileAbsPath);
.....
void subreport_GetSubReport(object sender, StiGetSubReportEventArgs e) {
StiReport subReport = new StiReport();
if (e.SubReportName == "SubReport1") {
subReport.LoadFromUrl(@"d:\Work\SubReport.mrt");
}
else if (e.SubReportName == "SubReport12") {
subReport.LoadFromUrl(@"d:\Work\SubReport2.mrt");
}
subReport.Dictionary.Variables["reportDate"] = new StiVariable("reportDate", this.reportDate);
e.Report = subReport;
}
I guess some properties should be set, but I have not found the right combination. If you could provide some help, it would be very good.
Thanks,
Adina