Get Started
Usage API
More information

GetParentContentControl

GetParentContentControl() → { ApiBlockLvlSdt | ApiInlineLvlSdt | null }

Get the content control that contains the run.

Parameters:

This method doesn't have any parameters.

Returns:

Type
ApiBlockLvlSdt | ApiInlineLvlSdt | null

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oBlockLvlSdt = Api.CreateBlockLvlSdt();
oParagraph = Api.CreateParagraph();
oRun = Api.CreateRun();
oRun.AddText("This is a block text content control.");
oParagraph.Push(oRun);
oBlockLvlSdt.AddElement(oParagraph, 0);
oDocument.AddElement(0, oBlockLvlSdt);
oContentControl = oRun.GetParentContentControl();
oClassType = oContentControl.GetClassType();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Class type: " + oClassType);
oDocument.Push(oParagraph);
builder.SaveFile("docx", "GetParentContentControl.docx");
builder.CloseFile();

Resulting document