error when trying to add components to Report !

Stimulsoft Reports.NET discussion
Post Reply
Dejoni
Posts: 6
Joined: Thu Aug 04, 2011 12:55 am

error when trying to add components to Report !

Post by Dejoni »

hello,

im trying to add components from report file (rep1.mrt ) to another blank report (report2.mrt) :

StiReport report1=new StiReport();
StiReport report2=new StiReport();
report1.load("rep1.mrt"); //this report just contains (PageHeaderBand + a text Component inside it) and (PageFooterBand + a text Component inside it)

StiComponentsCollection collection=report1.Pages[0].Components;

report2.Pages[0].Components.AddRange(collection);

report2.Show(); //

the problem is that the report Does not appear !!

also when i try to run designer >> report2.Design() , and then go to preview tab i got these 2 errors

1.Error! The error of compilation
The error of compilation is found in the 'Report' report:
Object reference not set to an instance of an object.


2.Error! The error of compilation
The error of compilation is found in the 'Report' report:
Object reference not set to an instance of an object.


how can i solve this ?

Thank You.



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

error when trying to add components to Report !

Post by HighAley »

Hello.

Please, send us a sample report with data to reproduce the issue.

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

error when trying to add components to Report !

Post by HighAley »

Hello.
Dejoni wrote:im trying to add components from report file (rep1.mrt ) to another blank report (report2.mrt) :

Code: Select all

StiReport report1=new StiReport();
StiReport report2=new StiReport();
report1.load("rep1.mrt");  //this report just contains (PageHeaderBand + a text Component inside it) and (PageFooterBand + a text Component inside it)

StiComponentsCollection collection=report1.Pages[0].Components;

report2.Pages[0].Components.AddRange(collection);

report2.Show();   //
the problem is that the report Does not appear !!

also when i try to run designer >> report2.Design() , and then go to preview tab i got these 2 errors

1.Error! The error of compilation
The error of compilation is found in the 'Report' report:
Object reference not set to an instance of an object.


2.Error! The error of compilation
The error of compilation is found in the 'Report' report:
Object reference not set to an instance of an object.


how can i solve this ?
You copy only components, but no Data Source.
If you want to copy all report you can simply copy the report:

Code: Select all

report2 = report1;
Thank you.
Dejoni
Posts: 6
Joined: Thu Aug 04, 2011 12:55 am

error when trying to add components to Report !

Post by Dejoni »

hi Aleksey ,thank you for your answer,

actually i don't use any data Sources in the report , also i don't need to copy all the components in the report i just need to copy some Components (header and footer).


Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

error when trying to add components to Report !

Post by Alex K. »

Hello,

Sorry for the delay with response. We need some additional time to prepare the sample for you.

Thank you.
Dejoni
Posts: 6
Joined: Thu Aug 04, 2011 12:55 am

error when trying to add components to Report !

Post by Dejoni »

hi Aleksey ,


are there any samples ?, please guide me on how to solve this problem ....


Thank you.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

error when trying to add components to Report !

Post by Ivan »

Hello,

You can use the following code, for example:

Code: Select all

            StiReport report1 = new StiReport();
            StiReport report2 = new StiReport();
            report1.Load(@"d:\test1.mrt");

            StiPage newPage = report2.Pages[0];
            newPage.Components.AddRange(report1.Pages[0].Components);
            foreach (StiComponent comp in newPage.GetComponents())
            {
                comp.Page = newPage;
            }

            report2.Show();
Thank you.
Dejoni
Posts: 6
Joined: Thu Aug 04, 2011 12:55 am

error when trying to add components to Report !

Post by Dejoni »

We have been so glad that we purchased your software...
keep up the good work :biggrin:

Thank you.
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

error when trying to add components to Report !

Post by Andrew »

Hello,

Thank you very much for choosing our product.

We shall!

Have a great day.
Thank you.
Post Reply