AddLineBreak
在当前运行位置添加换行符,并从新行开始下一个元素。
语法
expression.AddLineBreak();
expression - 表示 ApiRun 类的变量。
参数
此方法没有任何参数。
返回值
boolean
示例
此示例在运行位置添加换行符,并从新行开始下一个元素。
// How to start a sentence on a new line.
// Break two lines of a text run with a line.
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", 120 * 36000, 70 * 36000, fill, stroke, 0, 2 * 36000, 0, 3 * 36000);
let content = shape.GetContent();
let paragraph = content.GetElement(0);
let run = Api.CreateRun();
run.AddText("This is the text for the first line. Nothing special.");
run.AddLineBreak();
run.AddText("This is the text which starts from the beginning of the second line. ");
run.AddText("It is written in two text runs, you need a space at the end of the first run sentence to separate them.");
paragraph.AddElement(run);