Back to Devexpress

Note Interface

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-bb913d62.md

latest4.4 KB
Original Source

Note Interface

Represents a document note (footnote or endnote).

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
public interface Note
vb
Public Interface Note

The following members return Note objects:

Remarks

The NoteCollection contains Note objects. Use the Document.Footnotes property to access the collection of footnotes, and the Document.Endnotes property to access the endnotes collection.

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. The Note.IsCustom property indicates whether the note has a custom reference mark. The Note.Range property provides access to the range occupied by the reference mark.

Use the Note.BeginUpdate() - Note.EndUpdate() methods to access or update the note’s content.

The code sample below shows how to change the endnote’s character properties:

csharp
static void EditEndnote(RichEditDocumentServer wordProcessor)
{
  wordProcessor.LoadDocument("Documents//Grimm.docx");
  Document document = wordProcessor.Document;

  //Access the endnote content:
  SubDocument endnote = document.Endnotes[0].BeginUpdate();

  //Exclude the reference mark and the space after from the range to be edited:
  DocumentRange noteTextRange = endnote.CreateRange(endnote.Range.Start.ToInt() + 2, endnote.Range.Length
      - 2);

  //Access the range's character options:
  CharacterProperties characterProperties = endnote.BeginUpdateCharacters(noteTextRange);

  //Change the note's color and make it italic:
  characterProperties.ForeColor = System.Drawing.Color.Red;
  characterProperties.Italic = true;

  //Finalize the character formatting update:
  endnote.EndUpdateCharacters(characterProperties);

  //Finalize the endnote update:
  document.Endnotes[0].EndUpdate(endnote);
}
vb
Shared Sub EditEndnote(ByVal wordProcessor As RichEditDocumentServer)
  wordProcessor.LoadDocument("Documents//Grimm.docx")
  Dim document As Document = wordProcessor.Document

  'Access the endnote content:
  Dim endnote As SubDocument = document.Endnotes(0).BeginUpdate()

  'Exclude the reference mark and the space after from the range to be edited:
  Dim noteTextRange As DocumentRange = endnote.CreateRange(endnote.Range.Start.ToInt() + 2, endnote.Range.Length - 2)

  'Access the range's character options:
  Dim characterProperties As CharacterProperties = endnote.BeginUpdateCharacters(noteTextRange)

  'Change the note's color and make it italic:
  characterProperties.ForeColor = System.Drawing.Color.Red
  characterProperties.Italic = True

  'Finalize the character formatting update:
  endnote.EndUpdateCharacters(characterProperties)

  'Finalize the endnote update:
  document.Endnotes(0).EndUpdate(endnote)
End Sub

See Also

Note Members

DevExpress.XtraRichEdit.API.Native Namespace