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 doc = Api.GetDocument();
let paragraph = doc.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);