Home > BSPrinter documentation > Reference

PageNumbersFormat Property


Applies to: PrintPreview control , IPrinterEx object


Type: String


Description:

Returns or sets a string that determines how the page numbers will be formatted.

These characters strings have special meaning, and will be replaced with:
{#}: page number
{##}: total page count
{r}: page number in roman numbers, lowercase
{Nr}: total page count in roman numbers, lowercase
{R}: page number in roman numbers, uppercase
{NR}: total page count in roman numbers, uppercase
{a}: page number using letters as numbers, lowercase
{Na}: total page count using letters as numbers, lowercase
{A}: page number using letters as numbers, uppercase
{NA}: total page count using letters as numbers, uppercase
{i}: page number in sequence of i
{Ni}: total page count in sequence of i
{I}: page number in sequence of I
{NI}: total page count in sequence of I

All other characters will be printed verbatim.
But there is one exception: if the full string is "Default". In this case the default formatting will be used, that is "{#}" (just the page number).

Notes:

This setting sets the default format, but the user can change it from the Page Numbers Options or the Format dialog boxes, that appear pressing the Page Numbers Options or Format toolbar buttons at the Print Preview dialog box. The user will be able to change it as long as the AllowUserChangePageNumbers property setting is set to True (it is the default setting).

From these dialog boxes the user can select from some predefined formats that are localized, being these formats in English:
"{#}"
"-{#}-"
"{#} / {##}"
"{#}/{##}"
"{#} of {##}"
"{r}"
"{R}"
"{a}"
"{A}"
"pg. {#}"
"pg. {#} / {##}"
"pg. {#}/{##}"
"pg. {#} of {##}"
"Page {#}"
"Page {#} / {##}"
"Page {#}/{##}"
"Page {#} of {##}"
"page {#}"
"page {#} / {##}"
"page {#}/{##}"
"page {#} of {##}"

This list can be changed using the event GetLocalizedText, by returning the Text parameter of TextID's:
bsPPUI_General_PageNumbersFormatStrings_Count
bsPPUI_General_PageNumbersFormatString_Item + N

For example, when receiving in the GetLocalizedText event with bsPPUI_General_PageNumbersFormatStrings_Count as argument for TextID, the Text parameter must return the number of different formats for page numbers. The default is "21" for English LanguageID (different languages may have different number of page number formatting options).

After getting that number, the GetLocalizedText event will be raised that number of times with TextID argument ranging from bsPPUI_General_PageNumbersFormatString_Item to bsPPUI_General_PageNumbersFormatString_Item + 21 - 1 (or whatever number that was returned before in bsPPUI_General_PageNumbersFormatStrings_Count).
The Text parameter is used to return the format string for each option in that event procedure.

In English the default predefined page numbers format strings available are "{#}" to "page {#} of {##}" listed above.

See Also:

PageNumbersFont property
PageNumbersColor property
PageNumbersPosition property
PrintPageNumbers property
StartingPageNumber property