InsertParagraph
Inserts a paragraph at the specified position.
Parameters:
Name |
Type |
Description |
paragraph |
string | ApiParagraph
|
Text or paragraph. |
sPosition |
string
|
The position where the text or paragraph will be inserted ("before" or "after" the drawing specified). |
beRNewPara |
boolean
|
Defines if this method returns a new paragraph (true) or the current ApiDrawing (false). |
Returns:
- Type
-
ApiParagraph | ApiDrawing
Example
Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oDrawing = Api.CreateShape("rect", 3212465, 963295, oFill, oStroke);
oParagraph.AddDrawing(oDrawing);
oDrawing.InsertParagraph("This is inserted paragraph.", "before", true);
builder.SaveFile("docx", "InsertParagraph.docx");
builder.CloseFile();
Resulting document