API Reference
WordHyperLink
Represents a hyperlink element within a Word document. Provides helper methods for modifying hyperlink text, formatting, and target information.
Inheritance
- WordElement
- WordHyperLink
Constructors
public WordHyperLink(WordDocument document, Paragraph paragraph, Hyperlink hyperlink) #Initializes a new instance of the WordHyperLink class.
Parameters
- document OfficeIMO.Word.WordDocument
- paragraph DocumentFormat.OpenXml.Wordprocessing.Paragraph
- hyperlink DocumentFormat.OpenXml.Wordprocessing.Hyperlink
Methods
public static WordParagraph AddHyperLink(WordParagraph paragraph, IEnumerable<WordParagraph> runs, Uri uri, Boolean addStyle = false, String tooltip = "", Boolean history = true) #WordParagraphAdds a hyperlink pointing to the specified anchor within the document.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- text System.String
- anchor System.String
- addStyle System.Boolean = false
- tooltip System.String = ""
- history System.Boolean = true
AddHyperLink(OfficeIMO.Word.WordParagraph paragraph, System.Collections.Generic.IEnumerable{OfficeIMO.Word.WordParagraph} runs, System.String anchor, System.Boolean addStyle, System.String tooltip, System.Boolean history) #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 System.String
- addStyle System.Boolean
- tooltip System.String
- history System.Boolean
AddHyperLink(OfficeIMO.Word.WordParagraph paragraph, System.String text, System.Uri uri, System.Boolean addStyle, System.String tooltip, System.Boolean history) #Adds a hyperlink pointing to an external URI.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- text System.String
- uri System.Uri
- addStyle System.Boolean
- tooltip System.String
- history System.Boolean
AddHyperLink(OfficeIMO.Word.WordParagraph paragraph, System.Collections.Generic.IEnumerable{OfficeIMO.Word.WordParagraph} runs, System.Uri uri, System.Boolean addStyle, System.String tooltip, System.Boolean history) #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 System.Boolean
- tooltip System.String
- history System.Boolean
public Void CopyFormattingFrom(WordHyperLink reference) #VoidCopies 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) #WordHyperLinkCreates a hyperlink inserted after the reference link while copying the reference formatting.
Parameters
- reference OfficeIMO.Word.WordHyperLink
- Existing hyperlink used for formatting.
- newText System.String
- Text for the new hyperlink.
- newUri System.Uri
- Destination of the new hyperlink.
Returns
Newly created hyperlink.
public static WordHyperLink DuplicateHyperlink(WordHyperLink reference) #WordHyperLinkCreates a copy of the given hyperlink and inserts it after the source link.
Parameters
- reference OfficeIMO.Word.WordHyperLink
- Hyperlink to duplicate.
Returns
The duplicated hyperlink.
public WordHyperLink InsertFormattedHyperlinkAfter(String newText, Uri newUri) #WordHyperLinkInserts a hyperlink after this hyperlink and copies this link's formatting.
Parameters
- newText System.String
- Text for the new hyperlink.
- newUri System.Uri
- Destination of the new hyperlink.
Returns
The inserted hyperlink.
public WordHyperLink InsertFormattedHyperlinkBefore(String newText, Uri newUri) #WordHyperLinkInserts a hyperlink before this hyperlink and copies this link's formatting.
Parameters
- newText System.String
- Text for the new hyperlink.
- newUri System.Uri
- Destination of the new hyperlink.
Returns
The inserted hyperlink.
public Void Remove(Boolean includingParagraph = true) #VoidRemoves hyperlink. When specified to remove paragraph it will only do so, if paragraph is empty or contains only paragraph properties.
Parameters
- includingParagraph System.Boolean = true
public Void RemoveHyperLink(Boolean includingParagraph = true) #VoidRemoves 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 System.Boolean = true
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public Uri Uri { get; set; } #Gets or sets the URI of the 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 Boolean 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 Boolean 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 Nullable<TargetFrame> TargetFrame { get; set; } #Gets or sets the target frame for the hyperlink.
public Boolean IsHttp { get; } #Gets a value indicating whether the hyperlink uses the HTTP or HTTPS scheme.
public String Scheme { get; } #Gets the scheme component of the hyperlink URI.
public String Text { get; set; } #Gets or sets the display text for the hyperlink.