Comment Class

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

Inheritance Hierarchy

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

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

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(CommentProperties), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(CommentText))> _
Public Class Comment _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As Comment
[ChildElementInfoAttribute(typeof(CommentProperties), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(CommentText))]
public class Comment : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • CommentText <x:text>

  • CommentProperties <x:commentPr>

[ISO/IEC 29500-1 1st Edition]

18.7.3 comment (Comment)

This element represents a single user entered comment. Each comment shall have an author and can optionally contain richly formatted text.

Parent Elements

commentList (§18.7.4)

Child Elements

Subclause

commentPr (Comment Properties)

§18.7.5

text (Comment Text)

§18.7.7

Attributes

Description

authorId (Author Id)

Required. An unsigned integer which is used as the zero based index into the list of authors for this set of comments.

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.

guid (Unique Identifier for Comment)

Unique identifier for this comment. The attribute is required and shall be unique across all comments in shared workbooks.

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

ref (Cell Reference)

Required. A string that serves as the A1 style reference to the cell that the comment is associated with. Shall only reference a single cell, not a range of cells, since comments are on a per cell basis.

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

shapeId (Shape ID)

Specifies the ID of the DrawingML shape that provides the visual representation of the comment.

[Example:

<comment shapeId="10 "  >

end example]

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.

[Note: The W3C XML Schema definition of this element’s content model (CT_Comment) is located in §A.2. 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.Spreadsheet Namespace