SelectCurrentWord

function SelectCurrentWord(): object

Description

Selects the current word if it possible

Returns

object

Try It

let oDocument = Api.GetDocument();
let oPara1 = oDocument.GetElement(0);
let oRun = oPara1.AddText("The quick brown fox jumps over the lazy dog");
oRun.MoveCursorToPos(16);

oDocument.SelectCurrentWord();

let oPara2 = Api.CreateParagraph();
oPara2.AddText("The selected text is " + oDocument.GetRangeBySelect().GetText());
oDocument.Push(oPara2);

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