<< Click to Display Table of Contents >> The <page> of <total pages> technique |
This is very easy to implement, because with VPE you can insert objects on any page at any time: after you have finished generating a document, you can retrieve its number of pages in the property PageCount. Then simply move from the first to the last page and insert a text object which contains the current and the total page number.
Example:
OpenDoc
... generate document ...
for n = 1 to PageCount
CurrentPage = n // move to the n-th page
text = "Page" + Str(n) + "of" + Str(PageCount)
VpePrint(nRightMargin - 5, nBottomMargin - 1, text)
next n
Note that VPE stores the setting of the margins (and also the positions of the last inserted object) for each page separately. So, if you have pages with different margins, the above example will still work!!! For source code see the demo "Speed + Tables".
Be careful if you want to insert such headers / footers below the bottom margin! If you have the AutoBreak option activated (see “Automatic Text Break”), this might result in unwanted page breaks. Turn AutoBreakMode off in such case.
The example does also work, if you are using a SwapFile based document (DLL: if you are using VpeOpenDocFile).