Options

numbering report pages

leugimleugim Member Posts: 93
hi all

does somebody know how to print page numbers in navision showing the total number of pages?? i.e. Page 1 of 5, 2 of 2, ... Page 5 of 5

something like: STRSUBSTNO('Page %1 of %2',PAGENO,intTotalPages); where intTotalPages is an integer variable...

we try to do this counting lines and then divide by total number of lines per page (this number is a constant inside PreDataItem) but when changing the printer, this code is not valid 'cause total number of lines could not be the same... :shock:

some ideas??

is there any way to calculate total number of lines per page for any kind of printer dinamically?
_______________
so far, so good

Comments

  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    It should be somewhere on the forum, you can first print to a HTML file, count the pages and use that.
  • Options
    ArhontisArhontis Member Posts: 667
    Hi,

    There is a solution about the total number of pages that is recommended by MS in the partnersource I haven't tried it but it might work for any printer:
    https://mbs.microsoft.com/partnersource ... page=false

    There is also a solution by Avdhesh Yadav in the downloads:
    http://www.mibuso.com/dlinfo.asp?FileID=752
  • Options
    gulamdastagirgulamdastagir Member Posts: 411
    hello amigo,


    1.Declare PNo(Variable:integer) source of the "Y" Textbox on the Page Footer(ASSUMING U WANT TO PRINT "x OF Y" on the page footer)of a Report with ID "50099"


    2. Declare TestReport(Variable:Report,REPORT ID:50099)
    Create 2 functions on this report "50099"

    ReturnTotalpages():Integer
    {
    EXIT(CurrReport.PAGENO);

    }

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


    }

    3.Create a code Unit(#50000) and create a function in it called
    FUNCTION()

    {
    TestReport.SAVEASHTML('c:\test.html');

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

    TestReport.DefTotalPages(PageCount);
    TestReport.RUN;

    }

    4.Create a new form. Declare GD(variable:Codeunit).On the form create a button labelled "Run Report 50099(DESCRIPTION)" .
    ONPUSH() trigger of " button write this code.
    {

    GD.FUNTCION();

    }

    5.These steps are for reports which are using "Grouping and Indentation"but for simple reports u can use the "Total number of records divided by the Total records on a page" principle.

    thanks,
    gd
    Regards,

    GD
  • Options
    andy76andy76 Member Posts: 616
    I was writing on our db the code of post of gulamdastagir

    I understand something but I don't understand why I have to create a new form on step 4

    I have to use this functionality when I am printing a document from some document as invoice, order ecc...
    I would not like to open a new form.
    How can I solve it?

    Thank you

    Andy
  • Options
    gulamdastagirgulamdastagir Member Posts: 411
    hello amigo,


    4.Create a new form. Declare GD(variable:Codeunit).On the form create a button labelled "Run Report 50099(DESCRIPTION)" .
    ONPUSH() trigger of " button write this code.
    {

    GD.FUNTCION();

    }

    so in your case you dont have to create a new form just use whatver form you want to run this X of Y Report Functionality.
    Regards,

    GD
  • Options
    andy76andy76 Member Posts: 616
    If I use:

    TestReport.SAVEASHTML( 'C:\test.html');

    with TestReport that is a variable of my report I cannot pass the record as parameter, for example SalesInvoice Header to print 1 invoice

    I need to use:

    Report.SAVEASHTML(Number, FileName [,SystemPrinter] [, Rec])

    with Rec that is my record of SalesInvoice Header filtered but after this I cannot call the function

    TotalPageNumber:= TestReport.ReturnTotalPages();

    Do you understand my problem?
    How can I solve it?

    Thank you
  • Options
    gulamdastagirgulamdastagir Member Posts: 411
    Ok you have to modify your FUNCTION() to FUNCTION(Rec)

    FUNCTION(REC)
    {

    TestReport.SAVEASHTML( 'C:\test.html',REC);

    .......

    }
    Regards,

    GD
  • Options
    andy76andy76 Member Posts: 616
    It is not possible to pass the second parameter REC, only the file name if I use a report variable.
  • Options
    gulamdastagirgulamdastagir Member Posts: 411
    andy76 wrote:
    If I use:

    TestReport.SAVEASHTML( 'C:\test.html');

    with TestReport that is a variable of my report I cannot pass the record as parameter, for example SalesInvoice Header to print 1 invoice

    I need to use:

    Report.SAVEASHTML(Number, FileName [,SystemPrinter] [, Rec])

    with Rec that is my record of SalesInvoice Header filtered but after this I cannot call the function

    TotalPageNumber:= TestReport.ReturnTotalPages();

    Do you understand my problem?
    How can I solve it?

    Thank you

    CLEAR(Report)
    Record.SETRECFILTER()
    Report.XXX; // any user-defined function
    Report.SETTABLEVIEW(Rec)
    Report.SAVEASHTML('C:\test.html');//not tested
    Regards,

    GD
  • Options
    Prajeesh_NairPrajeesh_Nair Member Posts: 70
    hiii all
    I need some help with my report which i created i want to display the no of pages in this formate Page No:1(100) i have written the code for this to print in the footer and i used this same code to in sert page no in the header also and i was successful from the second page only can any one when i used this in the header give some advice
    The problem i face is that in my body part, i have written some code which finds the No of records which is entered in to the report. If the body size increases then the total page no also increases and, since this code is in the body the total page is calculated after executing the body so cant get total pages in the header for the first page
    i am entering my code below
    codeunit :

    IF PageNo = 1 THEN
    BEGIN
    BodyCnt1:=Bodycnt;
    Pagecnt := RecCount DIV (BodyCnt1-1);
    Pagecnt+=1;
    Pagecnt1:= Pagecnt;
    BodyCnt1:=0;
    END
    ELSE
    Pagecnt := Pagecnt1;

    IF Pagecnt < RecCount DIV(Bodycnt-1) THEN
    Pagecnt:=PageNo;

    header part


    IF cnt=0 THEN
    BEGIN
    pagecnt:=Cod50100.PageCunter(COUNT,cnt,CurrReport.PAGENO);
    Txt001:='Page No. ' + FORMAT(CurrReport.PAGENO) + ' of ' + FORMAT(pagecnt-1);
    END;

    body


    IF CurrReport.PAGENO=1 THEN
    cnt+=1;

    footer


    pagecnt:=Cod50100.PageCunter(COUNT,cnt,CurrReport.PAGENO);
    Txt001:='Page No. ' + FORMAT(CurrReport.PAGENO) + ' of ' + FORMAT(pagecnt-1);



    thanx in advance
    can anyone help me ?
Sign In or Register to comment.