Get Started
Documentation

InsertInContentControl

InsertInContentControl(nType) → { ApiDrawing | ApiBlockLvlSdt }

Wraps the graphic object with a rich text content control.

Parameters:

Name Type Description
nType number

if nType === 1 -> returns ApiBlockLvlSdt, else -> return ApiDrawing

Returns:

Type
ApiDrawing | ApiBlockLvlSdt

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This graphic object was wrapped in content control");
oFill = Api.CreateSolidFill(Api.CreateRGBColor(104, 155, 104));
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
oDrawing = Api.CreateShape("rect", 3212465, 963295, oFill, oStroke);
oParagraph.AddDrawing(oDrawing);
oDrawing.InsertInContentControl(1);
builder.SaveFile("docx", "InsertInContentControl.docx");
builder.CloseFile();