# Cross Reference

Cross-References represent fields that refer to a part of the document. When that part changes, these fields can be updated to reflect the change. You can have a Cross-Reference to a Caption, Heading or Bookmark.

You can insert a Cross-Reference from here:

![WinForms RadRichTextEditor Cross Reference](https://www.telerik.com/products/winforms/documentation/assets/d1ed416b3528c679043b0a2f5ccf8129/richtexteditor-features-references-cross-reference001.png)

This article covers:

* [Insert Cross-Reference](https://www.telerik.com/products/winforms/documentation/controls/richtexteditor/features/references/cross-reference#insert-cross-reference)

* [Type of Cross-References](https://www.telerik.com/products/winforms/documentation/controls/richtexteditor/features/references/cross-reference#types-of-cross-references)

* [Inserting a Cross-Reference using RadRichTextEditor’s API](https://www.telerik.com/products/winforms/documentation/controls/richtexteditor/features/references/cross-reference#inserting-a-cross-reference-using-radrichtexteditors-api)

## Insert Cross-Reference

The dialog looks like this:

![WinForms RadRichTextEditor Insert Cross-Reference](https://www.telerik.com/products/winforms/documentation/assets/b42cdd7991c1e9e7fd78323be5ae8079/richtexteditor-features-references-cross-reference002.png)

You can choose between 4 Reference types: **Figure**, **Table**, **Bookmark** and  **Heading**.

![WinForms RadRichTextEditor Reference Types](https://www.telerik.com/products/winforms/documentation/assets/2699dcd4f4033d46c3b6c3cbdf8a782d/richtexteditor-features-references-cross-reference003.png)

When you have chosen the [type of the reference](https://www.telerik.com/products/winforms/documentation/controls/richtexteditor/features/references/cross-reference#types-of-cross-references), you should choose one of the items in the "*Insert reference to:*" combo box. The items depend on the selected item in the "Reference type" combo box.

The **Insert as hyperlink** check box, if checked, will create the field as a hyperlink to the appropriate part of the document. You can click on it while pressing `Ctrl`. This will force the cursor to move to the start of the part being referenced.

The **For which element** list box shows all the items of the appropriate type that can be chosen.

Clicking on the **Insert** button inserts the **Cross-Reference** to the document.

## Types of Cross-References

### Figure

These are the options you have when you select the **Figure** reference type:

![WinForms RadRichTextEditor Types of Cross-References](https://www.telerik.com/products/winforms/documentation/assets/2699dcd4f4033d46c3b6c3cbdf8a782d/richtexteditor-features-references-cross-reference003.png)

* **Entire Caption** – inserts a field with text equal to the entire caption. In this case the text would be "Figure 1 CaptionText".

* **Only label and number** - inserts only the label and the number after it. In this case: "Figure 1".

* **Only caption text** - – inserts the caption text only: "CaptionText" (the text after the label and the number).

* **Page number** - inserts the number of the page on which the field is located. For example, if the field is on the third page, the text would be "3".

* **Above/Below** – inserts the position of the field relative to the part being referenced. For example, if we have a **Caption** on the first line of the page and we decide to insert a **Cross-Reference** in the middle  of the same page to that **Caption**. We will get the following text – "Above".

### Table

**Table** and **Figure** are both **Captions** so they have the same options.

![WinForms RadRichTextEditor Table](https://www.telerik.com/products/winforms/documentation/assets/916a7027e3d711274d31ca0978789706/richtexteditor-features-references-cross-reference004.png)

### Heading

These are the options when **Heading** is selected:

![WinForms RadRichTextEditor Heading](https://www.telerik.com/products/winforms/documentation/assets/87ebf6b324ca6734033a9c7b6c28c18a/richtexteditor-features-references-cross-reference005.png)

* **Heading text** - inserts a field with text equal to the one in the heading chosen. For example, here we have a paragraph with text “Heading1” (and style *Heading1*). The text inserted by the field would be "Heading1".

* **Page Number** - inserts the number of the page on which the field is located. For example, if the field is on the fifth page, the text would be “5”.

* **Above/Below** - inserts the position of the field relative to the part being referenced. For example, if we have a **Caption** in the middle of the page and we decide to insert a Cross-Reference on the first line of the same page to that Caption. We will get the following text – "Below".

### Bookmark

When **Bookmark** item is selected in the list with all available bookmarks you see only the names (not the text as with captions  and headings)

![WinForms RadRichTextEditor Bookmark](https://www.telerik.com/products/winforms/documentation/assets/98331e2bb3dff3384fa671d3d82566eb/richtexteditor-features-references-cross-reference006.png)

* **Bookmark text** - inserts the text in the bookmark. Here the name is shown, not the text. So the field would look something like "*Bookmark Text Here*", given that this is the text of the bookmark with name "Bookmark".

* **Page number** – inserts the number of the page on which the field is located. For example, if the field is on the seventh page, the text would be "7".

* **Above/Below** – inserts the position of the field relative to the part being referenced. For example, if we have a  **Caption** on the first line of the page and we decide to insert a Cross-Reference in the middle of the page to that   **Caption** we will get the text "Above".

## Inserting a Cross-Reference using RadRichTextEditor’s API

All types of **Cross-References** can be inserted using methods of **RadRichTextEditor**.

### Inserting Cross-Reference to a Bookmark

Every bookmark has a unique name. So in order to insert a reference to a bookmark, you need its name. **RadRichTextEditor** has the following method:

```C#
radRichTextEditor1.InsertCrossReferenceToBookmark("Bookmark Name", ReferenceContentType.EntireContent, false);
```

```VB.NET
radRichTextEditor1.InsertCrossReferenceToBookmark("Bookmark Name", ReferenceContentType.EntireContent, False)
```

**ReferenceContentType** is an enumeration that has five values – **EntireContent**, **OnlyLabelAndNumber**, **OnlyCaption**, **PageNumber** and **RelativePosition**. As you can see, those values are the same as in the "Insert reference to:" combo box. The parameter "InsertAsHyperlink" is pretty self-explanatory and also can be read about [in this section](https://www.telerik.com/products/winforms/documentation/controls/richtexteditor/features/references/cross-reference#insert-cross-reference).

### Inserting Cross-Reference to a Heading

You have to pass the paragraph (with heading style applied, of course) that you want to create a Reference to. The method signature is as follows:

```C#
radRichTextEditor1.InsertCrossReferenceToHeading(headingParagraph, ReferenceContentType.OnlyCaption, true);
```

```VB.NET
radRichTextEditor1.InsertCrossReferenceToHeading(headingParagraph, ReferenceContentType.OnlyCaption, True)
```

The parameters are almost the same, except the first one. It represents the paragraph you want to reference. The other two have the same purpose.

### Inserting Cross-Reference to a Caption

The method signature is:

```C#
radRichTextEditor1.InsertCrossReferenceToCaption(captionParagraph, ReferenceContentType.OnlyLabelAndNumber,false);
```

```VB.NET
radRichTextEditor1.InsertCrossReferenceToCaption(captionParagraph, ReferenceContentType.OnlyLabelAndNumber, False)
```

The first parameter represents the paragraph (**Caption**) you want to refer.
