AddText

AddText(sText, [sPosition]) → { boolean }

Adds a text to the specified position.

Parameters:

Name Type Default Description
sText String

The text that will be added.

sPosition string "after"

The position where the text will be added ("before" or "after" the range specified).

Returns:

Type
boolean

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("Document");
var oRange = oDocument.GetRange(0, 7);
oRange.AddText("ONLYOFFICE ", "before");
oRange.AddText(" Builder", "after");
builder.SaveFile("docx", "AddText.docx");
builder.CloseFile();

Resulting document