GetLastRunWithText
Get last Run with text in the current paragraph
Returns:
- Type
-
ApiRun
Example
Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
for (nRunIncrease = 0; nRunIncrease < 5; ++nRunIncrease) {
oRun = Api.CreateRun();
oRun.AddText("This run # " + (nRunIncrease + 1) );
oParagraph.Push(oRun);
oParagraph.AddLineBreak();
}
oLastRun = oParagraph.GetLastRunWithText();
oLastRun.AddText(" Last run.");
builder.SaveFile("docx", "GetLastRunWithText.docx");
builder.CloseFile();