共用方式為


SdtContentDropDownList Class

Drop-Down List Structured Document Tag.When the object is serialized out as xml, its qualified name is w:dropDownList.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Wordprocessing.SdtContentDropDownList

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(ListItem))> _
Public Class SdtContentDropDownList _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As SdtContentDropDownList
[ChildElementInfoAttribute(typeof(ListItem))]
public class SdtContentDropDownList : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • ListItem <w:listItem>

[ISO/IEC 29500-1 1st Edition]

17.5.2.15 dropDownList (Drop-Down List Structured Document Tag)

This element specifies that the parent structured document tag shall be a drop-down list when displayed in the document.

This setting specifies that the behavior for this structured document tag shall be as follows:

  • The contents shall not be editable when displayed by a hosting application regardless of the locking settings

  • The child elements of this element specify choices which shall be displayed in a standard drop-down list format

As well, the structured document tag shall satisfy the following restraints or the document shall be considered non-conformant:

  • The contents shall only be contain a single run (one set of formatting properties)

  • The contents shall not contain more than a single paragraph or table cell and shall not contain a table row or table

[Example: Consider the following structured document tag:

<w:sdt>
<w:sdtPr>
…
<w:dropDownList>
…
</w:dropDownList>
</w:sdtPr>
…
</w:sdt>

The dropDownList element in this structured document tag's properties specify that the type of structured document tag is a drop-down list. end example]

Parent Elements

sdtPr (§17.5.2.38)

Child Elements

Subclause

listItem (Drop-Down List Item)

§17.5.2.22

Attributes

Description

lastValue (Drop-down List Last Saved Value)

Specifies the value associated with the current display text for the drop-down list structured document tag.

If this structured document tag is not mapped to XML using the dataBinding element (§17.5.2.6), then this attribute shall be ignored. If this structured document tag is mapped to XML, it shall be used to determine whether the current display text in the combo box structured document tag shall be retained when the document is opened, as follows:

  • When the XML mapping is created, the content in the custom XML data is retrieved

  • If this content has an associated list item (matching its value attribute), then the corresponding display text shall be displayed in the structured document tag

  • If no list item exists, this content shall be matched against the lastValue attribute value. If the values match, the current display text shall be retained. If the values do not match, the current custom XML data content shall be the new display text (since no match exists in the combo box list items)

[Example: Consider a drop-down list structured document tag defined as follows:

<w:sdt>
<w:sdtPr>
<w:dataBinding … />
<w:dropDownList w:lastValue="2"/>
</w:sdtPr>
<w:sdtContent>
<w:r>
<w:t>Hello world</w:t>
</w:r>
</w:sdtContent>
</w:sdt>

The current run content of the structured document tag reads Hello world. When this document is opened, if the current value of the associated custom XML data is 2, the matching lastValue attribute specifies that the contents of the combo box must continue to be the current display text of the combo boxeven though there is no listItem whose value is 2 (and normally, the content of the structured document tag would be set to 2. Essentially, this attribute specifies a listItem whose value is 2 and whose displayText is Hello world (the current structured document tag contents). end example]

The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13).

[Note: The W3C XML Schema definition of this element’s content model (CT_SdtDropDownList) is located in §A.1. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SdtContentDropDownList Members

DocumentFormat.OpenXml.Wordprocessing Namespace