Last

function Last(): ParagraphContent

Description

Returns the last element of the paragraph which is not empty.

Returns

ParagraphContent

Try It

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oRun_1 = Api.CreateRun();
oRun_1.AddText("This is an Run with text. ");
oParagraph.Push(oRun_1);
var oRun_2 = Api.CreateRun();
oRun_2.AddText("And this is the last Run in the paragraph.");
oParagraph.Push(oRun_2);
var oLastRun = oParagraph.Last();
oLastRun.SetBold(true);

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