CreateHyperlink

function CreateHyperlink(
  sLink: string = null,
  sDisplay: string = null,
  sScreenTipText: string = null,
): ApiHyperlink

Description

Creates a new hyperlink text block to be inserted to the current paragraph or table.

Parameters

sLinkstringdefault: null

The hyperlink address.

sDisplaystringdefault: null

The text to display the hyperlink.

sScreenTipTextstringdefault: null

The screen tip text.

Returns

ApiHyperlink

Try It

var oDocument = Api.GetDocument();
var oHyperlink = Api.CreateHyperlink("https://api.onlyoffice.com/", "ONLYOFFICE Document Builder", "ONLYOFFICE for developers");
var sType = oHyperlink.GetClassType();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddElement(oHyperlink, 0);
oParagraph.AddLineBreak();
oParagraph.AddText("Class type of the created object: " + sType);

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).