Get Started
Documentation

InsertContent

InsertContent(arrContent, [isInline], [oPr]) → { boolean }

Insert an array of elements in the current position of the document.

Parameters:

Name Type Default Description
arrContent Array.<DocumentElement>

An array of elements to insert.

isInline boolean false

Inline insert on not (works only when the length of arrContent = 1 and it's a paragraph)

oPr object null

Returns:

Type
boolean

Example

Copy code
builder.CreateFile("docx");
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]);
builder.SaveFile("docx", "InsertContent.docx");
builder.CloseFile();

Resulting document