CreateHyperlink
Creates a new hyperlink text block to be inserted to the current paragraph or table.
Syntax
expression.CreateHyperlink(link, display, screenTipText);
expression - A variable that represents a Api class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| link | Required | string | The hyperlink address. | |
| display | Required | string | The text to display the hyperlink. | |
| screenTipText | Required | string | The screen tip text. |
Returns
Example
Insert a clickable hyperlink with custom display text into a document.
// How do I add a hyperlink with a tooltip to a paragraph in a document?
// Embed a named web link that shows a tooltip when hovered, then read back its type in a document.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let hyperlink = Api.CreateHyperlink("https://api.onlyoffice.com/", "ONLYOFFICE Document Builder", "ONLYOFFICE for developers");
paragraph.AddElement(hyperlink, 0);
paragraph.AddLineBreak();
paragraph.AddText("Class type of the created object: " + hyperlink.GetClassType());