Page 1 of 1

error when trying to add components to Report !

Posted: Mon Sep 05, 2011 2:06 am
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.




error when trying to add components to Report !

Posted: Mon Sep 05, 2011 7:59 am
by HighAley
Hello.

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

Thank you.

error when trying to add components to Report !

Posted: Mon Sep 05, 2011 8:17 am
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.

error when trying to add components to Report !

Posted: Sun Sep 11, 2011 3:35 am
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.

error when trying to add components to Report !

Posted: Wed Sep 14, 2011 9:06 am
by Alex K.
Hello,

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

Thank you.

error when trying to add components to Report !

Posted: Mon Sep 19, 2011 2:56 am
by Dejoni
hi Aleksey ,


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


Thank you.

error when trying to add components to Report !

Posted: Mon Sep 19, 2011 11:33 am
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.

error when trying to add components to Report !

Posted: Tue Sep 20, 2011 4:38 am
by Dejoni
We have been so glad that we purchased your software...
keep up the good work :biggrin:

Thank you.

error when trying to add components to Report !

Posted: Tue Sep 20, 2011 9:04 am
by Andrew
Hello,

Thank you very much for choosing our product.

We shall!

Have a great day.
Thank you.