跳到主要内容

Delete

Removes a content control and its content. If keepContent is true, the content is not deleted.

Syntax

expression.Delete(keepContent);

expression - A variable that represents a ApiBlockLvlSdt class.

Parameters

NameRequired/OptionalData typeDefaultDescription
keepContentRequiredbooleanSpecifies if the content will be deleted or not.

Returns

boolean

Example

This example deletes a content control and its content.

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