Can I have total number of pages printed on report?

gumwitkagumwitka Member Posts: 34
Hello,

Is it possible to have on report the total number of pages printed, so on page 1 you get 1/3, on 2 get 2/3 and the last one 3/3; so it’s easy to check if you have all pages. :-k

Comments

  • gumwitkagumwitka Member Posts: 34
    Thank you.
    Can you tell me where I should place this code :?:

    CLEAR(TestReport);
    TestReport.SAVEASHTML('u:\test.html');

    PageCount := TestReport.ReturnTotalPages;
    CLEAR(TestReport);

    TestReport.DefTotalPages(PageCount);
    TestReport.RUN;


    I placed it Report - OnPreReport() (in report for which I want to have pages calculated) but when I run report gets into loop.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Yes, you should add some variable to the report that indicates that it's runnung purpose is for pagecounts.

    You can activate this variable with a function e.g.

    SetPageCount
    PageCount := TRUE;

    And in your code:

    IF PageCount THEN BEGIN

    blablabla

    END:

    Goodluck.
  • gumwitkagumwitka Member Posts: 34
    I have:

    Report - OnPreReport()

    IF PageCounts THEN BEGIN
    CLEAR(TestReport);
    TestReport.SAVEASHTML('u:\test.html');

    PageCount := TestReport.ReturnTotalPages;
    CLEAR(TestReport);

    TestReport.DefTotalPages(PageCount);
    TestReport.RUN;
    END;


    I have also declared 3 functions:

    ReturnTotalPages() : Integer
    {
    EXIT(CurrReport.PAGENO);
    }

    DefTotalPages(PageNo : Integer)
    {
    PNO:=PageNo;
    }

    SetPageCount()
    {
    PageCounts := TRUE;
    }


    However it is still not clear for me where I should call last function SetPageCount() from and where set PageCounts to FALSE. I keep receiving loop :(
  • lubostlubost Member Posts: 628
    PageCounts would be filled with false in OnInitReport. Function SetPageCount() would be called from code which invokes report.
Sign In or Register to comment.