Problem adding pages.

Stimulsoft Reports.NET discussion
Post Reply
alwessels
Posts: 4
Joined: Mon Nov 24, 2008 8:26 am
Location: South Africa

Problem adding pages.

Post by alwessels »

I am creatin a report in C#. It loads a report from a file, but then I need to add a certain amount of pages depending on some variable.
It is working great for 1 page but as soon as I need to add 2 or more I get a Object reference not set to an instance of an object. error.
The error occur on the report.Render() call..
If I debug the code. All the pages are added to the report and set to values...

Here is a shortened version of the code adding the pages...

StiReport report = new StiReport();
report.Load(@"c:\" + reportName + ".mrt");
StiPage page;
StiText text;
StiPage[] pages = new StiPage[extra.Count];
int count = 0;
foreach (string temp in extra)
{
page = new StiPage(report);
page.Load(@"c:\pageTemplatee.pg");
page.Name = "p" + count.ToString();

text = (StiText)page.Components["freeText"];
text.Name += count.ToString();
page.Page = page;
page.Report = report;

pages[count] = page;
count++;
}

report.Pages.AddRange(pages);

report.RegData(ds);

report.Render();
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Problem adding pages.

Post by Edward »

Hi, Alwessels.

Please send the test project which produces this error to support[at]stimulsoft.com for analysis.

Thank you.
Post Reply