Edit this page

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:

Rad Rich Text Box Features Cross Reference 01

This article covers:

Insert Cross-Reference

The dialog looks like this:

Rad Rich Text Box Features Cross Reference 02

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

Rad Rich Text Box Features Cross Reference 03

When you have chosen the type of the reference, 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 checkbox, 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 listbox 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:

Rad Rich Text Box Features Cross Reference 03

  • 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.

Rad Rich Text Box Features Cross Reference 05

Heading

These are the options when Heading is selected:

Rad Rich Text Box Features Cross Reference 06

  • 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)

Rad Rich Text Box Features Cross Reference 07

  • 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 RadRichTextBox’s API

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

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. RadRichTextBox has the following method:

public void InsertCrossReferenceToBookmark(string bookmarkName, ReferenceContentType contentType, bool insertAsHyperlink)

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. You can see what every value means here. The parameter “insertAsHyperlink” is pretty self-explanatory and also can be read about in this article.

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:

public void InsertCrossReferenceToHeading(Paragraph headingParagraph, ReferenceContentType contentType, bool insertAsHyperlink)

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:

public void InsertCrossReferenceToCaption(Paragraph captionParagraph, ReferenceContentType contentType, bool insertAsHyperlink)

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

Was this article helpful? Yes No

Give article feedback

Tell us how we can improve this article

Dummy