Get Started
Usage API
More information

AddText

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

Add 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
bool

Example

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

Resulting document