External subreports not rendered correctly in main report

Stimulsoft Reports.WEB discussion
Post Reply
adinac
Posts: 16
Joined: Mon Apr 22, 2013 11:59 am

External subreports not rendered correctly in main report

Post 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
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: External subreports not rendered correctly in main repo

Post 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.
adinac
Posts: 16
Joined: Mon Apr 22, 2013 11:59 am

Re: External subreports not rendered correctly in main repo

Post 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
Attachments
SampleReports.zip
(145.33 KiB) Downloaded 246 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: External subreports not rendered correctly in main repo

Post by HighAley »

Hello.

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

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: External subreports not rendered correctly in main repo

Post 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.
adinac
Posts: 16
Joined: Mon Apr 22, 2013 11:59 am

Re: External subreports not rendered correctly in main repo

Post by adinac »

Hello,

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

Thank you very much,

Adina
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: External subreports not rendered correctly in main repo

Post by Andrew »

Great!

Thank you for letting us know about this!
Post Reply