Поделиться через


Hyperlink Class

Defines the Hyperlink Class.When the object is serialized out as xml, its qualified name is w:hyperlink.

Inheritance Hierarchy

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

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

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(BookmarkStart))> _
<ChildElementInfoAttribute(GetType(CustomXmlRun))> _
<ChildElementInfoAttribute(GetType(SimpleField))> _
<ChildElementInfoAttribute(GetType(Hyperlink))> _
<ChildElementInfoAttribute(GetType(SmartTagRun))> _
<ChildElementInfoAttribute(GetType(SdtRun))> _
<ChildElementInfoAttribute(GetType(ProofError))> _
<ChildElementInfoAttribute(GetType(PermStart))> _
<ChildElementInfoAttribute(GetType(PermEnd))> _
<ChildElementInfoAttribute(GetType(BookmarkEnd))> _
<ChildElementInfoAttribute(GetType(CommentRangeStart))> _
<ChildElementInfoAttribute(GetType(CommentRangeEnd))> _
<ChildElementInfoAttribute(GetType(MoveFromRangeStart))> _
<ChildElementInfoAttribute(GetType(MoveFromRangeEnd))> _
<ChildElementInfoAttribute(GetType(MoveToRangeStart))> _
<ChildElementInfoAttribute(GetType(MoveToRangeEnd))> _
<ChildElementInfoAttribute(GetType(CustomXmlInsRangeStart))> _
<ChildElementInfoAttribute(GetType(CustomXmlInsRangeEnd))> _
<ChildElementInfoAttribute(GetType(CustomXmlDelRangeStart))> _
<ChildElementInfoAttribute(GetType(CustomXmlDelRangeEnd))> _
<ChildElementInfoAttribute(GetType(CustomXmlMoveFromRangeStart))> _
<ChildElementInfoAttribute(GetType(CustomXmlMoveFromRangeEnd))> _
<ChildElementInfoAttribute(GetType(CustomXmlMoveToRangeStart))> _
<ChildElementInfoAttribute(GetType(CustomXmlMoveToRangeEnd))> _
<ChildElementInfoAttribute(GetType(CustomXmlConflictInsertionRangeStart), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(CustomXmlConflictInsertionRangeEnd), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(CustomXmlConflictDeletionRangeStart), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(CustomXmlConflictDeletionRangeEnd), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(InsertedRun))> _
<ChildElementInfoAttribute(GetType(DeletedRun))> _
<ChildElementInfoAttribute(GetType(MoveFromRun))> _
<ChildElementInfoAttribute(GetType(MoveToRun))> _
<ChildElementInfoAttribute(GetType(ContentPart), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(RunConflictInsertion), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(RunConflictDeletion), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(Paragraph))> _
<ChildElementInfoAttribute(GetType(OfficeMath))> _
<ChildElementInfoAttribute(GetType(Accent))> _
<ChildElementInfoAttribute(GetType(Bar))> _
<ChildElementInfoAttribute(GetType(Box))> _
<ChildElementInfoAttribute(GetType(BorderBox))> _
<ChildElementInfoAttribute(GetType(Delimiter))> _
<ChildElementInfoAttribute(GetType(EquationArray))> _
<ChildElementInfoAttribute(GetType(Fraction))> _
<ChildElementInfoAttribute(GetType(MathFunction))> _
<ChildElementInfoAttribute(GetType(GroupChar))> _
<ChildElementInfoAttribute(GetType(LimitLower))> _
<ChildElementInfoAttribute(GetType(LimitUpper))> _
<ChildElementInfoAttribute(GetType(Matrix))> _
<ChildElementInfoAttribute(GetType(Nary))> _
<ChildElementInfoAttribute(GetType(Phantom))> _
<ChildElementInfoAttribute(GetType(Radical))> _
<ChildElementInfoAttribute(GetType(PreSubSuper))> _
<ChildElementInfoAttribute(GetType(Subscript))> _
<ChildElementInfoAttribute(GetType(SubSuperscript))> _
<ChildElementInfoAttribute(GetType(Superscript))> _
<ChildElementInfoAttribute(GetType(Run))> _
<ChildElementInfoAttribute(GetType(Run))> _
<ChildElementInfoAttribute(GetType(BidirectionalOverride), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(BidirectionalEmbedding), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(SubDocumentReference))> _
Public Class Hyperlink _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As Hyperlink
[ChildElementInfoAttribute(typeof(BookmarkStart))]
[ChildElementInfoAttribute(typeof(CustomXmlRun))]
[ChildElementInfoAttribute(typeof(SimpleField))]
[ChildElementInfoAttribute(typeof(Hyperlink))]
[ChildElementInfoAttribute(typeof(SmartTagRun))]
[ChildElementInfoAttribute(typeof(SdtRun))]
[ChildElementInfoAttribute(typeof(ProofError))]
[ChildElementInfoAttribute(typeof(PermStart))]
[ChildElementInfoAttribute(typeof(PermEnd))]
[ChildElementInfoAttribute(typeof(BookmarkEnd))]
[ChildElementInfoAttribute(typeof(CommentRangeStart))]
[ChildElementInfoAttribute(typeof(CommentRangeEnd))]
[ChildElementInfoAttribute(typeof(MoveFromRangeStart))]
[ChildElementInfoAttribute(typeof(MoveFromRangeEnd))]
[ChildElementInfoAttribute(typeof(MoveToRangeStart))]
[ChildElementInfoAttribute(typeof(MoveToRangeEnd))]
[ChildElementInfoAttribute(typeof(CustomXmlInsRangeStart))]
[ChildElementInfoAttribute(typeof(CustomXmlInsRangeEnd))]
[ChildElementInfoAttribute(typeof(CustomXmlDelRangeStart))]
[ChildElementInfoAttribute(typeof(CustomXmlDelRangeEnd))]
[ChildElementInfoAttribute(typeof(CustomXmlMoveFromRangeStart))]
[ChildElementInfoAttribute(typeof(CustomXmlMoveFromRangeEnd))]
[ChildElementInfoAttribute(typeof(CustomXmlMoveToRangeStart))]
[ChildElementInfoAttribute(typeof(CustomXmlMoveToRangeEnd))]
[ChildElementInfoAttribute(typeof(CustomXmlConflictInsertionRangeStart), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(CustomXmlConflictInsertionRangeEnd), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(CustomXmlConflictDeletionRangeStart), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(CustomXmlConflictDeletionRangeEnd), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(InsertedRun))]
[ChildElementInfoAttribute(typeof(DeletedRun))]
[ChildElementInfoAttribute(typeof(MoveFromRun))]
[ChildElementInfoAttribute(typeof(MoveToRun))]
[ChildElementInfoAttribute(typeof(ContentPart), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(RunConflictInsertion), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(RunConflictDeletion), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(Paragraph))]
[ChildElementInfoAttribute(typeof(OfficeMath))]
[ChildElementInfoAttribute(typeof(Accent))]
[ChildElementInfoAttribute(typeof(Bar))]
[ChildElementInfoAttribute(typeof(Box))]
[ChildElementInfoAttribute(typeof(BorderBox))]
[ChildElementInfoAttribute(typeof(Delimiter))]
[ChildElementInfoAttribute(typeof(EquationArray))]
[ChildElementInfoAttribute(typeof(Fraction))]
[ChildElementInfoAttribute(typeof(MathFunction))]
[ChildElementInfoAttribute(typeof(GroupChar))]
[ChildElementInfoAttribute(typeof(LimitLower))]
[ChildElementInfoAttribute(typeof(LimitUpper))]
[ChildElementInfoAttribute(typeof(Matrix))]
[ChildElementInfoAttribute(typeof(Nary))]
[ChildElementInfoAttribute(typeof(Phantom))]
[ChildElementInfoAttribute(typeof(Radical))]
[ChildElementInfoAttribute(typeof(PreSubSuper))]
[ChildElementInfoAttribute(typeof(Subscript))]
[ChildElementInfoAttribute(typeof(SubSuperscript))]
[ChildElementInfoAttribute(typeof(Superscript))]
[ChildElementInfoAttribute(typeof(Run))]
[ChildElementInfoAttribute(typeof(Run))]
[ChildElementInfoAttribute(typeof(BidirectionalOverride), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(BidirectionalEmbedding), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(SubDocumentReference))]
public class Hyperlink : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • CustomXmlRun <w:customXml>

  • SimpleField <w:fldSimple>

  • Hyperlink <w:hyperlink>

  • SmartTagRun <w:smartTag>

  • SdtRun <w:sdt>

  • ProofError <w:proofErr>

  • PermStart <w:permStart>

  • PermEnd <w:permEnd>

  • BookmarkStart <w:bookmarkStart>

  • BookmarkEnd <w:bookmarkEnd>

  • CommentRangeStart <w:commentRangeStart>

  • CommentRangeEnd <w:commentRangeEnd>

  • MoveFromRangeStart <w:moveFromRangeStart>

  • MoveFromRangeEnd <w:moveFromRangeEnd>

  • MoveToRangeStart <w:moveToRangeStart>

  • MoveToRangeEnd <w:moveToRangeEnd>

  • CustomXmlInsRangeStart <w:customXmlInsRangeStart>

  • CustomXmlInsRangeEnd <w:customXmlInsRangeEnd>

  • CustomXmlDelRangeStart <w:customXmlDelRangeStart>

  • CustomXmlDelRangeEnd <w:customXmlDelRangeEnd>

  • CustomXmlMoveFromRangeStart <w:customXmlMoveFromRangeStart>

  • CustomXmlMoveFromRangeEnd <w:customXmlMoveFromRangeEnd>

  • CustomXmlMoveToRangeStart <w:customXmlMoveToRangeStart>

  • CustomXmlMoveToRangeEnd <w:customXmlMoveToRangeEnd>

  • DocumentFormat.OpenXml.Office2010.Word.CustomXmlConflictInsertionRangeStart <w14:customXmlConflictInsRangeStart>

  • DocumentFormat.OpenXml.Office2010.Word.CustomXmlConflictInsertionRangeEnd <w14:customXmlConflictInsRangeEnd>

  • DocumentFormat.OpenXml.Office2010.Word.CustomXmlConflictDeletionRangeStart <w14:customXmlConflictDelRangeStart>

  • DocumentFormat.OpenXml.Office2010.Word.CustomXmlConflictDeletionRangeEnd <w14:customXmlConflictDelRangeEnd>

  • InsertedRun <w:ins>

  • DeletedRun <w:del>

  • MoveFromRun <w:moveFrom>

  • MoveToRun <w:moveTo>

  • ContentPart <w:contentPart>

  • DocumentFormat.OpenXml.Office2010.Word.RunConflictInsertion <w14:conflictIns>

  • DocumentFormat.OpenXml.Office2010.Word.RunConflictDeletion <w14:conflictDel>

  • DocumentFormat.OpenXml.Math.Paragraph <m:oMathPara>

  • DocumentFormat.OpenXml.Math.OfficeMath <m:oMath>

  • DocumentFormat.OpenXml.Math.Accent <m:acc>

  • DocumentFormat.OpenXml.Math.Bar <m:bar>

  • DocumentFormat.OpenXml.Math.Box <m:box>

  • DocumentFormat.OpenXml.Math.BorderBox <m:borderBox>

  • DocumentFormat.OpenXml.Math.Delimiter <m:d>

  • DocumentFormat.OpenXml.Math.EquationArray <m:eqArr>

  • DocumentFormat.OpenXml.Math.Fraction <m:f>

  • DocumentFormat.OpenXml.Math.MathFunction <m:func>

  • DocumentFormat.OpenXml.Math.GroupChar <m:groupChr>

  • DocumentFormat.OpenXml.Math.LimitLower <m:limLow>

  • DocumentFormat.OpenXml.Math.LimitUpper <m:limUpp>

  • DocumentFormat.OpenXml.Math.Matrix <m:m>

  • DocumentFormat.OpenXml.Math.Nary <m:nary>

  • DocumentFormat.OpenXml.Math.Phantom <m:phant>

  • DocumentFormat.OpenXml.Math.Radical <m:rad>

  • DocumentFormat.OpenXml.Math.PreSubSuper <m:sPre>

  • DocumentFormat.OpenXml.Math.Subscript <m:sSub>

  • DocumentFormat.OpenXml.Math.SubSuperscript <m:sSubSup>

  • DocumentFormat.OpenXml.Math.Superscript <m:sSup>

  • DocumentFormat.OpenXml.Math.Run <m:r>

  • Run <w:r>

  • BidirectionalOverride <w:bdo>

  • BidirectionalEmbedding <w:dir>

  • SubDocumentReference <w:subDoc>

[ISO/IEC 29500-1 1st Edition]

17.16.17 hyperlink (Hyperlink)

This element specifies the presence of a hyperlink at the current location in the document.

[Example: Consider the following WordprocessingML fragment for a hyperlink:

<w:hyperlink r:id="rId10">
<w:r>
<w:t>Click here</w:t>
</w:r>
</w:hyperlink>

The hyperlink element defines a hyperlink whose display text is Click here, and whose target is specified by the relationship with an Id attribute value of rId10. end example]

Parent Elements

bdo (§17.3.2.3); customXml (§17.5.1.3); dir (§17.3.2.8); fldSimple (§17.16.19); hyperlink (§17.16.22); p (§17.3.1.22); sdtContent (§17.5.2.36); smartTag (§17.5.1.9)

Child Elements

Subclause

bdo (Bidirectional Override)

§17.3.2.3

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 (Inline-Level Custom XML Element)

§17.5.1.3

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

dir (Bidirectional Embedding Level)

§17.3.2.8

fldSimple (Simple Field)

§17.16.19

hyperlink (Hyperlink)

§17.16.22

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

permEnd (Range Permission End)

§17.13.7.1

permStart (Range Permission Start)

§17.13.7.2

proofErr (Proofing Error Anchor)

§17.13.8.1

r (Text Run)

§17.3.2.25

sdt (Inline-Level Structured Document Tag)

§17.5.2.31

smartTag (Inline-Level Smart Tag)

§17.5.1.9

subDoc (Anchor for Subdocument Location)

§17.17.1.1

Attributes

Description

anchor (Hyperlink Anchor)

Specifies the name of a bookmark in the current document which shall be the target of this hyperlink.

If this attribute is omitted, then the default behavior shall be to navigate to the start of the document. If a hyperlink target is also specified using the r:id attribute, then this attribute shall be ignored. If no bookmark exists in the current document with the given bookmark name, then the default behavior shall be to navigate to the start of the document.

[Example: Consider the following WordprocessingML fragment for a hyperlink:

<w:hyperlink w:anchor="chapter3">
<w:r>
<w:t>Go to Chapter Three</w:t>
</w:r>
</w:hyperlink>

The anchor attribute specifies that the target of the current hyperlink must be the text contained within the bookmark chapter3 within the document. end example]

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

docLocation (Location in Target Document)

Specifies a location in the target of the hyperlink that has no bookmarks. The method by which the contents of this attribute are linked to document text is outside the scope of ISO/IEC 29500.

If this attribute is omitted, then no location shall be associated with the parent hyperlink. If the anchor attribute is also specified, then this attribute can be ignored when the hyperlink is invoked.

[Example: Consider the following WordprocessingML fragment for a hyperlink:

<w:hyperlink r:id="rId9" w:docLocation="table">
<w:r>
<w:t>Click Here</w:t>
</w:r>
</w:hyperlink>

The docLocation attribute specifies that the target of the current hyperlink must be a region targeted by the string table within the target document. end example]

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

history (Add To Viewed Hyperlinks)

Specifies whether the target of the parent hyperlink (as specified via the r:id attribute) shall be added to a list of viewed hyperlinks when it is invoked.

If this attribute is omitted, then its value shall be assumed to be false.

[Example: Consider the following WordprocessingML fragment for a hyperlink:

<w:hyperlink r:id="rId9" w:history="true">
<w:r>
<w:t>http://www.example.com</w:t>
</w:r>
</w:hyperlink>

The history attribute value of true specifies that the target of the current hyperlink must be added to a list of visited hyperlinks when invoked within the document. end example]

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

id (Hyperlink Target)

Namespace: .../officeDocument/2006/relationships

Specifies the ID of the relationship whose target shall be used as the target for this hyperlink.

If this attribute is omitted, then there shall be no external hyperlink target for the current hyperlink - a location in the current document can still be target via the anchor attribute. If this attribute exists, it shall supersede the value in the anchor attribute.

[Example: Consider the following WordprocessingML fragment for a hyperlink:

<w:hyperlink r:id="rId9">
<w:r>
<w:t>http://www.example.com</w:t>
</w:r>
</w:hyperlink>

The id attribute value of rId9 specifies that relationship in the associated relationship part item with a corresponding Id attribute value must be navigated to when this hyperlink is invoked. For example, if the following XML is present in the associated relationship part item:

<Relationships xmlns="…">
<Relationship Id="rId9" Mode="External" Target=http://www.example.com />
</Relationships>

The target of this hyperlink would therefore be the target of relationship rId9 - in this case, http://www.example.com. end example]

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

tgtFrame (Hyperlink Target Frame)

Specifies a frame within the parent HTML frameset for the target of the parent hyperlink when one exists. All values specified by this element shall be handled as follows:

Value

Description

_top

Open hyperlink target in the full region of the current window.

_self

Open hyperlink target in the same frame as the hyperlink appears.

_parent

Open hyperlink target in the parent of the current frame, or the current frame if this frame has no parent.

_blank

Open hyperlink target in a new web browser window.

all other values

Open hyperlink target in the frame with the specified name. If no frame exists with this name, open in the current frame.

If this string does not begin with an alphabetic character, it shall be ignored.

If this attribute is omitted, then no target frame information shall be associated with the parent hyperlink. If the current document is not part of a frameset, then this information can be ignored.

[Example: Consider the following WordprocessingML fragment for a hyperlink:

<w:hyperlink r:id="rId9" w:tgtFrame="_top">
<w:r>
<w:t>http://example.com</w:t>
</w:r>
</w:hyperlink>

The tgtFrame attribute value of _top specifies that the target of this hyperlink must be displayed in the full extents of the current window. end example]

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

tooltip (Associated String)

Specifies a string which can be surfaced in a user interface as associated with the parent hyperlink. The method by which this string is surfaced by an application is outside the scope of ISO/IEC 29500.

If this attribute is omitted, then no associated string shall be linked to the parent hyperlink in the document.

[Example: Consider the following WordprocessingML fragment for a hyperlink:

<w:hyperlink r:id="rId9" w:tooltip="Click here!">
<w:r>
<w:t>http://example.com</w:t>
</w:r>
</w:hyperlink>

The tooltip attribute value specifies that the parent hyperlink has the associated string of Click here!, 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_Hyperlink) 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

Hyperlink Members

DocumentFormat.OpenXml.Wordprocessing Namespace