Udostępnij za pośrednictwem


CacheField Class

Definition

PivotCache Field.

This class is available in Office 2007 and above.

When the object is serialized out as xml, it's qualified name is x:cacheField.

[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.SharedItems))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.FieldGroup))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.MemberPropertiesMap))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.CacheFieldExtensionList))]
[DocumentFormat.OpenXml.OfficeAvailability(DocumentFormat.OpenXml.FileFormatVersions.Office2007)]
[DocumentFormat.OpenXml.SchemaAttr(22, "cacheField")]
public class CacheField : DocumentFormat.OpenXml.OpenXmlCompositeElement
public class CacheField : DocumentFormat.OpenXml.OpenXmlCompositeElement
[DocumentFormat.OpenXml.SchemaAttr(22, "cacheField")]
public class CacheField : DocumentFormat.OpenXml.OpenXmlCompositeElement
[DocumentFormat.OpenXml.SchemaAttr("x:cacheField")]
public class CacheField : DocumentFormat.OpenXml.OpenXmlCompositeElement
[DocumentFormat.OpenXml.SchemaAttr("x:cacheField")]
public class CacheField : DocumentFormat.OpenXml.TypedOpenXmlCompositeElement
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.SharedItems))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.FieldGroup))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.MemberPropertiesMap))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.CacheFieldExtensionList))]
public class CacheField : DocumentFormat.OpenXml.OpenXmlCompositeElement
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.SharedItems))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.FieldGroup))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.MemberPropertiesMap))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.CacheFieldExtensionList))]
[DocumentFormat.OpenXml.OfficeAvailability(DocumentFormat.OpenXml.FileFormatVersions.Office2007)]
public class CacheField : DocumentFormat.OpenXml.OpenXmlCompositeElement
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.SharedItems))>]
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.FieldGroup))>]
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.MemberPropertiesMap))>]
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.CacheFieldExtensionList))>]
[<DocumentFormat.OpenXml.OfficeAvailability(DocumentFormat.OpenXml.FileFormatVersions.Office2007)>]
[<DocumentFormat.OpenXml.SchemaAttr(22, "cacheField")>]
type CacheField = class
    inherit OpenXmlCompositeElement
type CacheField = class
    inherit OpenXmlCompositeElement
[<DocumentFormat.OpenXml.SchemaAttr(22, "cacheField")>]
type CacheField = class
    inherit OpenXmlCompositeElement
[<DocumentFormat.OpenXml.SchemaAttr("x:cacheField")>]
type CacheField = class
    inherit OpenXmlCompositeElement
[<DocumentFormat.OpenXml.SchemaAttr("x:cacheField")>]
type CacheField = class
    inherit TypedOpenXmlCompositeElement
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.SharedItems))>]
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.FieldGroup))>]
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.MemberPropertiesMap))>]
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.CacheFieldExtensionList))>]
type CacheField = class
    inherit OpenXmlCompositeElement
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.SharedItems))>]
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.FieldGroup))>]
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.MemberPropertiesMap))>]
[<DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Spreadsheet.CacheFieldExtensionList))>]
[<DocumentFormat.OpenXml.OfficeAvailability(DocumentFormat.OpenXml.FileFormatVersions.Office2007)>]
type CacheField = class
    inherit OpenXmlCompositeElement
Public Class CacheField
Inherits OpenXmlCompositeElement
Public Class CacheField
Inherits TypedOpenXmlCompositeElement
Inheritance
Inheritance
Attributes

Remarks

[ISO/IEC 29500-1 1st Edition]

cacheField (PivotCache Field)

Represent a single field in the PivotCache. This definition contains information about the field, such as its source, data type, and location within a level or hierarchy. The sharedItems element stores additional information about the data in this field. If there are no shared items, then values are stored directly in the pivotCacheRecords part.

[Example:

<cacheField name="Group" numFmtId="0">  
  <sharedItems count="3">  
    <s v="Pacific"/>  
    <s v="North America"/>  
    <s v="Europe"/>  
  </sharedItems>  
</cacheField>  

end example]

Parent Elements
cacheFields (§18.10.1.4)
Child Elements Subclause
extLst (Future Feature Data Storage Area) §18.2.10
fieldGroup (Field Group Properties) §18.10.1.30
mpMap (Member Properties Map) §18.10.1.58
sharedItems (Shared Items) §18.10.1.90
Attributes Description
caption (PivotCache Field Caption) Specifies the caption of the cache field.

The possible values for this attribute are defined by the ST_Xstring simple type (§22.9.2.19).
databaseField (Database Field) Specifies a boolean value that indicates whether this field came from the source database rather having been created by the application.

A value of 1 or true indicates the field is from the source database.

A value of 0 or false indicates the field was created by the application.

[Note: This attribute could be used for a defined grouped or calculated field. In this case, source database fields should precede defined grouped or calculated fields. end note]

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.
formula (Calculated Field Formula) Specifies the formula for the calculated field. This formula is specified by the end-user. Calculated fields can perform calculations by using the contents of other fields in the PivotTable.

In formulas you create for calculated fields or calculated items, you can use operators and expressions as you do in other worksheet formulas. You can use constants and refer to data from the PivotTable, but you cannot use cell references or defined names. You cannot use worksheet functions that require cell references or defined names as arguments, and you cannot use array functions.

Further behaviors and restrictions apply to formulas for calculated fields:

- Formulas for calculated fields operate on the sum of the underlying data for any fields in the formula. [Example: The formula =Sales * 1.2 multiplies the sum of the sales for each type and region by 1.2; it does not multiply each individual sale by 1.2 and then sum the multiplied amounts. end example]
- Formulas cannot refer to totals.

For more information about formulas see §18.17 in Formulas. For more information about defined names see §18.2.6 in Workbook.

The possible values for this attribute are defined by the ST_Xstring simple type (§22.9.2.19).
hierarchy (Hierarchy) Specifies the hierarchy that this field is part of.

The possible values for this attribute are defined by the W3C XML Schema int datatype.
level (Hierarchy Level) Specifies the hierarchy level that this field is part of.

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.
mappingCount (Member Property Count) Specifies the number of property mappings for this field.

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.
memberPropertyField (Member Property Field) Specifies a boolean value that indicates whether the field contains OLAP member property information.

A value of 1 or true indicates this field contains OLAP member property information.

A value of 0 or false indicates this field does not contain OLAP member property information.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.
name (PivotCache Field Name) Specifies the name of the cache field.

The possible values for this attribute are defined by the ST_Xstring simple type (§22.9.2.19).
numFmtId (Number Format Id) Specifies the number format that is applied to all items in the field. Number formats are written to the styles part. For more information see §18.8.31 in Styles.

[Note: Formatting information provided by cell table and by PivotTable need not agree. If the two formats differ, the cell-level formatting takes precedence. If you change the layout of the PivotTable, the PivotTable formatting will then take precedence. end note]

The possible values for this attribute are defined by the ST_NumFmtId simple type (§18.18.47).
propertyName (Property Name) Specifies the name of the property if this field is an OLAP property field.

The possible values for this attribute are defined by the ST_Xstring simple type (§22.9.2.19).
serverField (Server-based Field) Specifies a boolean value that indicates whether the field is a server-based page field.

A value of 1 or true indicates this field is a server-based page field.

A value of 0 or false indicates this field is not a server-based page field.

This attribute applies to ODBC sources only.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.
sqlType (SQL Data Type) Specifies the SQL data type of the field. This attribute stores an

ODBC data type and applies to ODBC data sources only. A value is supplied for this attribute only if it is provided to the application.

The following are data types supported by ODBC. For a more information, see the ODBC specification.

- 0 SQL_UNKNOWN_TYPE
- 1 SQL_
- 2 SQL_VARCHAR
- -1 SQL_LONGVARCHAR
- -8 SQL_WCHAR
- -9 SQL_WVARCHAR
- -10 SQL_WLONGVARCHAR
- 3 SQL_DECIMAL
- 2 SQL_NUMERIC
- 5 SQL_SMALLINT
- 4 SQL_INTEGER
- 7 SQL_
- 6 SQL_FLOAT
- 8 SQL_DOUBLE
- -7 SQL_
- -6 SQL_TINYINT
- -5 SQL_BIGINT
- -2 SQL_BINARY
- -3 SQL_VARBINARY
- -4 SQL_LONGVARBINARY
- 9 SQL_TYPE_DATE or SQL_DATE
- 10 SQL_TYPE_TIME or SQL_TIME
- 11 SQL_TYPE_TIMESTAMP or SQL_TIMESTAMP
- 102 SQL_INTERVAL_MONTH
- 101 SQL_INTERVAL_YEAR
- 107 SQL_INTERVAL_YEAR_TO_MONTH
- 103 SQL_INTERVAL_DAY
- 104 SQL_INTERVAL_HOUR
- 105 SQL_INTERVAL_MINUTE
- 106 SQL_INTERVAL_SECOND
- 108 SQL_INTERVAL_DAY_TO_HOUR
- 109 SQL_INTERVAL_DAY_TO_MINUTE
- 110 SQL_INTERVAL_DAY_TO_SECOND
- 111 SQL_INTERVAL_HOUR_TO_MINUTE
- 112 SQL_INTERVAL_HOUR_TO_SECOND
- 113 SQL_INTERVAL_MINUTE_TO_SECOND
- -11 SQL_GUID
- -20 SQL_SIGNED_OFFSET
- -22 SQL_UNSIGNED_OFFSET

The possible values for this attribute are defined by the W3C XML Schema int datatype.
uniqueList (Unique List Retrieved) Specifies a boolean value that indicates whether the application was able to get a list of unique items for the field. The attribute only applies to PivotTables that use ODBC and is intended to be used in conjunction with optimization features in the application. [Example: the application can optimize memory usage when populating PivotCache records if it has a list of unique items for a field before all the records are retrieved from ODBC. end example]

A value of 1 or true indicates the application was able to get a list of unique values for the field.

A value of 0 or false indicates the application was unable to get a list of unique values for the field.

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

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

� ISO/IEC29500: 2008.

Constructors

CacheField()

Initializes a new instance of the CacheField class.

CacheField(IEnumerable<OpenXmlElement>)

Initializes a new instance of the CacheField class with the specified child elements.

CacheField(OpenXmlElement[])

Initializes a new instance of the CacheField class with the specified child elements.

CacheField(String)

Initializes a new instance of the CacheField class from outer XML.

Properties

Caption

caption

Represents the following attribute in the schema: caption

ChildElements

Gets all the child nodes of the current element.

(Inherited from OpenXmlElement)
DatabaseField

databaseField

Represents the following attribute in the schema: databaseField

ExtendedAttributes

Gets all extended attributes (attributes not defined in the schema) of the current element.

(Inherited from OpenXmlElement)
Features

Gets a IFeatureCollection for the current element. This feature collection will be read-only, but will inherit features from its parent part and package if available.

(Inherited from OpenXmlElement)
FieldGroup

FieldGroup.

Represents the following element tag in the schema: x:fieldGroup.

FirstChild

Gets the first child of the current OpenXmlElement element.

(Inherited from OpenXmlCompositeElement)
Formula

formula

Represents the following attribute in the schema: formula

HasAttributes

Gets a value indicating whether the current element has any attributes.

(Inherited from OpenXmlElement)
HasChildren

Gets a value that indicates whether the current element has any child elements.

(Inherited from OpenXmlCompositeElement)
Hierarchy

hierarchy

Represents the following attribute in the schema: hierarchy

InnerText

Gets or sets the concatenated values of the current node and all of its children.

(Inherited from OpenXmlCompositeElement)
InnerXml

Gets or sets the markup that represents only the child nodes of the current node.

(Inherited from OpenXmlCompositeElement)
LastChild

Gets the last child of the current OpenXmlElement element. Returns null (Nothing in Visual Basic) if there is no such OpenXmlElement element.

(Inherited from OpenXmlCompositeElement)
Level

level

Represents the following attribute in the schema: level

LocalName
LocalName

Gets the local name of the current element.

(Inherited from OpenXmlElement)
MappingCount

mappingCount

Represents the following attribute in the schema: mappingCount

MCAttributes

Gets or sets the markup compatibility attributes. Returns null if no markup compatibility attributes are defined for the current element.

(Inherited from OpenXmlElement)
MemberPropertyField

memberPropertyField

Represents the following attribute in the schema: memberPropertyField

Name

name

Represents the following attribute in the schema: name

NamespaceDeclarations

Gets all the namespace declarations defined in the current element. Returns an empty enumerator if there is no namespace declaration.

(Inherited from OpenXmlElement)
NamespaceUri

Gets the namespace URI of the current element.

(Inherited from OpenXmlElement)
NumberFormatId

numFmtId

Represents the following attribute in the schema: numFmtId

OpenXmlElementContext

Gets the OpenXmlElementContext of the current element.

(Inherited from OpenXmlElement)
OuterXml

Gets the markup that represents the current element and all of its child elements.

(Inherited from OpenXmlElement)
Parent

Gets the parent element of the current element.

(Inherited from OpenXmlElement)
Prefix

Gets the namespace prefix of current element.

(Inherited from OpenXmlElement)
PropertyName

propertyName

Represents the following attribute in the schema: propertyName

ServerField

serverField

Represents the following attribute in the schema: serverField

SharedItems

SharedItems.

Represents the following element tag in the schema: x:sharedItems.

SqlType

sqlType

Represents the following attribute in the schema: sqlType

UniqueList

uniqueList

Represents the following attribute in the schema: uniqueList

XmlQualifiedName

Gets the qualified name of the current element.

(Inherited from OpenXmlElement)
XName

Gets the qualified name of the current element.

(Inherited from OpenXmlElement)

Methods

AddAnnotation(Object)

Adds an object to the current OpenXmlElement element's list of annotations.

(Inherited from OpenXmlElement)
AddChild(OpenXmlElement, Boolean)

Adds the specified element to the element if it is a known child. This adds the element in the correct location according to the schema.

(Inherited from OpenXmlCompositeElement)
AddNamespaceDeclaration(String, String)

Adds a namespace declaration to the current node.

(Inherited from OpenXmlElement)
Ancestors()

Enumerates all of the current element's ancestors.

(Inherited from OpenXmlElement)
Ancestors<T>()

Enumerates only the current element's ancestors that have the specified type.

(Inherited from OpenXmlElement)
Annotation(Type)

Get the first annotation object of the specified type from the current OpenXmlElement element.

(Inherited from OpenXmlElement)
Annotation<T>()

Get the first annotation object of the specified type from the current OpenXmlElement element.

(Inherited from OpenXmlElement)
Annotations(Type)

Gets a collection of annotations with the specified type for the current OpenXmlElement element.

(Inherited from OpenXmlElement)
Annotations<T>()

Gets a collection of annotations with the specified type for the current OpenXmlElement element.

(Inherited from OpenXmlElement)
Append(IEnumerable<OpenXmlElement>)

Appends each element from a list of elements to the end of the current element's list of child elements.

(Inherited from OpenXmlElement)
Append(OpenXmlElement[])

Appends each element from an array of elements to the end of the current element's list of child elements.

(Inherited from OpenXmlElement)
AppendChild<T>(T)

Appends the specified element to the end of the current element's list of child nodes.

(Inherited from OpenXmlCompositeElement)
ClearAllAttributes()

Clears all of the attributes, including both known attributes and extended attributes.

(Inherited from OpenXmlElement)
Clone()

Creates a duplicate of the current node.

(Inherited from OpenXmlElement)
CloneNode(Boolean)

Creates a duplicate of this node.

Descendants()

Enumerates all of the current element's descendants.

(Inherited from OpenXmlElement)
Descendants<T>()

Enumerate all of the current element's descendants of type T.

(Inherited from OpenXmlElement)
Elements()

Enumerates all of the current element's children.

(Inherited from OpenXmlElement)
Elements<T>()

Enumerates only the current element's children that have the specified type.

(Inherited from OpenXmlElement)
ElementsAfter()

Enumerates all of the sibling elements that follow the current element and have the same parent as the current element.

(Inherited from OpenXmlElement)
ElementsBefore()

Enumerates all of the sibling elements that precede the current element and have the same parent as the current element.

(Inherited from OpenXmlElement)
GetAttribute(String, String)

Gets an Open XML attribute with the specified tag name and namespace URI.

(Inherited from OpenXmlElement)
GetAttributes()

Gets a list that contains a copy of all the attributes.

(Inherited from OpenXmlElement)
GetEnumerator()

Returns an enumerator that iterates through the child collection.

(Inherited from OpenXmlElement)
GetFirstChild<T>()

Finds the first child element in type T.

(Inherited from OpenXmlElement)
InsertAfter<T>(T, OpenXmlElement)

Inserts the specified element immediately after the specified reference element.

(Inherited from OpenXmlCompositeElement)
InsertAfterSelf<T>(T)

Inserts the specified element immediately after the current element.

(Inherited from OpenXmlElement)
InsertAt<T>(T, Int32)

Inserts the specified element at the specified index of the current element's children.

(Inherited from OpenXmlCompositeElement)
InsertBefore<T>(T, OpenXmlElement)

Inserts the specified element immediately before the specified reference element.

(Inherited from OpenXmlCompositeElement)
InsertBeforeSelf<T>(T)

Inserts the specified element immediately before the current element.

(Inherited from OpenXmlElement)
IsAfter(OpenXmlElement)

Determines if the current element appears after a specified element in document order.

(Inherited from OpenXmlElement)
IsBefore(OpenXmlElement)

Determines if the current element appears before a specified element in document order.

(Inherited from OpenXmlElement)
LookupNamespace(String)

Resolves the namespace prefix in the context of the current node.

(Inherited from OpenXmlElement)
LookupPrefix(String)

Finds the corresponding prefix for a namespace uri in the current element scope.

(Inherited from OpenXmlElement)
NextSibling()

Gets the OpenXmlElement element that immediately follows the current OpenXmlElement element. Returns null (Nothing in Visual Basic) if there is no next OpenXmlElement element.

(Inherited from OpenXmlElement)
NextSibling<T>()

Gets the OpenXmlElement element with the specified type that follows the current OpenXmlElement element. Returns null (Nothing in Visual Basic) if there is no next OpenXmlElement.

(Inherited from OpenXmlElement)
PrependChild<T>(T)

Inserts the specified element at the beginning of the current element's list of child nodes.

(Inherited from OpenXmlCompositeElement)
PreviousSibling()

Gets the OpenXmlElement element that immediately precedes the current OpenXmlElement element. Returns null (Nothing in Visual Basic ) if there is no preceding OpenXmlElement element.

(Inherited from OpenXmlElement)
PreviousSibling<T>()

Gets the OpenXmlElement element with the specified type that precedes the current OpenXmlElement. Returns null (Nothing in Visual Basic) if there is no preceding OpenXmlElement element.

(Inherited from OpenXmlElement)
Remove()

Removes the current element from its parent.

(Inherited from OpenXmlElement)
RemoveAllChildren()

Removes all of the current element's child elements.

(Inherited from OpenXmlCompositeElement)
RemoveAllChildren<T>()

Remove all of the current element's child elements that are of type T.

(Inherited from OpenXmlElement)
RemoveAnnotations(Type)

Removes the annotations of the specified type from the current OpenXmlElement element.

(Inherited from OpenXmlElement)
RemoveAnnotations<T>()

Removes the annotations with the specified type from the current OpenXmlElement element.

(Inherited from OpenXmlElement)
RemoveAttribute(String, String)

Removes the attribute from the current element.

(Inherited from OpenXmlElement)
RemoveChild<T>(T)

Removes the specified child element.

(Inherited from OpenXmlCompositeElement)
RemoveNamespaceDeclaration(String)

Removes the namespace declaration for the specified prefix. Removes nothing if there is no prefix.

(Inherited from OpenXmlElement)
ReplaceChild<T>(OpenXmlElement, T)

Replaces one of the current element's child elements with another OpenXmlElement element.

(Inherited from OpenXmlCompositeElement)
SetAttribute(OpenXmlAttribute)

Sets an attribute to the specified element. If the attribute is a known attribute, the value of the attribute is set. If the attribute is an extended attribute, the 'openxmlAttribute' is added to the extended attributes list.

(Inherited from OpenXmlElement)
SetAttributes(IEnumerable<OpenXmlAttribute>)

Sets a number of attributes to the element. If an attribute is a known attribute, the value of the attribute is set. If an attribute is an extended attribute, the 'openxmlAttribute' is added to the extended attributes list.

(Inherited from OpenXmlElement)
WriteTo(XmlWriter)

Saves the current node to the specified XmlWriter.

(Inherited from OpenXmlElement)

Explicit Interface Implementations

IEnumerable.GetEnumerator() (Inherited from OpenXmlElement)
IEnumerable<OpenXmlElement>.GetEnumerator()

Returns an enumerator that iterates through the child collection.

(Inherited from OpenXmlElement)

Applies to