Get Started
Usage API
More information

RemoveElement

RemoveElement(nPos)

Removes an element using the position specified from the current inline text content control.

Parameters:

Name Type Description
nPos number

The position of the element which we want to remove from the current inline text content control.

Returns:

This method doesn't return any data.

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oInlineLvlSdt = Api.CreateInlineLvlSdt();
oParagraph.AddInlineLvlSdt(oInlineLvlSdt);
oRun1 = Api.CreateRun();
oRun1.AddText("This is the first text run in the inline text content control.");
oInlineLvlSdt.AddElement(oRun1, 0);
oRun2 = Api.CreateRun();
oRun2.AddText("This is the second text run in the inline text content control. The first text run was removed.");
oInlineLvlSdt.AddElement(oRun2, 1);
oInlineLvlSdt.RemoveElement(0);
builder.SaveFile("docx", "RemoveElement.docx");
builder.CloseFile();

Resulting document