Share via


CommentReference Class

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

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Wordprocessing.MarkupType
        DocumentFormat.OpenXml.Wordprocessing.CommentReference

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

Syntax

'Declaration
Public Class CommentReference _
    Inherits MarkupType
'Usage
Dim instance As CommentReference
public class CommentReference : MarkupType

Remarks

[ISO/IEC 29500-1 1st Edition]

17.13.1.5 commentReference (Comment Content Reference Mark)

This element specifies the presence of a comment content reference mark, which links the comment content (§17.13.4.2) with the contents of a document story. This link is established by matching the comment whose id attribute matches the id attribute on this element. The resulting comment is anchored to the range with comment range elements with the same id attribute values (if present) as follows:

  • If both of the commentRangeStart and commentRangeEnd elements (§17.13.4.4; §17.13.4.3) are present, then the comment reference shall anchor the comment to the resulting range.

  • If only one of the commentRangeStart and commentRangeEnd elements (§17.13.4.4; §17.13.4.3) is present, then the document is non-conformant.

  • If neither element is present, then the comment reference shall anchor the comment to its current location.

If this element appears in a comment content story (§17.13.4.2), then it can be ignored. If no comment exists with an id attribute which matches the id attribute on this element, then this document is non-conformant.

[Example: Consider a paragraph in a WordprocessingML document whose second word is annotated with a comment:

DocumentFormat.OpenXml.Wordprocessing.CommentRefer

The WordprocessingML fragment for this comment is defined as follows:

<w:p>
<w:r>
<w:t xml:space="preserve">Some </w:t>
</w:r>
<w:commentRangeStart w:id="0" />
<w:r>
<w:t>text.</w:t>
</w:r>
<w:commentRangeEnd w:id="0" />
<w:r>
<w:commentReference w:id="0" />
</w:r>
</w:p>

The commentReference element specifies that the associated comment in the comments part must be the comment whose id attribute value is 0. As well, since a start and end marker exist with a matching ID, this comment is anchored to that region of the document. end example]

Parent Elements

r (§22.1.2.87); r (§17.3.2.25)

Attributes

Description

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).

[Note: The W3C XML Schema definition of this element’s content model (CT_Markup) 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

CommentReference Members

DocumentFormat.OpenXml.Wordprocessing Namespace