Get Started
Usage API
More information

Push

Push(nPos, oElement) → { bool }

Add an element to the end of inline text content control.

Parameters:

Name Type Description
nPos number

The position where the current element will be added.

oElement DocumentElement

The document element which will be added at the current position.

Returns:

Type
bool

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oInlineLvlSdt = Api.CreateInlineLvlSdt();
oParagraph.AddInlineLvlSdt(oInlineLvlSdt);
oRun = Api.CreateRun();
oRun.AddText("This is an inline text content control.");
oInlineLvlSdt.AddElement(oRun, 0);
oRun = Api.CreateRun();
oRun.AddText("This sentence was pushed here.");
oInlineLvlSdt.Push(oRun);
builder.SaveFile("docx", "Push.docx");
builder.CloseFile();

Resulting document