AddText

function AddText(sText: String = null, sPosition: string = "after"): boolean

Description

Adds a text to the specified position.

Parameters

sTextStringdefault: null

The text that will be added.

sPositionstringdefault: "after"

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

Returns

boolean

Try It

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

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