Page 1 of 1

External subreports not rendered correctly in main report

Posted: Wed Jun 26, 2013 1:26 pm
by adinac
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

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;
        }
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

Re: External subreports not rendered correctly in main repo

Posted: Thu Jun 27, 2013 10:26 am
by HighAley
Hello, Adina.

Could you send us the report template with sample data which reproduces the issue?
Could you send us screen-shots of the issue with short notices?

Thank you.

Re: External subreports not rendered correctly in main repo

Posted: Thu Jun 27, 2013 12:39 pm
by adinac
Hello,

I am attaching the backup of database (SubReportsSample) and also the main and subreport.The class which is generating the pdf out of my mainreport.

I am looking forward for your response.

Thanks, Adina

Re: External subreports not rendered correctly in main repo

Posted: Fri Jun 28, 2013 1:49 pm
by HighAley
Hello.

Sorry for delay with answer.
We need some additional time to prepare it for you.

Thank you.

Re: External subreports not rendered correctly in main repo

Posted: Mon Jul 01, 2013 10:59 am
by HighAley
Hello.

We have made an improvement. Please, try our next prerelease build that will be available today.
But you shouldn't Compile sub report at the GetSubReport event. Try to use next code:

Code: Select all

void subreport_GetSubReport(object sender, StiGetSubReportEventArgs e)
{
.....
subReport.Dictionary.Synchronize();
//subReport.Compile();
//subReport.Render(false);
e.Report = subReport;
}
Thank you.

Re: External subreports not rendered correctly in main repo

Posted: Tue Jul 02, 2013 2:17 pm
by adinac
Hello,

I have tested with latest version, and it is working indeed.

Thank you very much,

Adina

Re: External subreports not rendered correctly in main repo

Posted: Wed Jul 03, 2013 6:04 am
by Andrew
Great!

Thank you for letting us know about this!