Editing page numbers after appending multiple reports into a single pfd

Posted by: dejan.obrez on 9 February 2018, 9:57 am EST

    • Post Options:
    • Link

    Posted 9 February 2018, 9:57 am EST

    So i found this 8 years old thread that solved the exact problem that i had (https://www.grapecity.com/en/forums/winforms-edition/appending-multiple-reports )

    but now another issue arised. For every report that i append into my list of object when i export it they all have their own page numbers instead of getting them from list of objects where i appended pages and edited their page numbers.

     foreach (C1Page pg in rep1.c1Report.C1Document.Pages)
                {
                  pg.PageNo = nPageNumber;
                  pg.PageCount = nPageNumber;
                  nPageNumber++;
                  merged.Add(pg.AsMetafile());
                }
    foreach (C1Page pg in rep2.c1Report.C1Document.Pages)
                {
                  pg.PageNo = nPageNumber;
                  pg.PageCount = nPageNumber;
                  nPageNumber++;
                  merged.Add(pg.AsMetafile());
                }
    
    

    This is how i tackeled this issue but it dosent work as i expected. id be grateful for any suggestions

  • Posted 12 February 2018, 7:17 am EST

    Hi,

    This cannot be achieved directly in C1PrintDocument.

    However, you can use the below steps to achieve the same:

    1. Set the Visible property of the footer’s field to False in the C1Report before rendering.
      this.c1Report1.Fields["ftrRight"].Visible = false;
           this.c1Report2.Fields["ftrRight"].Visible = false;
      
    
    2) Add PageFooter in C1PrintDocument and set all properties based on your requirement as:
    

    //Set footer for page count

    RenderArea rt = new RenderArea(c1PrintDocument1);

    rt.Width = new Unit(“100%parent”);

    rt.Height = new Unit(50, UnitTypeEnum.Document);

    RenderText mytext1 = new RenderText(“Page [PageNo] of [PageCount]”);

    mytext1.Style.TextAlignHorz = AlignHorzEnum.Right;

    mytext1.Style.Padding.Right = .3;

    mytext1.Style.Padding.Bottom = 1;

    rt.Children.Add(mytext1);

    c1PrintDocument1.PageLayout.PageFooter = rt;

    c1PrintDocument1.PageLayout.PageFooter.ZOrder = 200;

    
    3) Now, add the image in C1PrintDocument using your way
    4) Finally, Save it as pdf.
    
    Also find a sample application attached for complete implementation.
    
    Thanks,
    Singh
                
    [zip filename="C1Report_Merging_PageCount.zip"]public\uploads\2efec8fbe0220c965ce4c9d636167b8c1518434142876.zip[/zip]
  • Posted 16 February 2018, 5:06 am EST

    great that was exactly what i need

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels