Hi, Is there anyway I can display “total page in a report”? I would like the statement “Page # of #” to be displayed on every page. If possible, the total is for a group instead of the whole report. For example, to print 3 invoices at once, the total page figure should be for the pages of one invoice and re-counted on new invoice. I couldn’t find any property for this, nor could I find a workaround for it; using variable counting doesn’t seem to be possible. If anyone has a solution to this, please advise. Thanks a lot.
Hello, This is a frequently asked question. Firstly, there is no standard way to do this in Navision - Navision cannot print a “Page 1 of 10” at the start of a report becuase it does not know there are 10 page until the print run is complete. If you search the forum, you will find a number of answers to this, but they are awkward, as they all involve running the report once in the background to find out how many pages need to be printed & a second time to actually print it out.
Hi there, Thanx very much for your help and link reference. It helps. However, the code given my microsoft support as referred by the above given link was a little tedious to implement because we’d need to add codes on 2 places; one in the report itself and another ‘external’ one such as in menu items or buttons OnPush trigger. If the report’s initiated from more than one triggers (eg. >1 buttons/forms), then there’d even be more places to code. I tried to work it out and come out with the following code which could be implemented on only one place, centralized in the report itself. Report - OnInitReport() // SavingTemp (boolean) - indicator of whether report is being saved. // SetSavingTemp (function) - to set the value of SavingTemp. // GetPage (function) - simply return CurrReport.PAGENO. // TotalPage (Integer) - to accept final counting of GetPage. IF NOT SavingTemp THEN BEGIN TempReport.SetSavingTemp(TRUE); TempReport.SAVEASHTML(‘c:\tempreport’); TotalPage := TempReport.GetPage; IF NOT FILE.ERASE(‘c:\tempreport’) THEN MESSAGE(‘I/O error while deleting temporary file.’); // Anything else to be placed in this section IF NOT CompanyInfo.GET THEN CompanyInfo.INIT; CompanyInfo.CALCFIELDS(Picture); END; SavingTemp is set to prevent unterminated creation of TempReport object which could cause buffer overflow and terminate navision. Another problem I encountered is that if there are 10 pages all with company image attached, when SAVEASHTML is run, 10 bmp files are generated. That’s why, I only get the company picture after the saving is complete. This code’s not thoroughly tested… if any flaw found please advise… Thank you.