GetElement

function GetElement(nPos: number = null): DocumentElement

Description

Returns an element by its position in the document.

Parameters

nPosnumberdefault: null

The element position that will be taken from the document.

Returns

DocumentElement

Try It

var oDocument = Api.GetDocument();
var oSection = oDocument.GetFinalSection();
var oDocContent = oSection.GetHeader("default", true);
var oParagraph = oDocContent.GetElement(0);
oParagraph.AddText("This is the text in the default header");

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