Get Started
Usage API
More information

RemoveAllElements

RemoveAllElements() → { bool }

Clear the contents from a content control.

Parameters:

This method doesn't have any parameters.

Returns:

Type
bool

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oBlockLvlSdt = Api.CreateBlockLvlSdt();
oBlockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control.");
oDocument.AddElement(0, oBlockLvlSdt);
oBlockLvlSdt.RemoveAllElements();
oParagraph = oDocument.GetElement(1);
oParagraph.AddText("All elements were removed from the content control.");
builder.SaveFile("docx", "RemoveAllElements.docx");
builder.CloseFile();

Resulting document