Skip to main content

Push

Pushes a paragraph or a table to actually add it to the document.

Inherited from ApiDocumentContent.Push.

Syntax​

expression.Push(oElement);

expression - A variable that represents an ApiDocument class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
oElementRequiredDocumentElementThe element type which will be pushed to the document.

Returns​

boolean

Example​

Append new paragraphs to the end of a document.

// How do I add multiple paragraphs one after another in a document?

// Build a sequence of numbered paragraphs by pushing each one onto the document in a document.

const doc = Api.GetDocument();

const paragraphCount = 5;
for (let i = 0; i < paragraphCount; i++) {
const newParagraph = Api.CreateParagraph();
newParagraph.AddText("This is " + (i + 1) + " paragraph.");
doc.Push(newParagraph);
}