Hi,
I just had a conversation with the MBS-Support, according to the problem to have something like "page# of totalpages" on a report.
The person I was talking had a good idea, and for me this works.
Here's the Code-Sample:
// BEGIN of Sample
CLEAR(TestReport);
TestReport.SAVEASHTML('c:\test.html');
// Call a function in the report that returns
// "CURRREPORT.PAGENO" after the SAVEASHTML has finished
PageCount := TestReport.ReturnTotalPages;
CLEAR(TestReport);
// Call a function in the report an use the PageCount
// as Parameter
TestReport.DefTotalPages(PageCount);
TestReport.RUN;
// END of Sample
"TestReport" is a Variable of type Report.
"PageCount" is a Variable of type Integer
Hope this helps.
Bye,
Rolf
0
Comments
And you should delete the file in the end to clean up.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
but if you do so you also should save the file in the temp-directory of the pc (for this use ENVIRON('TEMP'); )
The Code should only be a sample, it is not "clean" code.
But this solution is the only way, to get the exact total number of pages (official statement of Navision-Support).
To count the records that will be printed an than calculate the number of pages that will be used, only work for simple list-style reports.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
And about the time: does it cost the same to print in Navision rather than to html? We use hand-made reports for inventory because in some branches of my company the Inventory Valuation takes more than a work-time day.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Anyone can figure out why?
"TestReport.SaveAsHtml....."
Josef Metz
I can run the solution and saveashtml in Form object. But how can i use saveashtml in report. For example, when i run Purchase Order report, i cant use currReport.saveashtml. The common demand show the total page when preview the report and we need to put the saveashtml function in report trigger. Can anyone give a example.
I tried on the triggers of a report, but cant work ](*,)
Thanks a lot
Dynamics NAV Developer since 2005
I'm actually tring to rework this so that I can have a different footer print on the last page than on all the other pages. I figured I would use the code listed in here and then in each of those footer sections I would have code similar to this:
I'm just not sure where to put the code this part of the code:
Now it could be that I am doing this completely wrong, but as I said I am new to this navision thing.
Do I have to create a new report only with this code to be able to run the other report (variable TestReport) or a new codeunit?
In some Navision standard code/report there is not an example of how they do?
Thank you
I agree with "Bagheera"..
I have fully implemented this method into some reports wich have been testrunning for quite some time now.
The counting of the pages indeed DOES NOT add up properly.. it might be too low, or too high, or just right ...
The reason for this is still unclear to me.. also, it makes no difference wether you use the SAVEASHMTL or SAVEASXML..
It's the same sheisse.. unfortunatly
So does anyone know why the page count doesn't always add up properly?
If not.. Then NO, THIS IS NOT A RELIABLE SOLUTION for asfar as i'm concerned
Microsoft Certified Business Management Solutions Professional
Microsoft Certified Business Management Solutions Specialist
http://www.navisiontech.com
Imo: thats what we really need to know, why does the PageCount not add up for some people, but then for others it does..
What is the Variable that makes the pagecount differ for some people?