Get Started
Usage API
More information

ApiHyperlink

Class representing a Paragraph hyperlink.

Methods

Name Description
GetClassType

Get the type of this class.

GetDisplayedText

Get the hyperlink display text.

GetElement

Get the hyperlink element using the position specified.

GetElementsCount

Get the number of elements in the current hyperlink.

GetLinkedText

Get the hyperlink address.

GetRange

Return a Range object that represents the document part contained in the specified hyperlink.

GetScreenTipText

Get the screen tip text of the hyperlink.

SetDefaultStyle

Set default hyperlink style.

SetDisplayedText

Set the hyperlink display text.

SetLink

Set the hyperlink address.

SetScreenTipText

Set the screen tip text of the hyperlink.

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oRun = Api.CreateRun();
oRun.AddText("Api ONLYOFFICE DocBuilder");
oParagraph.AddElement(oRun);
oHyperlink = oParagraph.AddHyperlink("https://api.onlyoffice.com/");
oHyperlink.SetLink("https://api.onlyoffice.com/docbuilder/basic");
oHyperlink.SetScreenTipText("ONLYOFFICE for developers");
oHyperlink.SetDisplayedText("ONLYOFFICE Document Builder");
oLinkedText = oHyperlink.GetLinkedText();
oScreenTipText = oHyperlink.GetScreenTipText();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Linked text: " + oLinkedText);
oParagraph.AddLineBreak();
oParagraph.AddText("Screen tip text: " + oScreenTipText);
oDocument.Push(oParagraph);
oRange = oHyperlink.GetRange(0, 9);
oRange.SetBold(true);
builder.SaveFile("docx", "ApiHyperlink .docx");
builder.CloseFile();

Resulting document