DataField Class

Data Field Item.When the object is serialized out as xml, its qualified name is x:dataField.

Inheritance Hierarchy

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

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

Syntax

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

Remarks

The following table lists the possible child types:

  • DataFieldExtensionList <x:extLst>

[ISO/IEC 29500-1 1st Edition]

18.10.1.22 dataField (Data Field Item)

Represents a field from a source list, table, or database that contains data that is summarized in a PivotTable.

DocumentFormat.OpenXml.Spreadsheet.DataField-image

A data field represents data that is derived from a field in the source list or database. [Example: The Sport field, for example, might come from a column in the source list that is labeled Sport and contains the names of various sports (Golf, Tennis) for which the source list has sales figures. end example]

Source data can be taken from an SpreadsheetML list or range, an external database or cube, or another PivotTable. Data fields use summary functions to combine values from the underlying source data. You can also use custom calculations to compare data values, or add your own formulas that use elements of the report or other worksheet data.

[Example:

<dataFields count="1">
<dataField name="Sum of Sales Amount" fld="25" baseField="0" baseItem="0"/>
</dataFields>

end example]

Parent Elements

dataFields (§18.10.1.23)

Child Elements

Subclause

extLst (Future Feature Data Storage Area)

§18.2.10

Attributes

Description

baseField ('Show Data As' Base Field)

Specifies the index to the base field when the ShowDataAs calculation is in use.

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

baseItem ('Show Data As' Base Setting)

Specifies the index to the base item when the ShowDataAs calculation is in use.

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

fld (Field)

Specifies the index to the field (<r>) in the pivotCacheRecords part that this data item summarizes.

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

name (Data Field Name)

Specifies the name of the data 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 index to the number format applied to this data field. Number formats are written to the styles part. See the Styles section(§18.8) for more information on number formats.

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 the PivotTable, the PivotTable formatting will then take precedence.

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

showDataAs (Show Data As Display Format)

Specifies the display format for this data field.

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 the PivotTable, the PivotTable formatting will then take precedence.

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

subtotal (Subtotal)

Specifies the aggregation function that applies to this data field.

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

[Note: The W3C XML Schema definition of this element’s content model (CT_DataField) 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

DataField Members

DocumentFormat.OpenXml.Spreadsheet Namespace