Get Started
Usage API
More information

GetParentContentControl

GetParentContentControl() → { ApiBlockLvlSdt | null }

Get the content control that contains the current content control.

Parameters:

This method doesn't have any parameters.

Returns:

Type
ApiBlockLvlSdt | null

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oBlockLvlSdt1 = Api.CreateBlockLvlSdt();
oBlockLvlSdt1.GetContent().GetElement(0).AddText("This is a parent block text content control.");
oDocument.AddElement(0, oBlockLvlSdt1);
oBlockLvlSdt2 = Api.CreateBlockLvlSdt();
oBlockLvlSdt2.GetContent().GetElement(0).AddText("This is a block text content control added in another content control.");
oBlockLvlSdt1.AddElement(oBlockLvlSdt2, 0);
oParentBlockLvlSdt = oBlockLvlSdt2.GetParentContentControl();
oParentBlockLvlSdt.SetAlias("№1");
builder.SaveFile("docx", "GetParentContentControl.docx");
builder.CloseFile();

Resulting document