w:sdt (Structured Document Tag)
A region of content with an associated content control or custom XML data binding.
Parent elements
Child elements
Description
w:sdt (Structured Document Tag) is a content control that wraps a named, typed region of content in the document. It is defined in ECMA-376 Part 1 §17.5.2.29.
SDTs can appear at the block level (wrapping paragraphs), inline level (wrapping runs), or row/cell level in tables. They are used for form fields, placeholder text, data bindings, rich-text controls, combo boxes, and date pickers. Each SDT has three parts:
w:sdtPr— properties (type, binding, alias, ID)w:sdtEndPr— end properties (optional, contains run properties for separator)w:sdtContent— the actual content
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
| (none) | — | — | All properties are expressed via w:sdtPr, w:sdtEndPr, and w:sdtContent children. |
Examples
<w:sdt>
<w:sdtPr>
<w:tag w:val="authorName"/>
<w:alias w:val="Author Name"/>
<w:showingPlcHdr/>
</w:sdtPr>
<w:sdtContent>
<w:p>
<w:r><w:t>Click here to enter your name.</w:t></w:r>
</w:p>
</w:sdtContent>
</w:sdt>
new SdtBlock(
new SdtProperties(
new Tag { Val = "authorName" },
new SdtAlias { Val = "Author Name" }),
new SdtContentBlock(
new Paragraph(
new Run(new Text("Click here to enter your name.")))));