Get Started
Documentation

AddText

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

Added text in the specified position

Parameters:

Name Type Default Description
sText String
sPosition string "after"

can be "before" or "after"

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();