Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Page X of X
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Miscellaneous
Thread ID:
00459324
Message ID:
00459665
Views:
30
Hi Ismael,

IMO, you overcomplicate this simple task, e.g.:
private pnTotalPages
pnTotalPages=0 && this is just for initialization
report form youreport to file dummy.txt noconsole
pnTotalPages=_pageno
delete file dummy.txt
report form youreport to printer
should work just fine and you don't need to mess with Report DE.

Anyway, thanks a lot for your idea.

>Hi!
>
>In addition to the previous suggested solution to get the total number of pages, think it is better to preview the report form with nowait state and automatically close it in order to get the exact number of pages no matter what printer driver to be used...
>
>Example:
>
>PUBLIC nTotalPages
>REPORT FORM xReportFile PREVIEW NOWAIT
>KEYBOARD '{END}'
>KEYBOARD '{CTRL+F4}'
>? nPages
>
>******************************************************
>**** Note:
>**** Be sure to put this additional code
>**** Place this at the DESTROY EVENT in the DATA ENVIRONMENT of your report.
>******************************************************
>IF TYPE("nTotalPages")="U"
> PUBLIC nTotalPages
>ENDIF
>nTotalPages = _pageno
>******************************************************
>
>I always used this solution for my reports and it works fine...
>
>
>
>---->>>previous suggested solution:
>************************************************************
>1) Print the report twice:
>get the system variable _pepage after first print!
>
>Report form myreport to file c:\tmpfile.txt NoConsole
>
>(print to screen but don't show to screen.. ~__^)
>
>totalpage = _pepage && Private Variable instead
>
>and use this variable in report to print.
>
>Remarks:
>
>Previous Version is: Report form myreport to screen NoConsole
>But the Screen Scale may be different from real one, So the _pepage still may be wrong.
>
>Reference Thread# 396436
>
>
>2) Use a formula to do:
>thm.:
>
>totalpage = CEILING(RECCOUNT()/Num_of_Rec_Per_page)
>
>Since the detail height is most likely seldom to change,
>the number of record printed per page will almost fixed!
>Find it and put it as an constant.
>
>So, you can direct print the above formula value as totalpage.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform