Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Page Numbering in a Section
posted

Hi

I have a section within a report that needs to have page numbering on it for that section only.  I dont know how many pages the section is until it is published.

I have tried the PageNumbering but the template only has 3 arguments ([Page #], [TotalPages] and [LastPageinSection] none of which help me.

To give you an example I have an " official report" within my "Report".  my Report consists of some cover pages, the "official report" and some addendums.  This could total 6 pages in my "Report" but the "official report" may only have 3 pages.  By State Law I have to have page numbers on the "official report" in the form "Report Page x of y" where x is the page number in the "official report" and y is the total pages in the official report.

So a page in my report could be page 4 of 6 but on the "official report" it has to say "Report Page 1 of 3".

As I had the "official report" as its own section (using a band within it) I thought I could find out the page number I am on in the section and the total pages in this section.  Is there a way to do this?

  • 535
    posted

    Hi abc123it:

    I found setting the PageNumbering.Continue boolean to false after each use a page numbering object would reset the templates [Page #] and [TotalPages]. So my report within a report (the inner report section) can have it's own page number and total page. This works because I only need page numbering uniquely within each report section.

                PageNumbering pn = secMain.PageNumbering;

                pn.SkipFirst = true;

                //pn.Style = rpt.styleFont8Bold;

                pn.OffsetY = inch.ToPoints(0.25M);

                pn.OffsetX = inch.ToPoints(0.10M);

                pn.Template = "[Page #] of [TotalPages]"; //"[Page #] of [TotalPages]";   ...  "[Page #] of [LastPageInSection]"

                pn.Continue = false;//false = resets ... [Page #] to 1 after this section ends ... [TotalPages] so total only includes count of pages after this section ends ... 

    Good luck, Stan.

     

     

  • 37774
    posted

    You could take a look at this thread, where Tom details one approach which is to generate the report so that you know how many pages there are, then you can update the report as necessary.  I can't really think of a different way to approach this problem at the moment since there isn't really any way to tell what the current page will be at the time that you're updating the section.

    -Matt