CreateHyperlink
Creates a new hyperlink text block to be inserted to the current paragraph or table.
Parameters:
Name |
Type |
Description |
sLink |
string
|
The hyperlink address. |
sDisplay |
string
|
The text to display the hyperlink. |
sScreenTipText |
string
|
The screen tip text. |
Returns:
- Type
-
ApiHyperlink
Example
Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oHyperlink = Api.CreateHyperlink("https://api.onlyoffice.com/", "ONLYOFFICE Document Builder", "ONLYOFFICE for developers");
var sType = oHyperlink.GetClassType();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddElement(oHyperlink, 0);
oParagraph.AddLineBreak();
oParagraph.AddText("Class type of the created object: " + sType);
builder.SaveFile("docx", "CreateHyperlink.docx");
builder.CloseFile();
Resulting document