Get Started
Usage API
More information

AddHyperlink

Add a hyperlink to the specified range.

Parameters:

Name Type Description
sLink string

The link address.

sScreenTipText string

The screen tip 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