共用方式為


ListItem Class

Combo Box List Item.When the object is serialized out as xml, its qualified name is w:listItem.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Wordprocessing.ListItem

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

Syntax

'Declaration
Public Class ListItem _
    Inherits OpenXmlLeafElement
'Usage
Dim instance As ListItem
public class ListItem : OpenXmlLeafElement

Remarks

[ISO/IEC 29500-1 1st Edition]

17.5.2.21 listItem (Combo Box List Item)

This element specifies a single list item within the parent combo box structured document tag. Each list item shall be displayed in the list displayed for the parent structured document tag (if a user interface is present).

[Example: Consider the following combo box structured document tag:

<w:sdt>
<w:sdtPr>
<w:comboBox>
<w:listItem w:displayText="Zero" w:value="0"/>
<w:listItem w:displayText="One" w:value="1"/>
</w:comboBox>
</w:sdtPr>
…
</w:sdt>

Each listItem element within the comboBox element specifies a single list item entry, in this case resulting in two list items within the parent combo box structured document tag. end example]

Parent Elements

comboBox (§17.5.2.5)

Attributes

Description

displayText (List Entry Display Text)

Specifies the text to display in the run content (as well as any supplied user interface) in place of the value attribute contents for this drop-down list entry.

This value shall be used as follows:

  • If the parent structured document tag is mapped to a custom XML element, the value in that custom XML element shall be mapped the content of the value attribute, and the resulting displayText attribute value (if one is present) shall be displayed in the run content. If no displayText attribute is present, then the value shall be displayed.

  • If the corresponding entry is selected via a user interface, this value shall be stored in the parent element's run content in the document (this is the value that shall be shown in the document's WordprocessingML content).

If this attribute is omitted, then the content of the value attribute shall be used as the display text for the current list item entry.

[Example: Consider the following drop-down list structured document tag:

<w:sdt>
<w:sdtPr>
<w:dropDownList>
<w:listItem w:displayText="The Letter A" w:value="a"/>
<w:listItem w:displayText="The Letter B" w:value="b"/>
</w:dropDownList>
</w:sdtPr>
…
</w:sdt>

The displayText attribute for the first entry is The Letter A and the second is The Letter B, therefore, these values are used to determine the display text if the parent structured document tag is mapped to custom XML data in a custom XML data part. end example]

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

value (List Entry Value)

Specifies the value for the current list item entry.

This value shall be used as follows:

  • If the parent structured document tag is mapped to a custom XML element, the value in that custom XML element shall be mapped to this value, and the resulting displayText attribute value (if one is present) shall be displayed in the run content. If no displayText attribute is present, then the value shall be displayed.

  • If the corresponding entry is selected via a user interface, this value shall be stored in the parent element's listItem attribute value.

[Example: Consider the following combo box structured document tag:

<w:sdt>
<w:sdtPr>
<w:comboBox>
<w:listItem w:displayText="Zero" w:value="0"/>
<w:listItem w:displayText="One" w:value="1"/>
</w:comboBox>
</w:sdtPr>
…
</w:sdt>

The value attribute for the first entry is 0 and the second is 1, therefore, these values are used to determine the display text if the parent structured document tag is mapped to custom XML data in a custom XML data part. 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_SdtListItem) is located in §A.1. end note]

[ISO/IEC 29500-1 1st Edition]

17.5.2.22 listItem (Drop-Down List Item)

This element specifies a single list item within the parent drop-down list structured document tag. Each list item shall be displayed in the list displayed for the parent structured document tag (if a user interface is present).

[Example: Consider the following combo box structured document tag:

<w:sdt>
<w:sdtPr>
<w:dropDownList>
<w:listItem w:displayText="The Letter A" w:value="a"/>
<w:listItem w:displayText="The Letter B" w:value="b"/>
</w:dropDownList>
</w:sdtPr>
…
</w:sdt>

Each listItem element within the dropDownList element specifies a single list item entry, in this case resulting in two list items within the parent drop-down list structured document tag. end example]

Parent Elements

dropDownList (§17.5.2.15)

Attributes

Description

displayText (List Entry Display Text)

Specifies the text to display in the run content (as well as any supplied user interface) in place of the value attribute contents for this drop-down list entry.

This value shall be used as follows:

  • If the parent structured document tag is mapped to a custom XML element, the value in that custom XML element shall be mapped the content of the value attribute, and the resulting displayText attribute value (if one is present) shall be displayed in the run content. If no displayText attribute is present, then the value shall be displayed.

  • If the corresponding entry is selected via a user interface, this value shall be stored in the parent element's run content in the document (this is the value that shall be shown in the document's WordprocessingML content).

If this attribute is omitted, then the content of the value attribute shall be used as the display text for the current list item entry.

[Example: Consider the following drop-down list structured document tag:

<w:sdt>
<w:sdtPr>
<w:dropDownList>
<w:listItem w:displayText="The Letter A" w:value="a"/>
<w:listItem w:displayText="The Letter B" w:value="b"/>
</w:dropDownList>
</w:sdtPr>
…
</w:sdt>

The displayText attribute for the first entry is The Letter A and the second is The Letter B, therefore, these values are used to determine the display text if the parent structured document tag is mapped to custom XML data in a custom XML data part. end example]

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

value (List Entry Value)

Specifies the value for the current list item entry.

This value shall be used as follows:

  • If the parent structured document tag is mapped to a custom XML element, the value in that custom XML element shall be mapped to this value, and the resulting displayText attribute value (if one is present) shall be displayed in the run content. If no displayText attribute is present, then the value shall be displayed.

  • If the corresponding entry is selected via a user interface, this value shall be stored in the parent element's listItem attribute value.

[Example: Consider the following combo box structured document tag:

<w:sdt>
<w:sdtPr>
<w:comboBox>
<w:listItem w:displayText="Zero" w:value="0"/>
<w:listItem w:displayText="One" w:value="1"/>
</w:comboBox>
</w:sdtPr>
…
</w:sdt>

The value attribute for the first entry is 0 and the second is 1, therefore, these values are used to determine the display text if the parent structured document tag is mapped to custom XML data in a custom XML data part. 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_SdtListItem) 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

ListItem Members

DocumentFormat.OpenXml.Wordprocessing Namespace