Get Started
Documentation

InsertParagraph

InsertParagraph(paragraph, sPosition, beRNewPara) → { ApiParagraph | ApiDrawing }

Inserts a paragraph at the specified position.

Parameters:

Name Type Description
paragraph string | ApiParagraph

text or paragraph

sPosition string

can be "after" or "before"

beRNewPara bool

if "true" - returns new paragraph, else returns this ApiDrawing.

Returns:

Type
ApiParagraph | ApiDrawing

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
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.InsertParagraph("This is inserted paragraph.", "before", true);
builder.SaveFile("docx", "InsertParagraph.docx");
builder.CloseFile();