Get Started
Usage API

ApiHyperlink

Class representing a hyperlink of Paragraph

Methods

Name Description
GetClassType

Get the type of this class.

GetDisplayedText

Gets the displayed text of the hyperlink.

GetElement

Get the element of the hyperlink using the position specified.

GetElementsCount

Get the number of elements in the current hyperlink.

GetLinkedText

Gets the link text of the hyperlink.

GetRange

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

GetScreenTipText

Gets the ScreenTip text of the hyperlink.

SetDefaultStyle

Sets default hyperlink style.

SetDisplayedText

Sets the display text of the hyperlink.

SetLink

Sets the hyperlink address.

SetScreenTipText

Sets 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("http://api.teamlab.info/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