Class WComment
Represents a comment in the Word document.
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Base.dll
Syntax
public class WComment : ParagraphItem, IXDLSSerializable, IWidget, IParagraphItem, IOfficeRun, ICompositeEntity, IEntity
Constructors
WComment(IWordDocument)
Initializes a new instance of the WComment class with the specified IWordDocument instance.
Declaration
public WComment(IWordDocument doc)
Parameters
Type | Name | Description |
---|---|---|
IWordDocument | doc | The IWordDocument instance. |
Fields
m_format
Represents the formatting options for the comment.
Declaration
protected WCommentFormat m_format
Field Value
Type | Description |
---|---|
WCommentFormat |
m_textBody
Represents the text body of comment.
Declaration
protected WTextBody m_textBody
Field Value
Type | Description |
---|---|
WTextBody |
Properties
Ancestor
Returns the parent comment for the specific comment. Read-only
Declaration
public WComment Ancestor { get; }
Property Value
Type | Description |
---|---|
WComment |
Remarks
Returns null for top-level comments.
Examples
Load an existing Word document into DocIO instance
WordDocument document = new WordDocument("Template.docx");
Get the Ancestor comment
WComment ancestorComment = document.Comments[1].Ancestor;
Save and Close the Word document
document.Save("Sample.docx", FormatType.Docx);
document.Close();
'Load an existing Word document into DocIO instance
Dim document As WordDocument = New WordDocument("Template.docx")
'Get the Ancestor comment
Dim ancestorComment As WComment = document.Comments(1).Ancestor
'Save and Close the Word document
document.Save("Sample.docx", FormatType.Docx)
document.Close()
ChildEntities
Gets the child elements of the comment. Read-only.
Declaration
public EntityCollection ChildEntities { get; }
Property Value
Type | Description |
---|---|
EntityCollection | The collection of child elements. |
CommentedItems
Gets the collection of items in the paragraph of the comment.
Declaration
public ParagraphItemCollection CommentedItems { get; }
Property Value
Type | Description |
---|---|
ParagraphItemCollection | The paragraph items collection of the comment. |
CommentRangeEnd
Declaration
public WCommentMark CommentRangeEnd { get; }
Property Value
Type | Description |
---|---|
WCommentMark |
CommentRangeStart
Declaration
public WCommentMark CommentRangeStart { get; }
Property Value
Type | Description |
---|---|
WCommentMark |
EntityType
Gets the type of the entity. Read-only.
Declaration
public override EntityType EntityType { get; }
Property Value
Type | Description |
---|---|
EntityType | The EntityType of the current item. |
Overrides
Format
Gets the format options for the comment.
Declaration
public WCommentFormat Format { get; }
Property Value
Type | Description |
---|---|
WCommentFormat | The WCommentFormat instance that represents format options of comment. |
TextBody
Gets the text body of the comment. Read-only.
Declaration
public WTextBody TextBody { get; }
Property Value
Type | Description |
---|---|
WTextBody | The WTextBody instance that represents the text body. |
Methods
AddCommentedItem(IParagraphItem)
Adds the paragraph item to the commented items.
Declaration
public void AddCommentedItem(IParagraphItem paraItem)
Parameters
Type | Name | Description |
---|---|---|
IParagraphItem | paraItem | The paragraph item. |
CloneImpl()
Creates a duplicate copy of the entity.
Declaration
protected override object CloneImpl()
Returns
Type | Description |
---|---|
System.Object | An System.Object reference to the newly created instance. |
Overrides
CreateLayoutInfo()
Creates the layout info.
Declaration
protected override void CreateLayoutInfo()
Overrides
InitXDLSHolder()
Initialize the XDLS holder.
Declaration
protected override void InitXDLSHolder()
Overrides
RemoveCommentedItems()
Removes the items in the comment.
Declaration
public void RemoveCommentedItems()
ReplaceCommentedItems(TextBodyPart)
Replaces the commented items with specified TextBodyPart.
Declaration
public void ReplaceCommentedItems(TextBodyPart textBodyPart)
Parameters
Type | Name | Description |
---|---|---|
TextBodyPart | textBodyPart | The text body part. |
ReplaceCommentedItems(String)
Replace the contents of the comment with the specified text.
Declaration
public void ReplaceCommentedItems(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The string that specifies the text to replace. |
WriteXmlAttributes(IXDLSAttributeWriter)
Writes object data as xml attributes.
Declaration
protected override void WriteXmlAttributes(IXDLSAttributeWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IXDLSAttributeWriter | writer | The IXDLSAttributeWriter object. |