officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-note.md
Opens a note for editing.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
SubDocument BeginUpdate()
Function BeginUpdate As SubDocument
| Type | Description |
|---|---|
| SubDocument |
The note opened for editing.
|
Use the Note.BeginUpdate() - Note.EndUpdate() methods to initiate the update session and access the note content.
The code sample belows shows how to change the footnote’s text:
static void EditNote(RichEditDocumentServer wordProcessor)
{
wordProcessor.LoadDocument("Documents//Grimm.docx");
Document document = wordProcessor.Document;
//Access the footnote's content:
SubDocument footnote = document.Footnotes[0].BeginUpdate();
//Exclude the reference mark and the space after it from the range to be edited:
DocumentRange noteTextRange =
footnote.CreateRange(footnote.Range.Start.ToInt() + 2, footnote.Range.Length
- 2);
//Clear the range and insert a new text:
footnote.Delete(noteTextRange);
footnote.AppendText("the text is removed");
//Finalize the footnote update:
document.Footnotes[0].EndUpdate(footnote);
//Access the first endnote's content:
SubDocument endnote = document.Endnotes[0].BeginUpdate();
//Exclude the reference mark and the space after it from the range to be edited:
DocumentRange noteTextRange = endnote.CreateRange(endnote.Range.Start.ToInt() + 2, endnote.Range.Length
- 2);
//Access the range's character properties:
CharacterProperties characterProperties = endnote.BeginUpdateCharacters(noteTextRange);
characterProperties.ForeColor = System.Drawing.Color.Red;
characterProperties.Italic = true;
//Finalize the character options update:
endnote.EndUpdateCharacters(characterProperties);
//Finalize the endnote update:
document.Endnotes[0].EndUpdate(endnote);
}
Shared Sub EditFootnote(ByVal wordProcessor As RichEditDocumentServer)
wordProcessor.LoadDocument("Documents//Grimm.docx")
Dim document As Document = wordProcessor.Document
'Access the footnote's content:
Dim footnote As SubDocument = document.Footnotes(0).BeginUpdate()
'Exclude the reference mark and the space after it from the range to be edited:
Dim noteTextRange As DocumentRange =
footnote.CreateRange(footnote.Range.Start.ToInt() + 2, footnote.Range.Length - 2)
'Clear the range and insert a new text:
footnote.Delete(noteTextRange)
footnote.AppendText("the text is removed")
'Finalize the footnote update:
document.Footnotes(0).EndUpdate(footnote)
End Sub
The following code snippets (auto-collected from DevExpress Examples) contain references to the BeginUpdate() method.
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#L46
//Access the first fottnote's content:
SubDocument footnote = document.Footnotes[0].BeginUpdate();
wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/NotesActions.cs#L46
//Access the first fottnote's content:
SubDocument footnote = document.Footnotes[0].BeginUpdate();
word-document-api-examples/CS/CodeExamples/NotesActions.cs#L67
// Access the first footnote content.
SubDocument footnote = document.Footnotes[0].BeginUpdate();
winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Notes.vb#L36
'Access the first fottnote's content:
Dim footnote As DevExpress.XtraRichEdit.API.Native.SubDocument = document.Footnotes(CInt((0))).BeginUpdate()
'Exclude the reference mark and the space after it from the range to be edited:
wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/NotesActions.vb#L41
'Access the first fottnote's content:
Dim footnote As SubDocument = document.Footnotes(0).BeginUpdate()
word-document-api-examples/VB/CodeExamples/NotesActions.vb#L60
' Access the first footnote content.
Dim footnote As DevExpress.XtraRichEdit.API.Native.SubDocument = document.Footnotes(CInt((0))).BeginUpdate()
' Exclude the reference mark and the space after it from the range that is edited.
See Also