Get Started
Usage API
More information

InsertInContentControl

InsertInContentControl(nType) → { ApiParagraph | ApiBlockLvlSdt }

Wrap the paragraph object with a rich text content control.

Parameters:

Name Type Description
nType number

If nType === 1 -> returns ApiBlockLvlSdt, otherwise returns ApiParagraph.

Returns:

Type
ApiParagraph | ApiBlockLvlSdt

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is a paragraph inserted into the content control.");
oBlockLvlSdt = oParagraph.InsertInContentControl(1);
oDocument.AddElement(0, oBlockLvlSdt);
builder.SaveFile("docx", "InsertInContentControl.docx");
builder.CloseFile();

Resulting document