PivotField
PivotField class
Represents a field in a PivotTable report.
Properties
| Name | Type | Description |
|---|---|---|
| PivotItems | PivotItemCollection | Gets the pivot items of the pivot field |
| GroupSettings | PivotFieldGroupSettings | Gets the group settings of the pivot field. If this field is not grouped, Null will be returned. |
| IsCalculatedField | boolean | Indicates whether the specified PivotTable field is calculated field. |
| IsValueFields | boolean | |
| IsValuesField | boolean | |
| BaseIndex | Number | Represents the PivotField index in the base PivotFields. |
| Position | Number | Represents the index of PivotField in the region. |
| RegionType | Number | The value of the property is PivotFieldType integer constant. |
| Name | String | Represents the name of PivotField. |
| DisplayName | String | Represents the PivotField display name. |
| IsAutoSubtotals | boolean | Indicates whether the specified field shows automatic subtotals. Default is true. |
| DragToColumn | boolean | Indicates whether the specified field can be dragged to the column position. The default value is true. |
| DragToHide | boolean | Indicates whether the specified field can be dragged to the hide position. The default value is true. |
| DragToRow | boolean | Indicates whether the specified field can be dragged to the row position. The default value is true. |
| DragToPage | boolean | Indicates whether the specified field can be dragged to the page position. The default value is true. |
| DragToData | boolean | Indicates whether the specified field can be dragged to the data position. The default value is true. |
| IsMultipleItemSelectionAllowed | boolean | indicates whether the field can have multiple items selected in the page field The default value is false. |
| IsRepeatItemLabels | boolean | Indicates whether repeating labels of the field in the region. The default value is false. |
| IsIncludeNewItemsInFilter | boolean | Indicates whether including new items to the field in manual filter. The default value is false. |
| IsInsertPageBreaksBetweenItems | boolean | Indicates whether inserting page breaks after each item. The default value is false. |
| ShowAllItems | boolean | Indicates whether all items displays in the PivotTable report, even if they don’t contain summary data. show items with |
| NonAutoSortDefault | boolean | Indicates whether a sort operation that will be applied to this pivot field is an autosort operation or a simple data so |
| IsAutoSort | boolean | Indicates whether the specified PivotTable field is automatically sorted. |
| IsAscendSort | boolean | Indicates whether the specified PivotTable field is autosorted ascending. |
| SortSetting | PivotFieldSortSetting | |
| AutoSortField | Number | Represents the index of field which is auto sorted. -1 means PivotField itself,others means the position of the data fie |
| IsAutoShow | boolean | Indicates whether the specified PivotTable field is automatically shown,only valid for excel 2003. |
| IsAscendShow | boolean | Indicates whether the specified PivotTable field is autoshown ascending. |
| AutoShowCount | Number | Represent the number of top or bottom items that are automatically shown in the specified PivotTable field. |
| AutoShowField | Number | Represents auto show field index. -1 means PivotField itself. It should be the index of the data fields. |
| Function | Number | Represents the function used to summarize the PivotTable data field. The value of the property is ConsolidationFunction |
| ShowValuesSetting | PivotShowValuesSetting | Gets the settings of showing values as when the ShowDataAs calculation is in use. |
| DataDisplayFormat | Number | Represents how to display the values in a data field of the pivot report. The value of the property is PivotFieldDataDis |
| BaseFieldIndex | Number | Represents the base field for a custom calculation when the ShowDataAs calculation is in use. NOTE: This property is now |
| BaseItemPosition | Number | Represents the item in the base field for a custom calculation when the ShowDataAs calculation is in use. Valid only for |
| BaseItemIndex | Number | Represents the item in the base field for a custom calculation when the ShowDataAs calculation is in use. Valid only for |
| CurrentPageItem | Number | Represents the current page item showing for the page field (valid only for page fields). |
| InsertBlankRow | boolean | Indicates whether inserting blank line after each item. |
| ShowSubtotalAtTop | boolean | when ShowInOutlineForm is true, then display subtotals at the top of the list of items instead of at the bottom Only wor |
| ShowInOutlineForm | boolean | Indicates whether layout this field in outline form on the Pivot Table view |
| Number | Number | Represents the built-in display format of numbers and dates. |
| NumberFormat | String | Represents the custom display format of numbers and dates. |
| Items | String[] | Get all labels of pivot items in this field. |
| OriginalItems | String[] | Get the original base items; |
| ItemCount | Number | Gets the count of the base items in this pivot field. |
| ShowCompact | boolean | Indicates whether display labels from the next field in the same column on the Pivot Table view |
Methods
| Name | Description |
|---|---|
| isHiddenItemDetail | Gets whether hidding the detail of the specific PivotItem.. |
| hideItemDetail | Sets whether the specific PivotItem in a pivot field is hidden detail. |
| hideDetail | Sets whether the PivotItems in a pivot field is hidden detail.That is collapse/expand this field. |
| hideItem | Sets whether the specific PivotItem in a data field is hidden. |
| addCalculatedItem | Add a calculated formula item to the pivot field. |
Only supports to add calculated item to Row/Column field. | | getMaxValue | | | getMinValue | | | initPivotItems | Init the pivot items of the pivot field | | groupBy | Automatically group the field with internal | | ungroup | Ungroup the pivot field. | | getPivotFilterByType | Gets the pivot filter of the pivot field by type | | getPivotFilters | Gets the pivot filters of the pivot field
NOTE: This method is now obsolete. Instead, please use PivotField.GetFilters( | | getFilters | Gets all pivot filters of this pivot field. | | clearFilter | | | filterTop10 | | | filterByValue | | | filterByLabel | | | filterByDate | | | getCalculatedFieldFormula | Get the formula string of the specified calculated field . | | getFormula | | | setSubtotals | Sets whether the specified field shows that subtotals. | | getSubtotals | Indicates whether showing specified subtotal. | | sortBy | | | showValuesAs | Shows values of data field as different display format when the ShowDataAs calculation is in use.
Only for data field. | | isHiddenItem | Gets whether the specific PivotItem is hidden. |
PivotField.PivotItems property
Gets the pivot items of the pivot field
Type: PivotItemCollection
PivotField.GroupSettings property
Gets the group settings of the pivot field. If this field is not grouped, Null will be returned.
Type: PivotFieldGroupSettings
PivotField.IsCalculatedField property
Indicates whether the specified PivotTable field is calculated field.
Type: boolean
PivotField.IsValueFields property
Type: boolean
PivotField.IsValuesField property
Type: boolean
PivotField.BaseIndex property
Represents the PivotField index in the base PivotFields.
Type: Number
PivotField.Position property
Represents the index of PivotField in the region.
Type: Number
PivotField.RegionType property
The value of the property is PivotFieldType integer constant.
Type: Number
PivotField.Name property
Represents the name of PivotField.
Type: String
PivotField.DisplayName property
Represents the PivotField display name.
Type: String
PivotField.IsAutoSubtotals property
Indicates whether the specified field shows automatic subtotals. Default is true.
Type: boolean
PivotField.DragToColumn property
Indicates whether the specified field can be dragged to the column position. The default value is true.
Type: boolean
PivotField.DragToHide property
Indicates whether the specified field can be dragged to the hide position. The default value is true.
Type: boolean
PivotField.DragToRow property
Indicates whether the specified field can be dragged to the row position. The default value is true.
Type: boolean
PivotField.DragToPage property
Indicates whether the specified field can be dragged to the page position. The default value is true.
Type: boolean
PivotField.DragToData property
Indicates whether the specified field can be dragged to the data position. The default value is true.
Type: boolean
PivotField.IsMultipleItemSelectionAllowed property
indicates whether the field can have multiple items selected in the page field The default value is false.
Type: boolean
PivotField.IsRepeatItemLabels property
Indicates whether repeating labels of the field in the region. The default value is false.
Type: boolean
PivotField.IsIncludeNewItemsInFilter property
Indicates whether including new items to the field in manual filter. The default value is false.
Type: boolean
PivotField.IsInsertPageBreaksBetweenItems property
Indicates whether inserting page breaks after each item. The default value is false.
Type: boolean
PivotField.ShowAllItems property
Indicates whether all items displays in the PivotTable report, even if they don’t contain summary data. show items with no data The default value is false.
Type: boolean
PivotField.NonAutoSortDefault property
Indicates whether a sort operation that will be applied to this pivot field is an autosort operation or a simple data sort.
Type: boolean
PivotField.IsAutoSort property
Indicates whether the specified PivotTable field is automatically sorted.
Type: boolean
PivotField.IsAscendSort property
Indicates whether the specified PivotTable field is autosorted ascending.
Type: boolean
PivotField.SortSetting property
Type: PivotFieldSortSetting
PivotField.AutoSortField property
Represents the index of field which is auto sorted. -1 means PivotField itself,others means the position of the data fields.
Type: Number
PivotField.IsAutoShow property
Indicates whether the specified PivotTable field is automatically shown,only valid for excel 2003.
Type: boolean
PivotField.IsAscendShow property
Indicates whether the specified PivotTable field is autoshown ascending.
Type: boolean
PivotField.AutoShowCount property
Represent the number of top or bottom items that are automatically shown in the specified PivotTable field.
Type: Number
PivotField.AutoShowField property
Represents auto show field index. -1 means PivotField itself. It should be the index of the data fields.
Type: Number
PivotField.Function property
Represents the function used to summarize the PivotTable data field. The value of the property is ConsolidationFunction integer constant.
Type: Number
PivotField.ShowValuesSetting property
Gets the settings of showing values as when the ShowDataAs calculation is in use.
Type: PivotShowValuesSetting
PivotField.DataDisplayFormat property
Represents how to display the values in a data field of the pivot report. The value of the property is PivotFieldDataDisplayFormat integer constant. NOTE: This property is now obsolete. Instead, please use PivotField.PivotShowValuesSetting.CalculationType property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.
Type: Number
PivotField.BaseFieldIndex property
Represents the base field for a custom calculation when the ShowDataAs calculation is in use. NOTE: This property is now obsolete. Instead, please use PivotField.PivotShowValuesSetting.BaseFieldIndex property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.
Type: Number
PivotField.BaseItemPosition property
Represents the item in the base field for a custom calculation when the ShowDataAs calculation is in use. Valid only for data fields. Because PivotItemPosition.Custom is only for read,if you need to set PivotItemPosition.Custom, please set PivotField.BaseItemIndex attribute. The value of the property is PivotItemPosition integer constant. NOTE: This property is now obsolete. Instead, please use PivotField.PivotShowValuesSetting.BaseItemType property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.
Type: Number
PivotField.BaseItemIndex property
Represents the item in the base field for a custom calculation when the ShowDataAs calculation is in use. Valid only for data fields. NOTE: This property is now obsolete. Instead, please use PivotField.PivotShowValuesSetting.BaseItemIndex property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.
Type: Number
PivotField.CurrentPageItem property
Represents the current page item showing for the page field (valid only for page fields).
Type: Number
PivotField.InsertBlankRow property
Indicates whether inserting blank line after each item.
Type: boolean
PivotField.ShowSubtotalAtTop property
when ShowInOutlineForm is true, then display subtotals at the top of the list of items instead of at the bottom Only works when ShowInOutlineForm is true.
Type: boolean
PivotField.ShowInOutlineForm property
Indicates whether layout this field in outline form on the Pivot Table view
Type: boolean
PivotField.Number property
Represents the built-in display format of numbers and dates.
Type: Number
PivotField.NumberFormat property
Represents the custom display format of numbers and dates.
Type: String
PivotField.Items property
Get all labels of pivot items in this field.
Type: String[]
PivotField.OriginalItems property
Get the original base items;
Type: String[]
PivotField.ItemCount property
Gets the count of the base items in this pivot field.
Type: Number
PivotField.ShowCompact property
Indicates whether display labels from the next field in the same column on the Pivot Table view
Type: boolean
isHiddenItemDetail(index)
Gets whether hidding the detail of the specific PivotItem..
| Parameter | Type | Description |
|---|---|---|
| index | Number | The index of the pivotItem in the pivotField. |
Returns: whether the specific PivotItem is hidden detail
hideItemDetail(index, isHiddenDetail)
Sets whether the specific PivotItem in a pivot field is hidden detail.
| Parameter | Type | Description |
|---|---|---|
| index | Number | the index of the pivotItem in the pivotField. |
| isHiddenDetail | boolean | whether the specific PivotItem is hidden |
hideDetail(isHiddenDetail)
Sets whether the PivotItems in a pivot field is hidden detail.That is collapse/expand this field.
| Parameter | Type | Description |
|---|---|---|
| isHiddenDetail | boolean | Whether hide the detail of the pivot field. |
hideItem(itemValue, isHidden) (1 of 2)
Sets whether the specific PivotItem in a data field is hidden.
| Parameter | Type | Description |
|---|---|---|
| itemValue | String | the value of the pivotItem in the pivotField. |
| isHidden | boolean | whether the specific PivotItem is hidden |
hideItem(index, isHidden) (2 of 2)
Sets whether the specific PivotItem in a data field is hidden.
| Parameter | Type | Description |
|---|---|---|
| index | Number | the index of the pivotItem in the pivotField. |
| isHidden | boolean | whether the specific PivotItem is hidden |
addCalculatedItem(name, formula)
Add a calculated formula item to the pivot field.
Only supports to add calculated item to Row/Column field.
| Parameter | Type | Description |
|---|---|---|
| name | String | The item’s name. |
| formula | String | The formula of pivot item. |
getMaxValue()
getMinValue()
initPivotItems()
Init the pivot items of the pivot field
groupBy(interval, newField) (1 of 7)
Automatically group the field with internal
| Parameter | Type | Description |
|---|---|---|
| interval | Number | The internal of group. Automatic value will be assigned if it’s zero, |
| newField | boolean | Indicates whether adding a new field to the pivottable. |
groupBy(groups, interval, newField) (2 of 7)
groupBy(start, end, groups, interval, firstAsNewField) (3 of 7)
Group the file by the date group types.
| Parameter | Type | Description |
|---|---|---|
| start | DateTime | The start datetime |
| end | DateTime | The end of datetime |
| groups | Number Array | Group types |
| interval | Number | The interval |
| firstAsNewField | boolean | Indicates whether adding a new field to the pivottable. Only for the first group item. |
groupBy(isAutoStart, start, isAutoEnd, end, groups, interval, firstAsNewField) (4 of 7)
groupBy(start, end, interval, newField) (5 of 7)
Group the file by number.
| Parameter | Type | Description |
|---|---|---|
| start | Number | The start value |
| end | Number | The end of value |
| interval | Number | The interval |
| newField | boolean | Indicates whether adding a new field to the pivottable |
groupBy(isAutoStart, start, isAutoEnd, end, interval, newField) (6 of 7)
groupBy(customGroupItems, newField) (7 of 7)
Custom group the field.
| Parameter | Type | Description |
|---|---|---|
| customGroupItems | CustomPiovtFieldGroupItem[] | The custom group items. |
| newField | boolean | Indicates whether adding a new field to the pivottable |
ungroup()
Ungroup the pivot field.
getPivotFilterByType(type)
Gets the pivot filter of the pivot field by type
getPivotFilters()
Gets the pivot filters of the pivot field
NOTE: This method is now obsolete. Instead, please use PivotField.GetFilters() method. This method will be removed 12 months later since November 2023. Aspose apologizes for any inconvenience you may have experienced.
getFilters()
Gets all pivot filters of this pivot field.
clearFilter()
filterTop10(valueFieldIndex, type, isTop, itemCount)
filterByValue(valueFieldIndex, type, value1, value2)
filterByLabel(type, label1, label2)
filterByDate(type, dateTime1, dateTime2)
getCalculatedFieldFormula()
Get the formula string of the specified calculated field .
getFormula()
setSubtotals(subtotalType, shown)
Sets whether the specified field shows that subtotals.
| Parameter | Type | Description |
|---|---|---|
| subtotalType | Number | A PivotFieldSubtotalType value. subtotals type. |
| shown | boolean | whether the specified field shows that subtotals. |
getSubtotals(subtotalType)
Indicates whether showing specified subtotal.
| Parameter | Type | Description |
|---|---|---|
| subtotalType | Number | A PivotFieldSubtotalType value. subtotal type. |
Returns: Returns whether showing specified subtotal.
sortBy(sortType, fieldSortedBy) (1 of 2)
sortBy(sortType, fieldSortedBy, dataType, cellName) (2 of 2)
showValuesAs(displayFormat, baseField, baseItemPositionType, baseItem)
Shows values of data field as different display format when the ShowDataAs calculation is in use.
Only for data field.
| Parameter | Type | Description |
|---|---|---|
| displayFormat | Number | A PivotFieldDataDisplayFormat value. The data display format type. |
| baseField | Number | The index to the field which ShowDataAs calculation bases on. |
| baseItemPositionType | Number | A PivotItemPositionType value. The position type of base iteam. |
| baseItem | Number | The index to the base item which ShowDataAs calculation bases on. Only works when baseItemPositionType is custom. |
isHiddenItem(index)
Gets whether the specific PivotItem is hidden.
| Parameter | Type | Description |
|---|---|---|
| index | Number | The index of the pivotItem in the pivotField. |
Returns: whether the specific PivotItem is hidden