Get Started
Usage API
More information

InsertParagraph

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

Insert 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 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();

Resulting document