RemoveElement

function RemoveElement(nPos: number = null): boolean

Description

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

Parameters

nPosnumberdefault: null

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

Returns

boolean

Try It

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oInlineLvlSdt = Api.CreateInlineLvlSdt();
oParagraph.AddInlineLvlSdt(oInlineLvlSdt);
var oRun1 = Api.CreateRun();
oRun1.AddText("This is the first text run in the inline text content control.");
oInlineLvlSdt.AddElement(oRun1, 0);
var 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);

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