AddElement

function AddElement(oElement: DocumentElement = null, nPos: Number = null): boolean

Description

Adds a paragraph or a table or a block content control to the current container.

Parameters

oElementDocumentElementdefault: null

The type of the element which will be added to the current container.

nPosNumberdefault: null

The specified position.

Returns

boolean

Try It

var oDocument = Api.GetDocument();
var oBlockLvlSdt = Api.CreateBlockLvlSdt();
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is a block text content control.");
oBlockLvlSdt.AddElement(oParagraph, 0);
oDocument.AddElement(0, oBlockLvlSdt);

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