Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

page number on overflow pages

edited January 2002 in General
Hello,
How can I put page number (except using TppSystemVariable) on
overflow pages?
For example, I have 5 pages in my report. The last 3 pages are
generated from overflow page. They will be counted as 1, 2, 3, but not
3, 4, 5. The whole report page will be order as 1, 2 and 1, 2, 3.

regards,
Meixi

Comments

  • edited January 2002
    How can I change TppSystemVariable value? For example, system give out
    vtPageNo value: 1, 2, 3, 4, 5. How can I change it as 1, 2, 1, 2, 3?

    regards,
    Meixi

  • edited January 2002
    Use the SystemVariable's OnCreateDrawCommand event to store a handle to the
    page no, and then update it at the end of the page, if you've encountered
    your overflow pages, as shown in the example code below. Although, I'm not
    sure what you mean by overflow pages. Is this a summary subreport? You can
    reset page numbering automatically with subreports. See the #51-51 main
    reports demo and the Subreport.ResetPageNo property.

    uses
    ppDrwCmd;
    ...
    private
    FPageNo: TppDrawText;
    FCounter: Integer;
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.Button2Click(Sender: TObject);
    begin
    FPageNo := nil;
    FCounter := 0;

    ppReport1.Print;
    end;

    procedure TForm1.ppSystemVariable1DrawCommandCreate(Sender, aDrawCommand:
    TObject);
    begin
    FPageNo := TppDrawText(aDrawCommand);
    end;

    procedure TForm1.ppReport1EndPage(Sender: TObject);
    begin

    if (FPageNo.Text <> '') and (StrToInt(FPageNo.Text) >= 3) then
    begin
    Inc(FCounter);

    FPageNo.Text := IntToStr(FCounter);
    end;

    end;


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited January 2002
    Hello, Jim:
    Thanks for reply!
    I have a record with Memo Field in my subreport. when the message in the
    Memo Field more then a page, it will overflow to next page. I need put page
    number on the overflow page.

    Regards,
    Meixi

  • edited February 2002
    So if RB prints a one page memo on page 3, of a 3 page report you want the
    page numbers to be 1,2,3. If the last page memo overflows on pages 3,4,5,
    then you want the page numbering to be 1,2,1,2,3. Here is an example which
    manually calculates the page numbers, based on an overflowing memo in the
    detail band. I don't know how close this example is to what you are asking,
    but it should give some insight on a place to start.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited February 2002
    Here is the link:
    http://www.digital-metaphors.com/tips/CustomPageNumbering.zip


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited February 2002
    Hello, Jim:
    Thank you very much!
    I follow the idea last time you gave to me about "Use the SystemVariable's
    CreateDrawCommand event to store a handle to the page no, and then update it at
    the end of the page..." The problem has been solved. Since I only used idea
    "update System Variable value", I like to try the idea what you just gave to me
    too.

    regards,
    Meixi

This discussion has been closed.