TX Text Control .NET Server

CommentCollection Class

Class|Introduced in 30.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.Core.dll
Install
dotnet add package TXTextControl.TextControl.Core.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll
Implements
ICollection, IEnumerable

Description

Contains all comments in the main text or another part of a document. All comments are associated with a certain piece of text of the document. The collection consists of CommentedText objects, describing the position and length of the commented text and the comment string itself. A collection object can be obtained with the TextControl.Comments, the HeaderFooter.Comments or the TextFrame.Comments property. The CommentCollection class implements the IEnumerable and the ICollection interfaces.

Syntax

public sealed class CommentCollection : ICollection, IEnumerable

Examples

The following example works with comments in the current document.

CommentCollection commentCollection = textControl.Comments;
textControl.Text = "Payment is due within 30 days.";
textControl.Select(0, textControl.Text.Length);
commentCollection.Add(new CommentedText("Verify the payment term."));

Members

Properties

PropertyDescription
CountGets the number of elements contained in the collection.
IsSynchronizedReturns true if the collection is designed to be thread safe, otherwise, it returns false.
ItemGets the comment with the specified number from the collection. The number must be between 1 and Count. In C# this property is the indexer for the CommentCollection class.
SyncRootGets an object that can be used to synchronize access to the collection.

Methods

MethodDescription
AddAdds a new comment to the document.
CopyToCopies the elements of the collection to an array, starting at a particular index.
GetEnumeratorReturns an enumerator that can be used to iterate through the collection.
GetItemGets a particular item from the collection.
RemoveRemoves a CommentedText from the collection. The method removes the saved position values and the comment string. The text, which is commented, is not removed from the document.

Enumerations

EnumerationDescription
AddResultSpecifies the result when a comment has been added to the document.