GetAllBookmarksNames

function GetAllBookmarksNames(): string[]

Description

Returns an array with names of all bookmarks in the current document.

Returns

string[]

Try It

var oDocument = Api.GetDocument(); 
var oParagraph = oDocument.GetElement(0); 
oParagraph.AddText("ONLYOFFICE Document Builder"); 
var oRange1 = oDocument.GetRange(0, 9); 
oRange1.AddBookmark("Bookmark 1");
var oRange2 = oDocument.GetRange(11, 18); 
oRange2.AddBookmark("Bookmark 2");
var aBookmarks = oDocument.GetAllBookmarksNames();
oParagraph.AddLineBreak();
oParagraph.AddText("Bookmark names: ");
for (let i = 0; i < 2; i++ ){
   oParagraph.AddText(aBookmarks[i] + "," + " ");
}

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).