跳到主要内容

SetTag

Sets the tag attribute to the current container.

Syntax

expression.SetTag(tag);

expression - A variable that represents a ApiBlockLvlSdt class.

Parameters

NameRequired/OptionalData typeDefaultDescription
tagRequiredstringThe tag which will be added to the current container.

Returns

This method doesn't return any data.

Example

This example shows how to set the tag attribute for the container.

let doc = Api.GetDocument();
let blockLvlSdt = Api.CreateBlockLvlSdt();
blockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control with a tag set to it.");
blockLvlSdt.SetTag("This is a tag.");
doc.AddElement(0, blockLvlSdt);