跳到主要内容

CreateParagraph

创建新段落。

语法

expression.CreateParagraph();

expression - 表示 Api 类的变量。

参数

此方法没有任何参数。

返回值

ApiParagraph

示例

此示例创建一个新段落。

// How to add a text in a shape.

// Create a text paragraph for a shape.

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