Get Started
Usage API
More information

AddHyperlink

Add a hyperlink to a run.

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);
oRun = Api.CreateRun();
oRun.AddText("ONLYOFFICE Document Builder");
oParagraph.AddElement(oRun);
oRun.AddHyperlink("https://www.onlyoffice.com", "main page");
builder.SaveFile("docx", "AddHyperlink.docx");
builder.CloseFile();

Resulting document