WordHyperLink
OfficeIMO.Word
Represents a hyperlink element within a Word document. Provides helper methods for modifying hyperlink text, formatting, and target information.
Inheritance
- WordElement
- WordHyperLink
Usage
Explore 21 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 18
- Method WordDocument.AddHyperLink
- Property WordDocument.HyperLinks
- Method WordFooter.AddHyperLink
- Property WordFooter.HyperLinks
- Method WordHeader.AddHyperLink
- Property WordHeader.HyperLinks
- Method WordHeaderFooter.AddHyperLink
- Property WordHeaderFooter.HyperLinks
- Method WordHyperLink.AddHyperLink
- Method WordHyperLink.CreateFormattedHyperlink
- Method WordHyperLink.DuplicateHyperlink
- Method WordHyperLink.InsertFormattedHyperlinkAfter
- Method WordHyperLink.InsertFormattedHyperlinkBefore
- Method WordParagraph.AddHyperLink
- Property WordParagraph.Hyperlink
- Method WordRange.AddHyperLink
- Method WordSection.AddHyperLink
- Property WordSection.HyperLinks
Accepted by parameters 3
Methods
public static WordHyperLink AddHyperLink(WordParagraph paragraph, string text, string anchor, bool addStyle = false, string tooltip = "", bool history = true) #Adds a hyperlink pointing to the specified anchor within the document.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- text string
- anchor string
- addStyle bool = false
- tooltip string = ""
- history bool = true
Returns
WordHyperLinkpublic static WordHyperLink AddHyperLink(WordParagraph paragraph, IEnumerable<WordParagraph> runs, string anchor, bool addStyle = false, string tooltip = "", bool history = true) #Adds a hyperlink pointing to the specified anchor within the document using existing runs.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- runs System.Collections.Generic.IEnumerable<OfficeIMO.Word.WordParagraph>
- anchor string
- addStyle bool = false
- tooltip string = ""
- history bool = true
Returns
WordHyperLinkpublic static WordHyperLink AddHyperLink(WordParagraph paragraph, string text, Uri uri, bool addStyle = false, string tooltip = "", bool history = true) #Adds a hyperlink pointing to an external URI.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- text string
- uri System.Uri
- addStyle bool = false
- tooltip string = ""
- history bool = true
Returns
WordHyperLinkpublic static WordHyperLink AddHyperLink(WordParagraph paragraph, IEnumerable<WordParagraph> runs, Uri uri, bool addStyle = false, string tooltip = "", bool history = true) #Adds a hyperlink pointing to an external URI using existing runs.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- runs System.Collections.Generic.IEnumerable<OfficeIMO.Word.WordParagraph>
- uri System.Uri
- addStyle bool = false
- tooltip string = ""
- history bool = true
Returns
WordHyperLinkpublic void CopyFormattingFrom(WordHyperLink reference) #Copies run formatting from another hyperlink to this hyperlink.
Parameters
- reference OfficeIMO.Word.WordHyperLink
- Hyperlink to copy formatting from.
public static WordHyperLink CreateFormattedHyperlink(WordHyperLink reference, string newText, Uri newUri) #Creates a hyperlink inserted after the reference link while copying the reference formatting.
Parameters
- reference OfficeIMO.Word.WordHyperLink
- Existing hyperlink used for formatting.
- newText string
- Text for the new hyperlink.
- newUri System.Uri
- Destination of the new hyperlink.
public static WordHyperLink DuplicateHyperlink(WordHyperLink reference) #Creates a copy of the given hyperlink and inserts it after the source link.
Parameters
- reference OfficeIMO.Word.WordHyperLink
- Hyperlink to duplicate.
public WordHyperLink InsertFormattedHyperlinkAfter(string newText, Uri newUri) #Inserts a hyperlink after this hyperlink and copies this link's formatting.
Parameters
- newText string
- Text for the new hyperlink.
- newUri System.Uri
- Destination of the new hyperlink.
public WordHyperLink InsertFormattedHyperlinkBefore(string newText, Uri newUri) #Inserts a hyperlink before this hyperlink and copies this link's formatting.
Parameters
- newText string
- Text for the new hyperlink.
- newUri System.Uri
- Destination of the new hyperlink.
public void Remove(bool includingParagraph = true) #Removes hyperlink. When specified to remove paragraph it will only do so, if paragraph is empty or contains only paragraph properties.
Parameters
- includingParagraph bool = true
public void RemoveHyperLink(bool includingParagraph = true) #Removes hyperlink and detaches related relationship. When specified to remove paragraph it will only do so if paragraph is empty or contains only paragraph properties.
Parameters
- includingParagraph bool = true
Inherited Methods
Properties
public WordParagraph Paragraph { get; } #Gets the paragraph containing this hyperlink.
public IReadOnlyList<WordParagraph> Runs { get; } #Gets editable formatted text runs belonging to this hyperlink.
public string? Id { get; set; } #Specifies a location in the target of the hyperlink, in the case in which the link is an external link.
public bool IsEmail { get; } #Indicates whether the hyperlink uses the mailto scheme.
public string EmailAddress { get; } #Gets the email address if the hyperlink is a mailto link.
public bool History { get; set; } #Gets or sets whether the hyperlink is marked as visited.
public string? DocLocation { get; set; } #Specifies a location in the target of the hyperlink, in the case in which the link is an external link.
public string? Anchor { get; set; } #Specifies the name of a bookmark within the document. See Bookmark. If the attribute is omitted, then the default behavior is to navigate to the start of the document. If the r:id attribute is specified, then the anchor attribute is ignored.
public string? Tooltip { get; set; } #Gets or sets the tooltip displayed when hovering over the hyperlink.
public WordHyperlinkTargetFrame? TargetFrame { get; set; } #Gets or sets the target frame for the hyperlink.
public bool IsHttp { get; } #Gets a value indicating whether the hyperlink uses the HTTP or HTTPS scheme.
public string Text { get; set; } #Gets or sets the display text for the hyperlink.