officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-document-32324537.md
Provides access to document endnotes.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
NoteCollection Endnotes { get; }
ReadOnly Property Endnotes As NoteCollection
| Type | Description |
|---|---|
| NoteCollection |
A collection of endnotes.
|
The NoteCollection contains document endnotes - notes that appear at the end of the document. 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 an endnote. You can check whether the note has a custom mark (Note.IsCustom), and access the range related to the reference mark (Note.Range). Call the Note.BeginUpdate and Note.EndUpdate paired methods to initiate the update session and access the note’s content.
The code sample below shows how to insert an endnote and append a text:
using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
wordProcessor.LoadDocument("Document.docx");
Document document = wordProcessor.Document;
//Create an endnote at the end of the last paragraph:
DocumentPosition endnotePosition =
document.CreatePosition(document.Paragraphs[document.Paragraphs.Count - 1].Range.End.ToInt() - 1);
Note endnote = document.Endnotes.Insert(endnotePosition);
//Access the endnote content
//And insert text:
SubDocument endnoteContent = endnote.BeginUpdate();
endnoteContent.AppendText("First endnote");
//Finalize the endnote update:
endnote.EndUpdate(endnoteContent);
}
Using wordProcessor As New RichEditDocumentServer()
wordProcessor.LoadDocument("Document.docx")
Dim document As Document = wordProcessor.Document
'Create an endnote at the end of the last paragraph:
Dim endnotePosition As DocumentPosition =
document.CreatePosition(document.Paragraphs(document.Paragraphs.Count - 1).Range.End.ToInt() - 1)
Dim endnote As Note = document.Endnotes.Insert(endnotePosition)
'Access the endnote content
'And insert text:
Dim endnoteContent As SubDocument = endnote.BeginUpdate()
endnoteContent.AppendText("First endnote")
'Finalize the endnote update:
endnote.EndUpdate(endnoteContent)
End Using
Use the NoteCollection.HasSeparator method to determine what separators the endnotes have. The NoteSeparatorType enumeration lists available separator types. Use the NoteCollection.BeginUpdateSeparator and NoteCollection.EndUpdateSeparator paired method to initiate an update session and access the separator content.
The following code snippets (auto-collected from DevExpress Examples) contain references to the Endnotes property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Notes.cs#L128
if (document.Endnotes[i].IsCustom)
document.Endnotes.Remove(document.Endnotes[i]);
}
wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/NotesActions.cs#L124
if (document.Endnotes[i].IsCustom)
document.Endnotes.Remove(document.Endnotes[i]);
}
word-document-api-examples/CS/CodeExamples/NotesActions.cs#L159
if (document.Endnotes[i].IsCustom)
document.Endnotes.Remove(document.Endnotes[i]);
}
winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Notes.vb#L93
For i As Integer = document.Endnotes.Count - 1 To 0 Step -1
If document.Endnotes(CInt((i))).IsCustom Then document.Endnotes.Remove(document.Endnotes(i))
Next
wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/NotesActions.vb#L112
If document.Endnotes(i).IsCustom Then
document.Endnotes.Remove(document.Endnotes(i))
End If
word-document-api-examples/VB/CodeExamples/NotesActions.vb#L124
For i As Integer = document.Endnotes.Count - 1 To 0 Step -1
If document.Endnotes(CInt((i))).IsCustom Then document.Endnotes.Remove(document.Endnotes(i))
Next
See Also