+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

Page X/Y: Calculating the Total Page Count

(combit Team) #1
Valid from List & Label 4
Starting with List & Label 11 you can use the TotalPages$() function to get the total number of pages. Please note that a placeholder will be displayed in the designer that is replaced by the actual value during print out. A possible formula for the page number would thus be
"Page "+ Page$() + " of "+TotalPages$()

To get the right result with older versions you have to use the so-called “2-pass technique”. Your application is performing an “invisible” preview print process (without displaying the preview file) just for getting the total page count (by using the appropriate LlStgsys function, see example below). This total page count is then provided as a variable for the second, “real” print process, (e.g. “TotalPageCount”).

We recommend to use LlPrintIsVariableUsed to examine whether this variable has ever been used in the report. If not then you don’t need to perform such a 2-pass printing loop and the whole print process will of course become much more performant.

hStg = LlStgsysStorageOpen("c:\\test\\label.ll", NULL, TRUE, TRUE);
nTotalPageCount = LlStgsysGetPageCount(hStg);
IDKBTE000520 KBTE000520