Get Started
Usage API
More information

GetAllContentControls

GetAllContentControls() → { Array.<ApiBlockLvlSdt> | Array.<ApiInlineLvlSdt> }

Get the list of all the content controls in the document.

Parameters:

This method doesn't have any parameters.

Returns:

Type
Array.<ApiBlockLvlSdt> | Array.<ApiInlineLvlSdt>

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oInlineLvlSdt = Api.CreateInlineLvlSdt();
oParagraph.AddInlineLvlSdt(oInlineLvlSdt);
oRun = Api.CreateRun();
oRun.AddText("This is an inline text content control.");
oInlineLvlSdt.AddElement(oRun, 0);
oContentControls = oDocument.GetAllContentControls();
oContentControls[0].GetElement(0).SetBold(true);
oClassType = oContentControls[0].GetClassType();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Class type: " + oClassType);
oDocument.Push(oParagraph);
builder.SaveFile("docx", "GetAllContentControls.docx");
builder.CloseFile();

Resulting document