Method AppendHyperlink
AppendHyperlink(Paragraph, string, string, CharacterFormat?, string?)
Appends a hyperlink to an external target: a start marker, one text run and an end marker, plus the external package relationship the target needs.
public static HyperlinkStart AppendHyperlink(this Paragraph paragraph, string text, string target, CharacterFormat? format = null, string? tooltip = null)
Parameters
paragraphParagraphThe paragraph. It must belong to a document, because the relationship is document-level state.
textstringThe link text.
targetstringThe target URI.
formatCharacterFormatThe run formatting of the link text, or null. Applying the "Hyperlink" character style is the caller's choice, not an implied default.
tooltipstringThe tooltip text, or null.
Returns
- HyperlinkStart
The appended hyperlink start marker.
Exceptions
- ArgumentNullException
A required argument is null.
- InvalidOperationException
The paragraph is not attached to a document.