共用方式為


SharedItems Class

Shared Items.When the object is serialized out as xml, its qualified name is x:sharedItems.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Spreadsheet.SharedItems

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

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(NumberItem))> _
<ChildElementInfoAttribute(GetType(BooleanItem))> _
<ChildElementInfoAttribute(GetType(MissingItem))> _
<ChildElementInfoAttribute(GetType(ErrorItem))> _
<ChildElementInfoAttribute(GetType(StringItem))> _
<ChildElementInfoAttribute(GetType(DateTimeItem))> _
Public Class SharedItems _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As SharedItems
[ChildElementInfoAttribute(typeof(NumberItem))]
[ChildElementInfoAttribute(typeof(BooleanItem))]
[ChildElementInfoAttribute(typeof(MissingItem))]
[ChildElementInfoAttribute(typeof(ErrorItem))]
[ChildElementInfoAttribute(typeof(StringItem))]
[ChildElementInfoAttribute(typeof(DateTimeItem))]
public class SharedItems : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • MissingItem <x:m>

  • NumberItem <x:n>

  • BooleanItem <x:b>

  • ErrorItem <x:e>

  • StringItem <x:s>

  • DateTimeItem <x:d>

[ISO/IEC 29500-1 1st Edition]

18.10.1.90 sharedItems (Shared Items)

Represents the collection of unique items for a field in the PivotCacheDefinition. The sharedItems complex type stores data type and formatting information about the data in a field. Items in the PivotCacheDefinition can be shared in order to reduce the redundancy of those values that are referenced in multiple places across all the PivotTable parts. [Example: A value might be part of a filter, it might appear on a row or column axis, and will appear in the pivotCacheRecords definition as well. However, because of the performance cost of creating the optimized shared items, items are only shared if they are actually in use in the PivotTable. Therefore, depending on user actions on the PivotTable layout, the pivotCacheDefinition and underlying PivotCacheRecords part can be updated. end example]

If there are no shared items, then field values are stored directly in the pivotCacheRecords part.

[Example:

<sharedItems count="1">
<s v="[Customer].[Customer Geography].[Country].&amp;[United States]"
c="United States"/>
</sharedItems>

end example]

The following attributes are not required or used if there are no items in sharedItems.

  • containsBlank

  • containsSemiMixedTypes

  • containsMixedTypes

  • longText

The following attributes are not used unless there is more than one item in sharedItems or the one and only item is not a blank item. If the first item is a blank item the data type the field cannot be verified.

  • containsNumber

  • containsDates

  • containsString

  • containsInteger

The following attributes can be omitted without loss of functionality.

  • containsNonDate

  • count

The following attributes are not required and can be omitted. However, refreshing the PivotTable could produce different groupings than before.

  • maxDate

  • minDate

  • maxValue

  • minValue

Applications should ensure that “date” attributes are not mixed with “value” attributes.

Parent Elements

cacheField (§18.10.1.3)

Child Elements

Subclause

b (Boolean)

§18.10.1.2

d (Date Time)

§18.10.1.21

e (Error Value)

§18.10.1.27

m (No Value)

§18.10.1.50

n (Numeric)

§18.10.1.60

s (Character Value)

§18.10.1.85

Attributes

Description

containsBlank (Contains Blank)

Specifies a boolean value that indicates whether this field contains a blank value.

A value of 1 or true indicates this field contains one or more blank values.

A value of 0 or false indicates this field does not contain blank values.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

containsDate (Contains Date)

Specifies a boolean value that indicates that the field contains at least one date.

A value of 1 or true indicates the field contains at least one date value.

A value of 0 or false indicates the field does not contain any date values.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

containsInteger (Contains Integer)

Specifies a boolean value that indicates whether this field contains integer values.

A value of 1 or true indicates this field contains integer values.

A value of 0 or false indicates non-integer or mixed values.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

containsMixedTypes (Contains Mixed Data Types)

Specifies a boolean value that indicates whether this field contains more than one data type.

A value of 1 or true indicates this field contains more than one data type.

A value of 0 or false indicates contains only one data type. The field can still contain blank values.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

containsNonDate (Contains Non Date)

Specifies a boolean value that indicates that the field contains at least one value that is not a date.

A value of 1 or true indicates the field contains at least one non-date values.

A value of 0 or false indicates this field contains no date fields.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

containsNumber (Contains Numbers)

Specifies a boolean value that indicates whether this field contains numeric values.

A value of 1 or true indicates this field contains at least one numeric value.

A value of 0 or false indicates this field contains no numeric values.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

containsSemiMixedTypes (Contains Semi Mixed Data Types)

Specifies a boolean value that indicates that this field contains text values. The field can also contain a mix of other data type and blank values.

A value of 1 or true indicates at least one text value, and can also contain a mix of other data types and blank values.

A value of 0 or false indicates the field does not have a mix of text and other values.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

containsString (Contains String)

Specifies a boolean value that indicates whether this field contains a text value.

A value of 1 or true indicates this field contains at least one text value.

A value of 0 or false indicates this field does not contain any text values.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

count (Shared Items Count)

Specifies the number of shared items to load for this field.

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.

longText (Long Text)

Specifies a boolean value that indicates whether this field contains a long text value. A string is considered long if it is over 255 characters.

A value of 1 or true indicates the value contains more than 255 characters of text.

A value of 0 or false indicates the value contains less than 255 characters.

[Note: This is used as many legacy spreadsheet application support a limit of 255 characters for text values. end note]

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

maxDate (Maximum Date Time Value)

Specifies the maximum date/time value found in a date field.

The possible values for this attribute are defined by the W3C XML Schema dateTime datatype.

maxValue (Maximum Numeric Value)

Specifies the maximum numeric value found in a numeric field.

The possible values for this attribute are defined by the W3C XML Schema double datatype.

minDate (Minimum Date Time)

Specifies the minimum date/time value found in a date field.

The possible values for this attribute are defined by the W3C XML Schema dateTime datatype.

minValue (Minimum Numeric Value)

Specifies the minimum numeric value found in a numeric field.

The possible values for this attribute are defined by the W3C XML Schema double datatype.

[Note: The W3C XML Schema definition of this element’s content model (CT_SharedItems) is located in §A.2. 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

SharedItems Members

DocumentFormat.OpenXml.Spreadsheet Namespace