TX Text Control .NET Server

Add Method

Method|Introduced in 30.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Adds a new comment to the document.

Syntax

Add()

Opens a comment input control so that the end-user can type the comment's text. The new comment is inserted after the input control has been closed.

public CommentCollection.AddResult Add();

Add(CommentedText)

Adds a new comment given through the specified CommentedText object.The commented text is defined through the CommentedText.Start and CommentedText.Length properties. If the length of the commented text is zero, the current text selection is used to define the text associated with the comment.

public CommentCollection.AddResult Add(CommentedText commentedText);
ParameterDescription
commentedText

Defines the commented text and its comment to add.

Return Value

The return value specifies whether the comment input control could be opened or the new comment has successfully been inserted. It can be one of the CommentCollection.AddResult values.

Examples

The following example works with comments in the current document by using CommentCollection.Add.

CommentCollection commentCollection = textControl.Comments;

var result = commentCollection.Add(new CommentedText("Quarterly report"));
Console.WriteLine($"Add result: {result}");