SdtType Enumeration

Specifies the type of a structured document tag (SDT) node.

Namespace:  Aspose.Words.Markup
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.4
public enum SdtType
  Member nameValueDescription
None0 No type is assigned to the SDT.
Bibliography1 The SDT represents a bibliography entry.
Citation2 The SDT represents a citation.
Equation3 The SDT represents an equation.
DropDownList4 The SDT represents a drop down list when displayed in the document.
ComboBox5 The SDT represents a combo box when displayed in the document.
Date6 The SDT represents a date picker when displayed in the document.
BuildingBlockGallery7 The SDT represents a building block gallery type.
DocPartObj8 The SDT represents a document part type.
Group9 The SDT represents a restricted grouping when displayed in the document.
Picture10 The SDT represents a picture when displayed in the document.
RichText11 The SDT represents a rich text box when displayed in the document.
PlainText12 The SDT represents a plain text box when displayed in the document.
Checkbox13 The SDT represents a checkbox when displayed in the document.
RepeatingSection14 The SDT represents repeating section type when displayed in the document.
RepeatingSectionItem15 The SDT represents repeating section item.
EntityPicker16 The SDT represents an entity picker that allows the user to select an instance of an external content type.
Shows how to work with styles for content control elements.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Get specific style from the document to apply it to an SDT
Style quoteStyle = doc.Styles[StyleIdentifier.Quote];
StructuredDocumentTag sdtPlainText = new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline);
sdtPlainText.Style = quoteStyle;

StructuredDocumentTag sdtRichText = new StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Inline);
// Second method to apply specific style to an SDT control
sdtRichText.StyleName = "Quote";

// Insert content controls into the document

MemoryStream dstStream = new MemoryStream();
doc.Save(dstStream, SaveFormat.Docx);

// We can get a collection of StructuredDocumentTags by looking for the document's child nodes of this NodeType
Assert.AreEqual(NodeType.StructuredDocumentTag, sdtPlainText.NodeType);

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

foreach (Node node in tags)
    StructuredDocumentTag sdt = (StructuredDocumentTag) node;
    // If style was not defined before, style should be "Default Paragraph Font"
    Assert.AreEqual(StyleIdentifier.Quote, sdt.Style.StyleIdentifier);
    Assert.AreEqual("Quote", sdt.StyleName);
Shows how to fill the table with data contained in the XML part.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

CustomXmlPart xmlPart = doc.CustomXmlParts.Add("Books",
    "<books>" +
    "<book><title>Everyday Italian</title>" +
    "<author>Giada De Laurentiis</author></book>" +
    "<book><title>Harry Potter</title>" +
    "<author>J K. Rowling</author></book>" +
    "<book><title>Learning XML</title>" +
    "<author>Erik T. Ray</author></book>" +

// Create headers for data from xml content
Table table = builder.StartTable();

// Create table with RepeatingSection inside
StructuredDocumentTag repeatingSectionSdt =
    new StructuredDocumentTag(doc, SdtType.RepeatingSection, MarkupLevel.Row);
repeatingSectionSdt.XmlMapping.SetMapping(xmlPart, "/books[1]/book", "");

// Add RepeatingSectionItem inside RepeatingSection and mark it as a row
StructuredDocumentTag repeatingSectionItemSdt =
    new StructuredDocumentTag(doc, SdtType.RepeatingSectionItem, MarkupLevel.Row);

Row row = new Row(doc);

// Map xml data with created table cells for book title and author
StructuredDocumentTag titleSdt =
    new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Cell);
titleSdt.XmlMapping.SetMapping(xmlPart, "/books[1]/book[1]/title[1]", "");

StructuredDocumentTag authorSdt =
    new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Cell);
authorSdt.XmlMapping.SetMapping(xmlPart, "/books[1]/book[1]/author[1]", "");

doc.Save(ArtifactsDir + "StructuredDocumentTag.RepeatingSectionItem.docx");
See Also