Back to Devexpress

Note.EndUpdate(SubDocument) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-note-dot-endupdate-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-subdocument-x29.md

latest5.6 KB
Original Source

Note.EndUpdate(SubDocument) Method

Finalizes the note update.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
void EndUpdate(
    SubDocument document
)
vb
Sub EndUpdate(
    document As SubDocument
)

Parameters

NameTypeDescription
documentSubDocument

The note opened for editing.

|

Remarks

Use the Note.BeginUpdate() - Note.EndUpdate() methods to initiate the update session and access note content.

The code sample belows shows how to change the footnote’s text:

csharp
static void EditFootnote(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);
}
vb
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 EndUpdate(SubDocument) 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#L59

csharp
//Finalize the update:
document.Footnotes[0].EndUpdate(footnote);
#endregion #EditFootnote

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/NotesActions.cs#L59

csharp
//Finalize the update:
document.Footnotes[0].EndUpdate(footnote);
#endregion #EditFootnote

word-document-api-examples/CS/CodeExamples/NotesActions.cs#L80

csharp
// Finalize to update the endnote.
document.Footnotes[0].EndUpdate(footnote);
#endregion #EditFootnote

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Notes.vb#L44

vb
'Finalize the update:
            document.Footnotes(CInt((0))).EndUpdate(footnote)
#End Region ' #EditFootnote

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/NotesActions.vb#L53

vb
'Finalize the update:
            document.Footnotes(0).EndUpdate(footnote)
' #End Region ' #EditFootnote

word-document-api-examples/VB/CodeExamples/NotesActions.vb#L68

vb
' Finalize to update the endnote.
            document.Footnotes(CInt((0))).EndUpdate(footnote)
#End Region ' #EditFootnote

See Also

Note Interface

Note Members

DevExpress.XtraRichEdit.API.Native Namespace