Get Started
Documentation

Push

Push(oElement) → { boolean }

Add an element to the current paragraph.

Parameters:

Name Type Description
oElement ParagraphContent

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

Returns:

Type
boolean

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oRun = Api.CreateRun();
oRun.AddText("This is run #0, you must not push it to take effect.");
oParagraph.AddElement(oRun);
oParagraph.AddLineBreak();
for (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);
}
builder.SaveFile("docx", "Push.docx");
builder.CloseFile();