Get Started
Usage API
More information

Last

Last() → { DocumentElement }

Get the last document element.

Parameters:

This method doesn't have any parameters.

Returns:

Type
DocumentElement

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This is a sample text №1.");
oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is a sample text №2.");
oDocument.Push(oParagraph);
oElement = oDocument.Last();
oElement.SetBold(true);
builder.SaveFile("docx", "Last.docx");
builder.CloseFile();

Resulting document