PageRef Field
The PageRef field inserts the page number of a bookmark for a cross-reference.
In order to update the PageRef fields within the TOC field you need to set the FlowExtensibilityManager.NumberingFieldsProvider
Field Syntax
This is how the syntax of a PageRef field looks like:
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 Date field are:
Switches | Description |
---|---|
\h | Creates a hyperlink to the bookmarked paragraph. |
\p | Causes the field to display its position relative to the source bookmark. |
Inserting
Inserting this field is easily achieved through the RadFlowDocumentEditor's InsertField() method. It accepts code as first argument and result as second argument.
Example 1 demonstrates how you can insert a PageRef field.
Example 1: Insert PageRef field
editor.InsertText("Bookmark Page: ");
editor.InsertField("PAGEREF mybookmark", "");
After updating the field the result would be "Bookmark Page: 2" (check Updating Fields).