Report.AssignAll
jose525
Deutschland
Hi,
how do I create a 100% copy of a loaded report?
My current code looks like this:
template = Report.FromFile(filename);
...
report = new Report();
report.AssignAll(template);
...
it works file - all objects will be copied, but without names.
...
rect = report.FindObject("myDataRectangle");
if (rect == null)
MessageBox.Show("rect is null");
...
Please point me.
Thank you.
how do I create a 100% copy of a loaded report?
My current code looks like this:
template = Report.FromFile(filename);
...
report = new Report();
report.AssignAll(template);
...
it works file - all objects will be copied, but without names.
...
rect = report.FindObject("myDataRectangle");
if (rect == null)
MessageBox.Show("rect is null");
...
Please point me.
Thank you.
Comments
public void CopyReport(Base source, Base target)
{
Base targetItem;
target.Assign(source);
target.Name = source.Name;
foreach (Base sourceItem in source.ChildObjects)
{
targetItem = (Base)Activator.CreateInstance(sourceItem.GetType());
targetItem.SetReport(target.Report);
CopyReport(sourceItem, targetItem);
targetItem.SetReport(null);
targetItem.Parent = target;
}
}
It works for me.
Did someone have some other ideas?
The easiest way to copy a report instance is the following:
the fastest way is: