Push

function Push(oElement: ParagraphContent = null): boolean

Description

Adds an element to the current paragraph.

Parameters

oElementParagraphContentdefault: null

The document element which will be added at the current position. Returns false if the oElement type is not supported by a paragraph.

Returns

boolean

Try It

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oRun = Api.CreateRun();
oRun.AddText("This is run #0, you must not push it to take effect.");
oParagraph.AddElement(oRun);
oParagraph.AddLineBreak();
for (let nRunIncrease = 0; nRunIncrease < 5; ++nRunIncrease) {
   oRun = Api.CreateRun();
   oRun.AddText("This is run #" + (nRunIncrease + 1) + ", you must push it to take effect.");
   oParagraph.AddLineBreak();
   oParagraph.Push(oRun);
}

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