跳到主要内容

Delete

删除当前段落。

语法

expression.Delete();

expression - 表示 ApiParagraph 类的变量。

参数

此方法没有任何参数。

返回值

boolean

示例

此示例删除段落。

// How to remove the paragraph.

// Create two paragraphs and delete the second one.

let doc = Api.GetDocument();
let paragraph1 = doc.GetElement(0);
paragraph1.AddText("This is just a sample paragraph №1.");
let paragraph2 = Api.CreateParagraph();
paragraph2.AddText("This is just a sample paragraph №2.");
doc.Push(paragraph2);
paragraph1.Delete();
paragraph2.AddLineBreak();
paragraph2.AddText("The sample paragraph №1 was removed.");