GetLastRunWithText
function GetLastRunWithText(): ApiRun
Description
Returns the last Run with text in the current paragraph.
Returns
ApiRun
Try It
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
for (let nRunIncrease = 0; nRunIncrease < 5; ++nRunIncrease) {
var oRun = Api.CreateRun();
oRun.AddText("This run # " + (nRunIncrease + 1) );
oParagraph.Push(oRun);
oParagraph.AddLineBreak();
}
var oLastRun = oParagraph.GetLastRunWithText();
oLastRun.AddText(" Last run.");