InsertInContentControl
Wraps the paragraph object with a rich text content control.
Parameters:
Name |
Type |
Description |
nType |
number
|
Defines if this method returns the ApiBlockLvlSdt (nType === 1) or ApiParagraph (any value except 1) object. |
Returns:
- Type
-
ApiParagraph | ApiBlockLvlSdt
Example
Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is a paragraph inserted into the content control.");
var oBlockLvlSdt = oParagraph.InsertInContentControl(1);
oDocument.AddElement(0, oBlockLvlSdt);
builder.SaveFile("docx", "InsertInContentControl.docx");
builder.CloseFile();
Resulting document