CommentedText Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WinForms. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WinForms. SDK TXTextControl.from the setup.dll
Description
A CommentedText object represents a commented piece of text. A comment can be inserted with a built-in comment input control which can be opened through the context menu when a piece of text has been selected. Additionally, a comment can be inserted trough the CommentCollection.Add methods. All CommentedText objects are contained in the CommentCollection which can be obtained with the Comments property.
Syntax
public class CommentedTextPublic Class CommentedTextExamples
The following example attaches a reviewer comment to selected contract text.
textControl.Text = "Payment is due within 30 days.";
textControl.Select(0, textControl.Text.Length);
CommentedText commentedText = new("Verify the payment term.");
textControl.Comments.Add(commentedText);textControl.Text = "Payment is due within 30 days."
textControl.Select(0, textControl.Text.Length)
Dim commentedText As New CommentedText("Verify the payment term.")
textControl.Comments.Add(commentedText)Members
Constructors
| Constructor | Description |
|---|---|
| CommentedText | Initializes a new instance of the CommentedText class. |
Properties
| Property | Description |
|---|---|
| Active | Gets or sets a value specifying whether the comment is currently active or not. An inactive comment is not highlighted and is not retrieved through the CommentCollection.GetItem method. When the state changes from active to inactive or vise versa, a CommentStateChanged event occurs. |
| Comment | Gets or sets a string which is the comment. |
| CreationTime | Gets the date and time when the comment has been inserted. The time is a Coordinated Universal Time (UTC). |
| DefaultHighlightColor | Gets the default highlight color for the commented text. This color is used when the commentator is unknown. When the commentator is the current user, the highlight color is red. |
| HighlightColor | Gets or sets the highlight color for the commented text. If the highlight color is CommentedText.DefaultHighlightColor, the highlight color is set to a color depending on the user name. The current user is the first string set with the TextControl.UserNames property. |
| HighlightMode | Gets or sets a value indicating whether the commented text is highlighted. |
| ID | Gets or sets a user-defined identifier. It must be a one-based value. A value of zero indicates that the comment has no identifier. |
| Length | Gets the number of commented characters. |
| Number | Gets the comment's number. The first comment in the document has the number 1. The number is defined through the textflow. Commented text with a smaller start position has a smaller comment number. |
| RepliedComment | Gets the comment for which this comment is a reply. When this comment is not a reply, null is returned. |
| Replies | Gets all replies of this comment or null if there are no replies. |
| Start | Gets the index (one-based) of the first commented character. |
| Text | Gets the commented text. |
| UserName | Gets the name of the user who has commented the document. This parameter can be null or an empty string to indicate, that an unknown user has made the comment. |
Methods
| Method | Description |
|---|---|
| EditComment | Opens a comment input control to edit the comment's text. |
| ReplyToComment | Opens a comment input control to reply to this comment. |
| Save | Saves the commented text with the specified format. |
| ScrollTo | Sets the current input position to the first position of the commented text and scrolls it into the visible part of the document. |
| Select | Selects the commented part of the document. |