Skip to main content

NoteCollection Interface

A collection of Note objects.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v24.2.Core.dll

NuGet Package: DevExpress.RichEdit.Core

Declaration

public interface NoteCollection :
    ReadOnlyNoteCollection,
    ISimpleCollection<Note>,
    IEnumerable<Note>,
    IEnumerable,
    ICollection

The following members return NoteCollection objects:

Remarks

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);
}

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);
}
See Also