Comment

Overview

Comment is a class in Aspose.Words FOSS for .NET. Inherits from: InlineStory, INodeWithAnnotationId, IMoveTrackableNode.

Represents a container for text of a comment.

This class provides 33 methods for working with Comment objects in .NET programs. Available methods include: Accept, AcceptEnd, AcceptStart, AddReply, AppendChild, Clone, Comment, CreateNavigator, EnsureMinimum, GetAncestor, GetAncestorOf, GetChild, and 20 additional methods. All public members are accessible to any .NET application after installing the Aspose.Words FOSS for .NET package. Properties: Ancestor, Author, Count, CustomNodeId, DateTime, DateTimeUtc, and 26 more.

Properties

NameTypeAccessDescription
NodeTypeNodeTypeReadReturns Comment.
StoryTypeStoryTypeReadReturns Comments.
IdintRead/WriteGets or sets the comment identifier.
InitialstringRead/WriteReturns or sets the initials of the user associated with a specific comment.
DateTimeDateTimeRead/WriteGets the date and time that the comment was made.
DateTimeUtcDateTimeReadGets the UTC date and time that the comment was made.
AuthorstringRead/WriteReturns or sets the author name for a comment.
AncestorCommentReadReturns the parent Comment object.
RepliesCommentCollectionReadReturns a collection of Comment objects that are immediate children of the specified comment.
DoneboolRead/WriteGets or sets flag indicating that the comment has been marked done.
ParentIdintRead/WriteGets or sets the parent comment ID.
ParentParagraphParagraphReadRetrieves the parent Paragraph of this node.
FirstParagraphParagraphReadGets the first paragraph in the story.
LastParagraphParagraphReadGets the last paragraph in the story.
ParagraphsParagraphCollectionReadGets a collection of paragraphs that are immediate children of the story.
TablesTableCollectionReadGets a collection of tables that are immediate children of the story.
IsInsertRevisionboolReadGets the is insert revision.
IsDeleteRevisionboolReadGets the is delete revision.
IsMoveFromRevisionboolReadGets the is move from revision.
IsMoveToRevisionboolReadGets the is move to revision.
FontFontReadProvides access to the font formatting of the anchor character of this object.
IsCompositeboolReadReturns true as this node can have child nodes.
HasChildNodesboolReadReturns true if this node has any child nodes.
FirstChildNodeReadGets the first child of the node.
LastChildNodeReadGets the last child of the node.
CountintReadGets the number of immediate children of this node.
ParentNodeCompositeNodeReadGets the immediate parent of this node.
DocumentDocumentBaseReadGets the document to which this node belongs.
PreviousSiblingNodeReadGets the node immediately preceding this node.
NextSiblingNodeReadGets the node immediately following this node.
RangeRangeReadReturns a Range object that represents the portion of a document that is contained in this node.
CustomNodeIdintRead/WriteSpecifies custom node identifier.

Methods

SignatureDescription
Comment(doc: DocumentBase)Initializes a new instance of the Comment class.
Comment(doc: DocumentBase, author: string, initial: string, dateTime: DateTime)Initializes a new instance of the Comment class.
Accept(visitor: DocumentVisitor)Calls VisitCommentStart, then calls Accept for all child nodes of the comment and calls VisitCommentEnd at the end.
AddReply(author: string, initial: string, dateTime: DateTime, text: string)Adds a reply to this comment.
RemoveReply(reply: Comment)Removes the specified reply to this comment.
RemoveAllReplies()Removes all replies to this comment.
AcceptStart(visitor: DocumentVisitor)Accepts a visitor for visiting the start of the comment.
AcceptEnd(visitor: DocumentVisitor)Accepts a visitor for visiting the end of the comment.
SetText(text: string)This is a convenience method that allows to easily set text of the comment.
EnsureMinimum()If the last child is not a paragraph, creates and appends one empty paragraph.
GetText()Gets the text of this node and of all its children.
GetChildNodes(nodeType: NodeType, isDeep: bool)Returns a collection of child nodes that match the specified type.
GetChild(nodeType: NodeType, index: int, isDeep: bool)Returns an Nth child node that matches the specified type.
SelectNodes(xpath: string)Selects a list of nodes matching the XPath expression.
SelectSingleNode(xpath: string)Selects the first Node that matches the XPath expression.
GetEnumerator()Provides support for the for each style iteration over the child nodes of this node.
AppendChild(newChild: T)Adds the specified node to the end of the list of child nodes for this node.
PrependChild(newChild: T)Adds the specified node to the beginning of the list of child nodes for this node.
InsertAfter(newChild: T, refChild: Node)Inserts the specified node immediately after the specified reference node.
InsertBefore(newChild: T, refChild: Node)Inserts the specified node immediately before the specified reference node.
RemoveChild(oldChild: T)Removes the specified child node.
RemoveAllChildren()Removes all the child nodes of the current node.
RemoveSmartTags()Removes all SmartTag descendant nodes of the current node.
IndexOf(child: Node)Returns the index of the specified child node in the child node array.
CreateNavigator()Creates navigator which can be used to traverse and read nodes.
Clone(isCloneChildren: bool)You should use the Clone(bool, INodeCloningListener) overload when the node cloning is a part of another (usually composite) node cloning process.
GetAncestor(ancestorType: Type)Gets the first ancestor of the specified object type.
GetAncestorOf()Calls GetAncestorOf on this Comment instance.
Remove()Removes itself from the parent.
NextPreOrder(rootNode: Node)Gets next node according to the pre-order tree traversal algorithm.
PreviousPreOrder(rootNode: Node)Gets the previous node according to the pre-order tree traversal algorithm.
ToString(saveFormat: SaveFormat)Exports the content of the node into a string in the specified format.
NodeTypeToString(nodeType: NodeType)A utility method that converts a node type enum value into a user friendly string.

See Also