跳到主要内容

Delete

删除内容控件及其内容。如果 keepContent 为 true,则不删除内容。

语法

expression.Delete(keepContent);

expression - 表示 ApiBlockLvlSdt 类的变量。

参数

名称必需/可选数据类型默认值描述
keepContent必需boolean指定是否删除内容。

返回值

boolean

示例

此示例删除内容控件及其内容。

// Creates the ApiBlockLvlSdt object in the current document, adds a text to it, and deletes it and its content from the document.

// How to delete the block level container from the ApiDocument class.

let doc = Api.GetDocument();
let blockLvlSdt = Api.CreateBlockLvlSdt();
blockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control.");
doc.AddElement(0, blockLvlSdt);
blockLvlSdt.Delete(false);