Copying report component

Stimulsoft Reports.WPF discussion
Post Reply
m.n
Posts: 33
Joined: Fri Jul 17, 2009 10:09 am

Copying report component

Post by m.n »

Hello,

I'd like to copy the component:

Code: Select all

StiReport report;
// [...]
StiComponent originalComponent = report.GetComponentByName("A");
StiComponent newComponent = (StiComponent)originalComponent.Clone(true);
component.Parent.Components.Add(component);
Is there a better (safer, faster...) way than above one?
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Copying report component

Post by Jan »

Hello,

Its a correct code, but you need assign to component new name if you want compile report with cloned components in future.

Thank you.
m.n
Posts: 33
Joined: Fri Jul 17, 2009 10:09 am

Copying report component

Post by m.n »

Thanks.
And once more question: in what conditions StiComponent.Clone(true) can return a null value?
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Copying report component

Post by Jan »

Hello,

This method should nor return null value in any cases.

Thank you.

Post Reply