StructuredDocumentTag class

Represents a structured document tag (SDT or content control) in a document.

To learn more, visit the Structured Document Tags or Content Control documentation article.

public class StructuredDocumentTag : CompositeNode, IStructuredDocumentTag


StructuredDocumentTag(DocumentBaseSdtTypeMarkupLevel)Initializes a new instance of the Structured document tag class.


Appearance { get; set; }Gets/sets the appearance of a structured document tag.
BuildingBlockCategory { get; set; }Specifies category of building block for this SDT node. Can not be null.
BuildingBlockGallery { get; set; }Specifies type of building block for this SDT. Can not be null.
CalendarType { get; set; }Specifies the type of calendar for this SDT. Default is Default
Checked { get; set; }Gets/Sets current state of the Checkbox SDT. Default value for this property is false.
Color { get; set; }Gets or sets the color of the structured document tag.
ContentsFont { get; }Font formatting that will be applied to text entered into SDT.
Count { get; }Gets the number of immediate children of this node.
CustomNodeId { get; set; }Specifies custom node identifier.
DateDisplayFormat { get; set; }String that represents the format in which dates are displayed.
DateDisplayLocale { get; set; }Allows to set/get the language format for the date displayed in this SDT.
DateStorageFormat { get; set; }Gets/sets format in which the date for a date SDT is stored when the SDT is bound to an XML node in the document’s data store. Default value is DateTime
virtual Document { get; }Gets the document to which this node belongs.
EndCharacterFont { get; }Font formatting that will be applied to the last character of text entered into SDT.
FirstChild { get; }Gets the first child of the node.
FullDate { get; set; }Specifies the full date and time last entered into this SDT.
HasChildNodes { get; }Returns true if this node has any child nodes.
Id { get; }Specifies a unique read-only persistent numerical Id for this SDT.
override IsComposite { get; }Returns true as this node can have child nodes.
IsShowingPlaceholderText { get; set; }Specifies whether the content of this SDT shall be interpreted to contain placeholder text (as opposed to regular text contents within the SDT).
IsTemporary { get; set; }Specifies whether this SDT shall be removed from the WordProcessingML document when its contents are modified.
LastChild { get; }Gets the last child of the node.
Level { get; }Gets the level at which this SDT occurs in the document tree.
ListItems { get; }Gets SdtListItemCollection associated with this SDT.
LockContentControl { get; set; }When set to true, this property will prohibit a user from deleting this SDT.
LockContents { get; set; }When set to true, this property will prohibit a user from editing the contents of this SDT.
Multiline { get; set; }Specifies whether this SDT allows multiple lines of text.
NextSibling { get; }Gets the node immediately following this node.
override NodeType { get; }Returns StructuredDocumentTag.
ParentNode { get; }Gets the immediate parent of this node.
Placeholder { get; }Gets the BuildingBlock containing placeholder text which should be displayed when this SDT run contents are empty, the associated mapped XML element is empty as specified via the XmlMapping element or the IsShowingPlaceholderText element is true.
PlaceholderName { get; set; }Gets or sets Name of the BuildingBlock containing placeholder text.
PreviousSibling { get; }Gets the node immediately preceding this node.
Range { get; }Returns a Range object that represents the portion of a document that is contained in this node.
SdtType { get; }Gets type of this Structured document tag.
Style { get; set; }Gets or sets the Style of the structured document tag.
StyleName { get; set; }Gets or sets the name of the style applied to the structured document tag.
Tag { get; set; }Specifies a tag associated with the current SDT node. Can not be null.
Title { get; set; }Specifies the friendly name associated with this SDT. Can not be null.
WordOpenXML { get; }Gets a string that represents the XML contained within the node in the FlatOpc format.
WordOpenXMLMinimal { get; }Gets a string that represents the XML contained within the node in the FlatOpc format. Unlike the WordOpenXML property, this method generates a stripped-down document that excludes any non-content-related parts.
XmlMapping { get; }Gets an object that represents the mapping of this structured document tag to XML data in a custom XML part of the current document.


override Accept(DocumentVisitor)Accepts a visitor.
override AcceptEnd(DocumentVisitor)Accepts a visitor for visiting the end of the StructuredDocumentTag.
override AcceptStart(DocumentVisitor)Accepts a visitor for visiting the start of the StructuredDocumentTag.
AppendChild<T>(T)Adds the specified node to the end of the list of child nodes for this node.
Clear()Clears contents of this structured document tag and displays a placeholder if it is defined.
Clone(bool)Creates a duplicate of the node.
CreateNavigator()Creates navigator which can be used to traverse and read nodes.
GetAncestor(NodeType)Gets the first ancestor of the specified NodeType.
GetAncestor(Type)Gets the first ancestor of the specified object type.
GetChild(NodeType, int, bool)Returns an Nth child node that matches the specified type.
GetChildNodes(NodeType, bool)Returns a live collection of child nodes that match the specified type.
GetEnumerator()Provides support for the for each style iteration over the child nodes of this node.
override GetText()Gets the text of this node and of all its children.
IndexOf(Node)Returns the index of the specified child node in the child node array.
InsertAfter<T>(T, Node)Inserts the specified node immediately after the specified reference node.
InsertBefore<T>(T, Node)Inserts the specified node immediately before the specified reference node.
NextPreOrder(Node)Gets next node according to the pre-order tree traversal algorithm.
PrependChild<T>(T)Adds the specified node to the beginning of the list of child nodes for this node.
PreviousPreOrder(Node)Gets the previous node according to the pre-order tree traversal algorithm.
Remove()Removes itself from the parent.
RemoveAllChildren()Removes all the child nodes of the current node.
RemoveChild<T>(T)Removes the specified child node.
RemoveSelfOnly()Removes just this SDT node itself, but keeps the content of it inside the document tree.
RemoveSmartTags()Removes all SmartTag descendant nodes of the current node.
SelectNodes(string)Selects a list of nodes matching the XPath expression.
SelectSingleNode(string)Selects the first Node that matches the XPath expression.
SetCheckedSymbol(int, string)Sets the symbol used to represent the checked state of a check box content control.
SetUncheckedSymbol(int, string)Sets the symbol used to represent the unchecked state of a check box content control.
ToString(SaveFormat)Exports the content of the node into a string in the specified format.
ToString(SaveOptions)Exports the content of the node into a string using the specified save options.


Structured document tags (SDTs) allow to embed customer-defined semantics as well as its behavior and appearance into a document.

In this version Aspose.Words provides a number of public methods and properties to manipulate the behavior and content of StructuredDocumentTag. Mapping of SDT nodes to custom XML packages within a document can be performed with using the XmlMapping property.

StructuredDocumentTag can occur in a document in the following places:

  • Block-level - Among paragraphs and tables, as a child of a Body, HeaderFooter, Comment, Footnote or a Shape node.
  • Row-level - Among rows in a table, as a child of a Table node.
  • Cell-level - Among cells in a table row, as a child of a Row node.
  • Inline-level - Among inline content inside, as a child of a Paragraph.
  • Nested inside another StructuredDocumentTag.


Shows how to work with styles for content control elements.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Below are two ways to apply a style from the document to a structured document tag.
// 1 -  Apply a style object from the document's style collection:
Style quoteStyle = doc.Styles[StyleIdentifier.Quote];
StructuredDocumentTag sdtPlainText =
    new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline) { Style = quoteStyle };

// 2 -  Reference a style in the document by name:
StructuredDocumentTag sdtRichText =
    new StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Inline) { StyleName = "Quote" };


Assert.AreEqual(NodeType.StructuredDocumentTag, sdtPlainText.NodeType);

NodeCollection tags = doc.GetChildNodes(NodeType.StructuredDocumentTag, true);

foreach (Node node in tags)
    StructuredDocumentTag sdt = (StructuredDocumentTag)node;


    Assert.AreEqual(StyleIdentifier.Quote, sdt.Style.StyleIdentifier);
    Assert.AreEqual("Quote", sdt.StyleName);

See Also