PageRef Field
The PageRef field inserts the page number of a bookmark for a cross-reference.
To update the
PageReffields within the TOC field, you need to set the FlowExtensibilityManager.NumberingFieldsProvider.
Field Syntax
The following table shows the syntax of a PageRef field:
| Syntax |
|---|
| { PAGEREF Bookmark [\* Format Switch ] } |
Switches
Switches are a way for the code fragment to specify formatting for the result of the field. More information is available in the Syntax and Switches section of the Fields article.
The possible switches for a PageRef field are:
| Switch | Description |
|---|---|
| \h | Creates a hyperlink to the bookmarked paragraph. |
| \p | Causes the field to display its position relative to the source bookmark. |
Inserting
You can insert this field through the RadFlowDocumentEditor's InsertField() method. It accepts code as the first argument and result as the second argument.
Example 1 demonstrates how you can insert a PageRef field.
Example 1: Insert a PAGEREF field that displays the page number of the mybookmark bookmark
editor.InsertText("Bookmark Page: ");
editor.InsertField("PAGEREF mybookmark", "");
After updating the field, the result is "Bookmark Page: 2" (check Updating Fields).