External subreports not rendered correctly in main report
Posted: Wed Jun 26, 2013 1:26 pm
Hello,
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
All the subreports have only one table which can be spread on several pages. In the subreports, the header of the table is displayed always on the top page. The problem is that the header in the main report is displayed exactly as in the subreports which is not ok if I have some text or any other component before the subreport as the header will be than displayed in the middle of the page.
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
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