Skip to main content

CreateParagraph

Creates a new paragraph.

Syntax

expression.CreateParagraph();

expression - A variable that represents a Api class.

Parameters

This method doesn't have any parameters.

Returns

ApiParagraph

Example

Insert a new text paragraph into a shape placed on a sheet in a spreadsheet.

// How do I add a separate block of text as its own paragraph inside a shape in a spreadsheet?

// Build and place a standalone text block within a shape's content area in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let shape = worksheet.AddShape("flowChartOnlineStorage", 60 * 36000, 35 * 36000, fill, stroke, 0, 2 * 36000, 0, 3 * 36000);
let docContent = shape.GetContent();
docContent.RemoveAllElements();
let paragraph = Api.CreateParagraph();
paragraph.SetJc("left");
paragraph.AddText("We removed all elements from the shape and added a new paragraph inside it.");
docContent.Push(paragraph);