GetElement

GetElement(nPos) → { DocumentElement }

Returns an element by its position in the document.

Parameters:

Name Type Description
nPos number

The element position that will be taken from the document.

Returns:

Type
DocumentElement

Example

Copy code
builder.CreateFile("docx");
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");
builder.SaveFile("docx", "GetElement.docx");
builder.CloseFile();

Resulting document