TotalPageCount exception with subreports on rendering

Stimulsoft Reports.NET discussion
Post Reply
Bart
Posts: 5
Joined: Tue Feb 03, 2009 6:34 am

TotalPageCount exception with subreports on rendering

Post 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.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

TotalPageCount exception with subreports on rendering

Post 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.
Bart
Posts: 5
Joined: Tue Feb 03, 2009 6:34 am

TotalPageCount exception with subreports on rendering

Post 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.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

TotalPageCount exception with subreports on rendering

Post by Edward »

Hi Bart,

Please let us know if any help is required.

Thank you.
Bart
Posts: 5
Joined: Tue Feb 03, 2009 6:34 am

TotalPageCount exception with subreports on rendering

Post by Bart »

Thanks for the information.

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