officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-20223f3b.md
A collection of Comment objects.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
[ComVisible(true)]
public interface CommentCollection :
ReadOnlyCommentCollection,
ISimpleCollection<Comment>,
IEnumerable<Comment>,
IEnumerable,
ICollection
<ComVisible(True)>
Public Interface CommentCollection
Inherits ReadOnlyCommentCollection,
ISimpleCollection(Of Comment),
IEnumerable(Of Comment),
IEnumerable,
ICollection
The following members return CommentCollection objects:
Items in the CommentCollection are ordered and indexed in the same order as the ranges to which they belong. That is, a comment whose Comment.Range is closer to the beginning of the document has a lower index value.
When you add a new comment, the CommentOptions.Visibility property is set to Visible.
using DevExpress.XtraRichEdit.API.Native;
using DevExpress.XtraRichEdit;
static void CreateComment(RichEditDocumentServer wordProcessor) {
// Load a document from a file.
wordProcessor.LoadDocument("Documents\\Grimm.docx");
// Access a document.
Document document = wordProcessor.Document;
if (document.Paragraphs.Count > 2) {
// Access the range of the third paragraph.
DocumentRange docRange = document.Paragraphs[2].Range;
// Specify the comment's author name.
string commentAuthor = "Johnson Alphonso D";
// Create a comment.
document.Comments.Create(docRange, commentAuthor, DateTime.Now);
}
}
Imports DevExpress.XtraRichEdit.API.Native
Imports DevExpress.XtraRichEdit
Shared Sub CreateComment(ByVal wordProcessor As RichEditDocumentServer)
' Load a document from a file.
wordProcessor.LoadDocument("Documents\Grimm.docx")
' Access a document.
Dim document As Document = wordProcessor.Document
If document.Paragraphs.Count > 2 Then
' Access the range of the third paragraph.
Dim docRange As DocumentRange = document.Paragraphs(2).Range
' Specify the comment's author name.
Dim commentAuthor As String = "Johnson Alphonso D"
' Create a comment.
document.Comments.Create(docRange, commentAuthor, Date.Now)
End If
End Sub
See Also