Page 1 of 1

TotalPageCount exception with subreports on rendering

Posted: Tue Feb 03, 2009 6:49 am
by Bart
Hi all,

I want to merge several reports in one report:
MyReport = new StiReport();
MyReport.ReportName = "ReportName";
MyReport.ReportAlias = "ReportAlias";
Then I add several subreports to this report through the following method:
private static void AddSubReport(tdsReportData data, Stimulsoft.Report.StiReport mainReport, Stimulsoft.Report.StiReport subReport)
{
subReport.Dictionary.Databases.Clear();
subReport.RegData("tdsData", data);
mainReport.SubReports.Add(subReport, false, false);
}
This works fine, but when I execute Report.Render, I get the following exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Stimulsoft.Report.StiReport.get_TotalPageCount()
at Stimulsoft.Report.Engine.StiPostProcessProviderV2.PostProcessPages(StiPagesCollection pages)
at Stimulsoft.Report.Engine.StiReportV2Builder.RenderSubReports(StiReport ownerReport, StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(Boolean showProgress, Int32 fromPage, Int32 toPage)
at Stimulsoft.Report.StiReport.Render(Boolean showProgress)
at Stimulsoft.Report.StiReport.Render()
What can be the cause of this problem. Am I forgetting to execute some method?

We create our StimulReports nowadays in one report, not multiple subreports. This concerns a legacy report of which I need to make a new build now, it seems the problem occurs only since version 2008.2.

Hope someone can help me out. Thanks.

TotalPageCount exception with subreports on rendering

Posted: Tue Feb 03, 2009 8:52 am
by Edward
Hi Bart,

please check that all reports use the same engine versio. It can be forced with the following code:

Code: Select all

report.EngineVersion = Stimulsoft.Report.Engine.StiEngineVersion.EngineV1;
Thank you.

TotalPageCount exception with subreports on rendering

Posted: Wed Feb 04, 2009 4:56 am
by Bart
Hi ,

We forced the EngineVersion to V1 as suggested with success. Forcing it to V2 didn't work.

After upgrading to the latest build 2009.1.335 the forcing isn't necessary anymore.

Thanks for the advice.

TotalPageCount exception with subreports on rendering

Posted: Wed Feb 04, 2009 9:29 am
by Edward
Hi Bart,

Please let us know if any help is required.

Thank you.

TotalPageCount exception with subreports on rendering

Posted: Fri Feb 06, 2009 2:54 am
by Bart
Thanks for the information.

Since the installation of the latest build the mentioned problem is solved.