TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

GetParentContentControl

GetParentContentControl() → { ApiBlockLvlSdt | null }

Returns a content control that contains the current paragraph.

Parameters:

This method doesn't have any parameters.

Returns:

Type
ApiBlockLvlSdt | null

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oBlockLvlSdt = Api.CreateBlockLvlSdt();
oDocument.Push(oBlockLvlSdt, 0);
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is a paragraph added to the block text content control.");
oBlockLvlSdt.AddElement(oParagraph, 0);
var oParentBlockLvlSdt = oParagraph.GetParentContentControl();
oParentBlockLvlSdt.GetRange(0, 3).SetBold(true);
builder.SaveFile("docx", "GetParentContentControl.docx");
builder.CloseFile();

Resulting document