Page 1 of 1

Merging pages

Posted: Mon Apr 20, 2009 1:27 am
by zreptil
Hi there,

i try to merge the pages of one report with the pages of another report. the elements of the pages from the second report should be placed on the pages of the first report.

up to now i use a loop that cycles through the pages of the second report and within this loop i cycle through the components of the page and add them to the same page in the first report.
8

Code: Select all

      
int idx = 0;

foreach (StiPage page in rep2.Pages)
{
  if (rep1.Pages.Count < idx)
    _rep1.Pages.Add(new StiPage());

  foreach (StiComponent item in page.Components)
  {
     item.Name += string.Format("_{0}_{1}", idx, rep1.Pages[idx].Components.Count);
     rep1.Pages[idx].Components.Insert(0, item);
  }
  idx++;
}
But this has some disadvantages since i have also to merge the used assemblies and the datasources. is there a simplier way to accomplish this task?

thanks in advance

andi

Merging pages

Posted: Wed Apr 22, 2009 12:10 am
by Jan
Hello Andi,

Please add also following line of code in your cycle:

Code: Select all

item.Page = rep1.Pages[idx];
But this has some disadvantages since i have also to merge the used assemblies and the datasources. is there a simplier way to accomplish this task?
You can get list of referenced assemblies at report.ReferencedAssemblies property. Data sources available at report.Dictionary.DataSources.

Thank you.