GetAllContentControls

function GetAllContentControls(): ApiBlockLvlSdt[] | ApiInlineLvlSdt[]

Description

Returns a collection of content control objects in the current content control.

Returns

ApiBlockLvlSdt[] | ApiInlineLvlSdt[]

Try It

var oDocument = Api.GetDocument();
var oBlockLvlSdt = Api.CreateBlockLvlSdt();
var oBlockLvlSdt1 = Api.CreateBlockLvlSdt();
oBlockLvlSdt1.GetContent().GetElement(0).AddText("This is the first block text content control.");
var oBlockLvlSdt2 = Api.CreateBlockLvlSdt();
oBlockLvlSdt2.GetContent().GetElement(0).AddText("This is the second block text content control.");
oBlockLvlSdt.AddElement(oBlockLvlSdt1, 0);
oBlockLvlSdt.AddElement(oBlockLvlSdt2, 1);
oDocument.AddElement(0, oBlockLvlSdt);
var aContentControls = oBlockLvlSdt.GetAllContentControls();
aContentControls[0].GetContent().GetElement(0).SetBold(true);
var sClassType = aContentControls[0].GetClassType();
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("Class type: " + sClassType);
oDocument.Push(oParagraph);

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