PageNumber and PageCount when combining two reports

Posted by: yaroslav_zakharchuk on 23 January 2020, 6:03 am EST

    • Post Options:
    • Link

    Posted 23 January 2020, 6:03 am EST

    Hello. I need mixed-orientation pages in my section report and I used this workaround: https://www.grapecity.com/blogs/how-to-create-pages-of-mixed-orientation-in-activereports. So essentially I’m appending pages of one report to another.

    Here is the problem. I need to use the numbering of pages, and also print total pages count. I’ve been using such expression: Page {PageNumber} of {PageCount}. It works great when the report is not combined from two reports, but otherwise, it prints incorrect numbers (assuming 1 + 2 pages, it prints 1/1, 1/2, 2/2).

    I can count and number them manually, but it requires run of the both reports just to get the total page count (I assume i can’t get this number until the report is fully processed by .Run()). This is not the brightest idea I think, and I wonder if there are any other possibilities to solve such a problem. We are using AR v10.

    Do you have any thoughts?

    Thanks!

  • Posted 23 January 2020, 8:33 pm EST

    Hello,

    As you see RunReports() method in the sample attached in the following blog:

    https://www.grapecity.com/blogs/how-to-create-pages-of-mixed-orientation-in-activereports

    public void RunReports()
            {
                p_rpt = new SectionReport1();
                l_rpt = new SectionReport2();
                p_rpt.Run();
                l_rpt.Run();
    
                count1 = p_rpt.Document.Pages.Count;
                count2 = l_rpt.Document.Pages.Count;
            }
    

    You have to run the report before merging them. Count1 and Count2 are total page count number of both report.

    So, you can add the page number manually in the report using the “DrawText” method:

    http://helpcentral.componentone.com/nethelp/AR7Help/OnlineEn/GrapeCity.ActiveReports.Document.v7~GrapeCity.ActiveReports.Document.Section.Page~DrawText.html

    Hope it clarifies.

    Thanks,

    Mohit

Need extra support?

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

Learn More

Forum Channels