TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

ApiHyperlink

Class representing a Paragraph hyperlink.

Methods

Name Description
GetClassType

Returns a type of the ApiHyperlink class.

GetDisplayedText

Returns the hyperlink display text.

GetElement

Returns the hyperlink element using the position specified.

GetElementsCount

Returns a number of elements in the current hyperlink.

GetLinkedText

Returns the hyperlink address.

GetRange

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

GetScreenTipText

Returns the screen tip text of the hyperlink.

SetDefaultStyle

Sets the default hyperlink style.

SetDisplayedText

Sets the hyperlink display text.

SetLink

Sets the hyperlink address.

SetScreenTipText

Sets the screen tip text of the hyperlink.

ToJSON

Converts the ApiHyperlink object into the JSON object.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oRun = Api.CreateRun();
oRun.AddText("Api ONLYOFFICE DocBuilder");
oParagraph.AddElement(oRun);
var 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");
var oLinkedText = oHyperlink.GetLinkedText();
var oScreenTipText = oHyperlink.GetScreenTipText();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Linked text: " + oLinkedText);
oParagraph.AddLineBreak();
oParagraph.AddText("Screen tip text: " + oScreenTipText);
oDocument.Push(oParagraph);
var oRange = oHyperlink.GetRange(0, 9);
oRange.SetBold(true);
builder.SaveFile("docx", "ApiHyperlink .docx");
builder.CloseFile();

Resulting document