AddElement
Adds a paragraph or a table or a block content control to the current container.
Parameters:
Name |
Type |
Description |
oElement |
DocumentElement
|
The type of the element which will be added to the current container. |
nPos |
Number
|
The specified position. |
Returns:
- Type
-
boolean
Example
Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oBlockLvlSdt = Api.CreateBlockLvlSdt();
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is a block text content control.");
oBlockLvlSdt.AddElement(oParagraph, 0);
oDocument.AddElement(0, oBlockLvlSdt);
builder.SaveFile("docx", "AddElement.docx");
builder.CloseFile();
Resulting document