officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-37a3843b.md
A collection of Note objects.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
public interface NoteCollection :
ReadOnlyNoteCollection,
ISimpleCollection<Note>,
IEnumerable<Note>,
IEnumerable,
ICollection
Public Interface NoteCollection
Inherits ReadOnlyNoteCollection,
ISimpleCollection(Of Note),
IEnumerable(Of Note),
IEnumerable,
ICollection
The following members return NoteCollection objects:
The NoteCollection represents the collection of footnotes and endnotes.
Call the NoteCollection.Insert method to insert a new note into the specific document position. Pass the symbol used to mark the reference to the Insert method to insert a note with a custom mark.
Access a collection item by its index. The Note object represents a footnote or endnote. You can check whether the note has a custom mark (Note.IsCustom), and access a range related to the reference mark (Note.Range). Call the Note.BeginUpdate and Note.EndUpdate paired methods to open and close the note’s content for update.
The code sample below shows how to insert a footnote and append a footnote text:
using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
wordProcessor.LoadDocument("Document.docx");
Document document = wordProcessor.Document;
DocumentPosition footnotePosition =
document.CreatePosition(document.Paragraphs[5].Range.End.ToInt() - 1);
Note footnote = document.Footnotes.Insert(footnotePosition);
SubDocument footnoteContent = footnote.BeginUpdate();
footnoteContent.AppendText("This is a test footnote");
footnote.EndUpdate(footnoteContent);
}
Using wordProcessor As New RichEditDocumentServer()
wordProcessor.LoadDocument("Document.docx")
Dim document As Document = wordProcessor.Document
Dim footnotePosition As DocumentPosition =
document.CreatePosition(document.Paragraphs(5).Range.End.ToInt() - 1)
Dim footnote As Note = document.Footnotes.Insert(footnotePosition)
Dim footnoteContent As SubDocument = footnote.BeginUpdate()
footnoteContent.AppendText("This is a test footnote")
footnote.EndUpdate(footnoteContent)
End Using
Use the NoteCollection.HasSeparator method to determine what separators the collection contains. The NoteSeparatorType enumeration lists available separator types. Use the NoteCollection.BeginUpdateSeparator and NoteCollection.EndUpdateSeparator paired methods to initiate an update session and access separator content.
The code sample below shows how to change the footnote separator:
RichEditDocumentServer wordProcessor = new RichEditDocumentServer();
wordProcessor.LoadDocument("Documents//Grimm.docx");
Document document = wordProcessor.Document;
if (document.Footnotes.HasSeparator(NoteSeparatorType.Separator))
{
SubDocument noteSeparator = document.Footnotes.BeginUpdateSeparator(NoteSeparatorType.Separator);
noteSeparator.Delete(noteSeparator.Range);
noteSeparator.AppendText("***");
document.Footnotes.EndUpdateSeparator(noteSeparator);
}
Dim wordProcessor As RichEditDocumentServer = New RichEditDocumentServer()
wordProcessor.LoadDocument("Documents//Grimm.docx")
Dim document As Document = wordProcessor.Document
If document.Footnotes.HasSeparator(NoteSeparatorType.Separator) Then
Dim noteSeparator As SubDocument = document.Footnotes.BeginUpdateSeparator(NoteSeparatorType.Separator)
noteSeparator.Delete(noteSeparator.Range)
noteSeparator.AppendText("***")
document.Footnotes.EndUpdateSeparator(noteSeparator)
End If
See Also