Footnotes and Endnotes
Footnotes and endnotes (or just notes) are used in documents and books to show the source of borrowed material or to enter explanatory or supplementary information. Footnotes are positioned at the bottom of a page, containing the annotated text, and endnotes are placed at the end of a document or the section.
This topic will explain:
Note options
There are various properties that control how notes are positioned and visualized in the document. All of these properties can be applied on the whole document and some of them (concerning the note numbering) can also be applied on sections individually.
Footnote options
Here is the list of the available properties concerning footnotes:
FootnotesNumberingFormat - Gets or sets the footnotes numbering format.
FootnotesFirstNumber - Gets or sets the footnotes starting number.
-
FootnotesNumberingRestartType - Represents the type of the footnotes numbering restart. The available types are :
Continuous - numbering is never restarted.
EachPage - numbering is restarted on each page.
EachSection - numbering is restarted on each section.
FootnotesPosition - PageBottom is the only available option.
Endnote options
Here is the list of the available properties concerning endnotes:
EndnotesNumberingFormat - Gets or sets the endnotes numbering format.
EndnotesFirstNumber - Gets or sets the endnotes starting number.
-
EndnotesNumberingRestartType - Represents the type of the endnotes numbering restart. The available types are :
Continuous - same numbering is used for all endnotes in the document.
EachSection - numbering is restarted on each section.
-
EndnotesPosition - Available options are:
DocumentEnd - all endnotes are shown at the end of the document.
SectionEnd - there is a list of endnotes for each section.
Creating and Inserting
Footnotes and endnotes all contain the Note class which defines the note body and whether a special symbol should be used when visualizing the note in the document. Notes can be inserted in RadRichTextEditor using the following methods:
radRichTextEditor1.InsertFootnote();
radRichTextEditor1.InsertFootnote(new Note());
radRichTextEditor1.InsertEndnote();
radRichTextEditor1.InsertEndnote(new Note());
radRichTextEditor1.InsertFootnote()
radRichTextEditor1.InsertFootnote(New Note())
radRichTextEditor1.InsertEndnote()
radRichTextEditor1.InsertEndnote(New Note())
There is a set of document styles that are used inside notes content. It is recommended that when a note is created by code, these styles are used in the note body, so the document styling is persistent. There are some static helper methods that make the task of creating notes, that have the necessary styles applied, easier:
Note note = Note.CreateCustomMarkFootnote("symbol");
note = Note.CreateCustomMarkEndnote("symbol", new FontFamily("Arial"));
note = Note.CreateDefaultFootnote();
note = Note.CreateDefaultEndnote();
Dim note As Note = note.CreateCustomMarkFootnote("symbol")
note = note.CreateCustomMarkEndnote("symbol", New FontFamily("Arial"))
note = note.CreateDefaultFootnote()
note = note.CreateDefaultEndnote()
Here is for example how to insert a footnote with a custom mark – dollar sign with Calibri font:
Note note1 = Note.CreateCustomMarkFootnote("$", new FontFamily("Calibri"));
this.radRichTextEditor1.InsertFootnote(note1);
Dim note1 As Note = note.CreateCustomMarkFootnote("$", New FontFamily("Calibri"))
Me.radRichTextEditor1.InsertFootnote(note1)
Navigating and Scrolling
You can programmatically navigate the document caret position through the notes in the document using the following methods of the RadRichTextEditor:
radRichTextEditor1.GoToNextFootnote();
radRichTextEditor1.GoToPreviousFootnote();
radRichTextEditor1.GoToNextEndnote();
radRichTextEditor1.GoToPreviousEndnote();
radRichTextEditor1.GoToNextFootnote()
radRichTextEditor1.GoToPreviousFootnote()
radRichTextEditor1.GoToNextEndnote()
radRichTextEditor1.GoToPreviousEndnote()
You can use the ScrollToNote() method to scroll the viewport so that a note content is visible. A reference to the note object can be obtained through the FootnoteRangeStart and EndnoteRangeStart annotations. These annotations are contained inside the document and mark the beginning of the note symbol that acts like a reference to the note. Here is an example of how to scroll to the content of the first endnote in the document:
EndnoteRangeStart noteRangeStart = this.radRichTextEditor1.Document.EnumerateChildrenOfType<EndnoteRangeStart>().FirstOrDefault();
if (noteRangeStart != null)
{
this.radRichTextEditor1.ScrollToNote(noteRangeStart.Note);
}
Dim noteRangeStart As EndnoteRangeStart = Me.radRichTextEditor1.Document.EnumerateChildrenOfType(Of EndnoteRangeStart)().FirstOrDefault()
If noteRangeStart IsNot Nothing Then
Me.radRichTextEditor1.ScrollToNote(noteRangeStart.Note)
End If