Class WComment
Represents a comment in the Word document.
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Portable.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 |
---|
WCommentFormat |
m_textBody
Represents the text body of comment.
Declaration
protected WTextBody m_textBody
Field Value
Type |
---|
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 |
---|
WCommentMark |
CommentRangeStart
Declaration
public WCommentMark CommentRangeStart { get; }
Property Value
Type |
---|
WCommentMark |
Done
Gets a value indicating whether the comment is resolved or not. The default value is false.
Declaration
public bool Done { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the comment is resolved; otherwise, false. |
Remarks
This property is only applicable for DOCX format documents.
Examples
// Load an existing Word document into DocIO instance
using (WordDocument document = new WordDocument("Template.docx"))
{
// Checks whether the comment is resolved or not
bool done = document.Comments[0].Done;
// Saves the Word document
document.Save("Sample.docx", FormatType.Docx);
}
'Load an existing Word document into DocIO instance
Dim document As WordDocument = New WordDocument("Template.docx")
'Checks whether the comment is resolved or not
Dim done As Boolean = document.Comments(0).Done
'Save and Close the Word document
document.Save("Sample.docx", FormatType.Docx)
document.Close()
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. |