Get Started
Documentation

AddHyperlink

Add a hyperlink to a range.

Parameters:

Name Type Description
sLink string

link to be add.

sScreenTipText string

ScreenTip text

Returns:

Type
ApiHyperlink | null

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("ONLYOFFICE Document Builder");
oRange = oDocument.GetRange(0, 9);
oRange.AddHyperlink("https://www.onlyoffice.com/", "Main portal"); 
builder.SaveFile("docx", "AddHyperlinkRange.docx");
builder.CloseFile();

Resulting document