InsertContent

function InsertContent(
  arrContent: DocumentElement[] = null,
  isInline: boolean = false,
  oPr: object = null,
): boolean

Description

Inserts an array of elements into the current position of the document.

Parameters

arrContentDocumentElement[]default: null

An array of elements to insert.

isInlinebooleandefault: false

Inline insert or not (works only for the last and the first element and only if it's a paragraph).

oProbjectdefault: null

Specifies that text and paragraph document properties are preserved for the inserted elements. The object should look like this: {"KeepTextOnly": true}.

Returns

boolean

Try It

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is a sample text. It was inserted here.");
oDocument.InsertContent([oParagraph]);

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