Comment Class

Comment Content.When the object is serialized out as xml, its qualified name is w:comment.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Wordprocessing.Comment

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(CustomXmlBlock))> _
<ChildElementInfoAttribute(GetType(AltChunk))> _
<ChildElementInfoAttribute(GetType(SdtBlock))> _
<ChildElementInfoAttribute(GetType(Paragraph))> _
<ChildElementInfoAttribute(GetType(Table))> _
<ChildElementInfoAttribute(GetType(ProofError))> _
<ChildElementInfoAttribute(GetType(PermStart))> _
<ChildElementInfoAttribute(GetType(PermEnd))> _
<ChildElementInfoAttribute(GetType(BookmarkStart))> _
<ChildElementInfoAttribute(GetType(BookmarkEnd))> _
<ChildElementInfoAttribute(GetType(CommentRangeStart))> _
<ChildElementInfoAttribute(GetType(CommentRangeEnd))> _
Public Class Comment _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As Comment
[ChildElementInfoAttribute(typeof(CustomXmlBlock))]
[ChildElementInfoAttribute(typeof(AltChunk))]
[ChildElementInfoAttribute(typeof(SdtBlock))]
[ChildElementInfoAttribute(typeof(Paragraph))]
[ChildElementInfoAttribute(typeof(Table))]
[ChildElementInfoAttribute(typeof(ProofError))]
[ChildElementInfoAttribute(typeof(PermStart))]
[ChildElementInfoAttribute(typeof(PermEnd))]
[ChildElementInfoAttribute(typeof(BookmarkStart))]
[ChildElementInfoAttribute(typeof(BookmarkEnd))]
[ChildElementInfoAttribute(typeof(CommentRangeStart))]
[ChildElementInfoAttribute(typeof(CommentRangeEnd))]
public class Comment : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • AltChunk <w:altChunk>

  • CustomXmlBlock <w:customXml>

  • SdtBlock <w:sdt>

  • Paragraph <w:p>

  • Table <w:tbl>

  • ProofError <w:proofErr>

  • PermStart <w:permStart>

  • PermEnd <w:permEnd>

  • BookmarkStart <w:bookmarkStart>

  • BookmarkEnd <w:bookmarkEnd>

  • CommentRangeStart <w:commentRangeStart>

  • CommentRangeEnd <w:commentRangeEnd>

[ISO/IEC 29500-1 1st Edition]

17.13.1.2 comment (Comment Content)

This element specifies the content of a single comment stored in the Comments part of a WordprocessingML document.

If a comment is not referenced by document content via a matching id attribute on a correct use of the commentReference element (§17.13.4.5), as defined by the WordprocessingML schema, then it can be ignored when loading the document. If more than one comment shares the same value for the id attribute, then only one comment shall be loaded and the others can be ignored.

[Example: Consider a document with text with an annotated comment as follows:

DocumentFormat.OpenXml.Wordprocessing.Comment-imag

This comment is represented as the following WordprocessingML fragment:

<w:comment w:id="1" w:initials="User" w:author="Dan Battagin">
  …
</w:comment>

The comment element specifies the presence of a single comment within the comments part. end example]

Parent Elements

comments (§17.13.4.6)

Child Elements

Subclause

altChunk (Anchor for Imported External Content)

§17.17.2.1

bookmarkEnd (Bookmark End)

§17.13.6.1

bookmarkStart (Bookmark Start)

§17.13.6.2

commentRangeEnd (Comment Anchor Range End)

§17.13.4.3

commentRangeStart (Comment Anchor Range Start)

§17.13.4.4

customXml (Block-Level Custom XML Element)

§17.5.1.6

customXmlDelRangeEnd (Custom XML Markup Deletion End)

§17.13.5.4

customXmlDelRangeStart (Custom XML Markup Deletion Start)

§17.13.5.5

customXmlInsRangeEnd (Custom XML Markup Insertion End)

§17.13.5.6

customXmlInsRangeStart (Custom XML Markup Insertion Start)

§17.13.5.7

customXmlMoveFromRangeEnd (Custom XML Markup Move Source End)

§17.13.5.8

customXmlMoveFromRangeStart (Custom XML Markup Move Source Start)

§17.13.5.9

customXmlMoveToRangeEnd (Custom XML Markup Move Destination Location End)

§17.13.5.10

customXmlMoveToRangeStart (Custom XML Markup Move Destination Location Start)

§17.13.5.11

del (Deleted Run Content)

§17.13.5.14

ins (Inserted Run Content)

§17.13.5.18

moveFrom (Move Source Run Content)

§17.13.5.22

moveFromRangeEnd (Move Source Location Container - End)

§17.13.5.23

moveFromRangeStart (Move Source Location Container - Start)

§17.13.5.24

moveTo (Move Destination Run Content)

§17.13.5.25

moveToRangeEnd (Move Destination Location Container - End)

§17.13.5.27

moveToRangeStart (Move Destination Location Container - Start)

§17.13.5.28

oMath (Office Math)

§22.1.2.77

oMathPara (Office Math Paragraph)

§22.1.2.78

p (Paragraph)

§17.3.1.22

permEnd (Range Permission End)

§17.13.7.1

permStart (Range Permission Start)

§17.13.7.2

proofErr (Proofing Error Anchor)

§17.13.8.1

sdt (Block-Level Structured Document Tag)

§17.5.2.29

tbl (Table)

§17.4.38

Attributes

Description

author (Annotation Author)

Specifies the author for an annotation within a WordprocessingML document.

If this attribute is omitted, then no author shall be associated with the parent annotation type.

[Example: Consider a comment represented using the following WordprocessingML fragment:

<… w:id="1" w:author="Example Author">

</…>

The author attribute specifies that the author of the current annotation is Example Author, which can be used as desired. end example]

The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13).

date (Annotation Date)

Specifies the date information for an annotation within a WordprocessingML document. The use of this information is outside of the scope of ISO/IEC 29500

If this attribute is omitted, then no date information shall be associated with the parent annotation type.

[Example: Consider a comment represented using the following WordprocessingML fragment:

<… w:id="1" w:date="2006-01-01T10:00:00">

</…>

The date attribute specifies that the date of the current annotation is January 1st 2006 at 10:00 AM, which can be used as desired. end example]

The possible values for this attribute are defined by the ST_DateTime simple type (§17.18.9).

id (Annotation Identifier)

Specifies a unique identifier for an annotation within a WordprocessingML document. The restrictions on the id attribute, if any, are defined by the parent XML element.

If this attribute is omitted, then the document is non-conformant.

[Example: Consider an annotation represented using the following WordprocessingML fragment:

<… w:id="1" … >

</…>

The id attribute specifies that the ID of the current annotation is 1. This value is used to uniquely identify this annotation within the document content. end example]

The possible values for this attribute are defined by the ST_DecimalNumber simple type (§17.18.10).

initials (Initials of Comment Author)

Specifies the initials of the author of the current comment. [Note: This information can be used to format and present the associated comment information block (§17.13.4.1), or in any user interface supported by an application. If there is more than one author with the same initials, it might be more useful to display the author name. end note]

If this attribute is omitted, then no author shall be associated with the current comment in the document.

[Example: Consider a comment represented using the following WordprocessingML fragment:

<w:comment w:id="1" w:initials="KB" w:name="Krista Bendig">

</w:comment>

The intials attribute specifies that the initials of the author of the current comment are KB, which can be used as desired. end example]

The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13).

[Note: The W3C XML Schema definition of this element’s content model (CT_Comment) is located in §A.1. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Comment Members

DocumentFormat.OpenXml.Wordprocessing Namespace