TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

GetAllParagraphs

GetAllParagraphs() → { Array.<ApiParagraph> }

Returns an array of all paragraphs from the current document content.

Parameters:

This method doesn't have any parameters.

Returns:

Type
Array.<ApiParagraph>

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 oShape = Api.CreateShape("rect", 100 * 36000, 100 * 36000, oFill, oStroke);
oParagraph.AddDrawing(oShape);
var oDocContent = oShape.GetDocContent();
oParagraph = oDocContent.GetElement(0);
oParagraph.AddText("Paragraph 1");
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Paragraph 2");
oDocContent.Push(oParagraph);
var aParagraphs = oDocContent.GetAllParagraphs();
aParagraphs[0].SetBold(true);
builder.SaveFile("docx", "GetAllParagraphs.docx");
builder.CloseFile();

Resulting document