"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); LlStgsysStorageClose(hStg);