GetElementsCount
function GetElementsCount(): number
Description
Returns a number of elements in the current hyperlink.
Returns
number
Try It
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oRun1 = Api.CreateRun();
oRun1.AddText("Api Document Builder.");
oParagraph.AddElement(oRun1, 0);
var oRun2 = Api.CreateRun();
oRun2.AddText(" ONLYOFFICE for developers");
oParagraph.AddElement(oRun2, 1);
var oHyperlink = oParagraph.AddHyperlink("https://api.onlyoffice.com/docbuilder/basic");
var nElementsCount = oHyperlink.GetElementsCount();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Number of elements in hyperlink: " + nElementsCount);
oParagraph.AddLineBreak();
oParagraph.AddText("Elements: oParagraph, oRun1, oRun2, oHyperlink");
oDocument.Push(oParagraph);