PivotField

PivotField class

Represents a field in a PivotTable report.

Properties

NameTypeDescription
PivotItemsPivotItemCollectionGets the pivot items of the pivot field
GroupSettingsPivotFieldGroupSettingsGets the group settings of the pivot field. If this field is not grouped, Null will be returned.
IsCalculatedFieldbooleanIndicates whether the specified PivotTable field is calculated field.
IsValueFieldsboolean
IsValuesFieldboolean
BaseIndexNumberRepresents the PivotField index in the base PivotFields.
PositionNumberRepresents the index of PivotField in the region.
RegionTypeNumberThe value of the property is PivotFieldType integer constant.
NameStringRepresents the name of PivotField.
DisplayNameStringRepresents the PivotField display name.
IsAutoSubtotalsbooleanIndicates whether the specified field shows automatic subtotals. Default is true.
DragToColumnbooleanIndicates whether the specified field can be dragged to the column position. The default value is true.
DragToHidebooleanIndicates whether the specified field can be dragged to the hide position. The default value is true.
DragToRowbooleanIndicates whether the specified field can be dragged to the row position. The default value is true.
DragToPagebooleanIndicates whether the specified field can be dragged to the page position. The default value is true.
DragToDatabooleanIndicates whether the specified field can be dragged to the data position. The default value is true.
IsMultipleItemSelectionAllowedbooleanindicates whether the field can have multiple items selected in the page field The default value is false.
IsRepeatItemLabelsbooleanIndicates whether repeating labels of the field in the region. The default value is false.
IsIncludeNewItemsInFilterbooleanIndicates whether including new items to the field in manual filter. The default value is false.
IsInsertPageBreaksBetweenItemsbooleanIndicates whether inserting page breaks after each item. The default value is false.
ShowAllItemsbooleanIndicates whether all items displays in the PivotTable report, even if they don’t contain summary data. show items with
NonAutoSortDefaultbooleanIndicates whether a sort operation that will be applied to this pivot field is an autosort operation or a simple data so
IsAutoSortbooleanIndicates whether the specified PivotTable field is automatically sorted.
IsAscendSortbooleanIndicates whether the specified PivotTable field is autosorted ascending.
SortSettingPivotFieldSortSetting
AutoSortFieldNumberRepresents the index of field which is auto sorted. -1 means PivotField itself,others means the position of the data fie
IsAutoShowbooleanIndicates whether the specified PivotTable field is automatically shown,only valid for excel 2003.
IsAscendShowbooleanIndicates whether the specified PivotTable field is autoshown ascending.
AutoShowCountNumberRepresent the number of top or bottom items that are automatically shown in the specified PivotTable field.
AutoShowFieldNumberRepresents auto show field index. -1 means PivotField itself. It should be the index of the data fields.
FunctionNumberRepresents the function used to summarize the PivotTable data field. The value of the property is ConsolidationFunction
ShowValuesSettingPivotShowValuesSettingGets the settings of showing values as when the ShowDataAs calculation is in use.
DataDisplayFormatNumberRepresents how to display the values in a data field of the pivot report. The value of the property is PivotFieldDataDis
BaseFieldIndexNumberRepresents the base field for a custom calculation when the ShowDataAs calculation is in use. NOTE: This property is now
BaseItemPositionNumberRepresents the item in the base field for a custom calculation when the ShowDataAs calculation is in use. Valid only for
BaseItemIndexNumberRepresents the item in the base field for a custom calculation when the ShowDataAs calculation is in use. Valid only for
CurrentPageItemNumberRepresents the current page item showing for the page field (valid only for page fields).
InsertBlankRowbooleanIndicates whether inserting blank line after each item.
ShowSubtotalAtTopbooleanwhen ShowInOutlineForm is true, then display subtotals at the top of the list of items instead of at the bottom Only wor
ShowInOutlineFormbooleanIndicates whether layout this field in outline form on the Pivot Table view
NumberNumberRepresents the built-in display format of numbers and dates.
NumberFormatStringRepresents the custom display format of numbers and dates.
ItemsString[]Get all labels of pivot items in this field.
OriginalItemsString[]Get the original base items;
ItemCountNumberGets the count of the base items in this pivot field.
ShowCompactbooleanIndicates whether display labels from the next field in the same column on the Pivot Table view

Methods

NameDescription
isHiddenItemDetailGets whether hidding the detail of the specific PivotItem..
hideItemDetailSets whether the specific PivotItem in a pivot field is hidden detail.
hideDetailSets whether the PivotItems in a pivot field is hidden detail.That is collapse/expand this field.
hideItemSets whether the specific PivotItem in a data field is hidden.
addCalculatedItemAdd 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..

ParameterTypeDescription
indexNumberThe 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.

ParameterTypeDescription
indexNumberthe index of the pivotItem in the pivotField.
isHiddenDetailbooleanwhether the specific PivotItem is hidden

hideDetail(isHiddenDetail)

Sets whether the PivotItems in a pivot field is hidden detail.That is collapse/expand this field.

ParameterTypeDescription
isHiddenDetailbooleanWhether hide the detail of the pivot field.

hideItem(itemValue, isHidden) (1 of 2)

Sets whether the specific PivotItem in a data field is hidden.

ParameterTypeDescription
itemValueStringthe value of the pivotItem in the pivotField.
isHiddenbooleanwhether the specific PivotItem is hidden

hideItem(index, isHidden) (2 of 2)

Sets whether the specific PivotItem in a data field is hidden.

ParameterTypeDescription
indexNumberthe index of the pivotItem in the pivotField.
isHiddenbooleanwhether 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.

ParameterTypeDescription
nameStringThe item’s name.
formulaStringThe 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

ParameterTypeDescription
intervalNumberThe internal of group. Automatic value will be assigned if it’s zero,
newFieldbooleanIndicates 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.

ParameterTypeDescription
startDateTimeThe start datetime
endDateTimeThe end of datetime
groupsNumber ArrayGroup types
intervalNumberThe interval
firstAsNewFieldbooleanIndicates 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.

ParameterTypeDescription
startNumberThe start value
endNumberThe end of value
intervalNumberThe interval
newFieldbooleanIndicates 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.

ParameterTypeDescription
customGroupItemsCustomPiovtFieldGroupItem[]The custom group items.
newFieldbooleanIndicates 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.

ParameterTypeDescription
subtotalTypeNumberA PivotFieldSubtotalType value. subtotals type.
shownbooleanwhether the specified field shows that subtotals.

getSubtotals(subtotalType)

Indicates whether showing specified subtotal.

ParameterTypeDescription
subtotalTypeNumberA 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.

ParameterTypeDescription
displayFormatNumberA PivotFieldDataDisplayFormat value. The data display format type.
baseFieldNumberThe index to the field which ShowDataAs calculation bases on.
baseItemPositionTypeNumberA PivotItemPositionType value. The position type of base iteam.
baseItemNumberThe 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.

ParameterTypeDescription
indexNumberThe index of the pivotItem in the pivotField.

Returns: whether the specific PivotItem is hidden