SetTag
Sets the tag attribute to the current container.
Syntax
expression.SetTag(tag);
expression - A variable that represents a ApiBlockLvlSdt class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| tag | Required | string | The tag which will be added to the current container. |
Returns
boolean
Example
Attach a tag to a content control for identification in a document.
// How do I add a custom tag string to a content control in a document?
// Mark a content control with a tag so it can be identified or processed later in a document.
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);