GetCurrentSentence

function GetCurrentSentence(sPart: "undefined" | before | after = null): string

Description

Returns the current sentence or part of the current sentence

Parameters

sPart"undefined" | before | afterdefault: null

Specifies the desired part of the current sentence

Returns

string

Try It

let oDocument = Api.GetDocument();
let oPara1 = oDocument.GetElement(0);
let oRun = oPara1.AddText("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.");
oRun.MoveCursorToPos(80);

let oPara2 = Api.CreateParagraph();
oPara2.AddText("The current sentence is \"" + oDocument.GetCurrentSentence() + "\"");
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).