PivotField

Inheritance: java.lang.Object

public class PivotField

Represents a field in a PivotTable report.

Example

         Workbook book = new Workbook();
         Worksheet sheet = book.getWorksheets().get(0);
         Cells cells = sheet.getCells();
         cells.get(0, 0).setValue("fruit");
         cells.get(1, 0).setValue("grape");
         cells.get(2, 0).setValue("blueberry");
         cells.get(3, 0).setValue("kiwi");
         cells.get(4, 0).setValue("cherry");
         cells.get(5, 0).setValue("grape");
         cells.get(6, 0).setValue("blueberry");
         cells.get(7, 0).setValue("kiwi");
         cells.get(8, 0).setValue("cherry");
 
         cells.get(0, 1).setValue("year");
         cells.get(1, 1).setValue(2020);
         cells.get(2, 1).setValue(2020);
         cells.get(3, 1).setValue(2020);
         cells.get(4, 1).setValue(2020);
         cells.get(5, 1).setValue(2021);
         cells.get(6, 1).setValue(2021);
         cells.get(7, 1).setValue(2021);
         cells.get(8, 1).setValue(2021);
 
         cells.get(0, 2).setValue("amount");
         cells.get(1, 2).setValue(50);
         cells.get(2, 2).setValue(60);
         cells.get(3, 2).setValue(70);
         cells.get(4, 2).setValue(80);
         cells.get(5, 2).setValue(90);
         cells.get(6, 2).setValue(100);
         cells.get(7, 2).setValue(110);
         cells.get(8, 2).setValue(120);
 
         PivotTableCollection pivots = sheet.getPivotTables();
 
         int pivotIndex = pivots.add("=Sheet1!A1:C9", "A12", "TestPivotTable");
         PivotTable pivot = pivots.get(pivotIndex);
         pivot.addFieldToArea(PivotFieldType.ROW, "fruit");
         pivot.addFieldToArea(PivotFieldType.COLUMN, "year");
         pivot.addFieldToArea(PivotFieldType.DATA, "amount");
 
         pivot.setPivotTableStyleType(PivotTableStyleType.PIVOT_TABLE_STYLE_MEDIUM_10);
 
         //Change PivotField's attributes
         PivotField rowField = pivot.getRowFields().get(0);
         rowField.setDisplayName("custom display name");
 
         pivot.refreshData();
         pivot.calculateData();
 
         //do your business
 
         book.save("out.xlsx");

Methods

MethodDescription
addCalculatedItem(String name, String formula)Add a calculated formula item to the pivot field.
equals(Object arg0)
getAutoShowCount()Represent the number of top or bottom items that are automatically shown in the specified PivotTable field.
getAutoShowField()Represents auto show field index. -1 means PivotField itself.
getAutoSortField()Represents the index of field which is auto sorted
getBaseFieldIndex()Represents the base field for a custom calculation when the ShowDataAs calculation is in use.
getBaseIndex()Represents the PivotField index in the base PivotFields.
getBaseItemIndex()Represents the item in the base field for a custom calculation when the ShowDataAs calculation is in use.
getBaseItemPosition()Represents the item in the base field for a custom calculation when the ShowDataAs calculation is in use.
getCalculatedFieldFormula()Get the formula string of the specified calculated field .
getClass()
getCurrentPageItem()Represents the current page item showing for the page field (valid only for page fields).
getDataDisplayFormat()Represents how to display the values in a data field of the pivot report.
getDisplayName()Represents the PivotField display name.
getDragToColumn()Indicates whether the specified field can be dragged to the column position.
getDragToData()Indicates whether the specified field can be dragged to the data position.
getDragToHide()Indicates whether the specified field can be dragged to the hide position.
getDragToPage()Indicates whether the specified field can be dragged to the page position.
getDragToRow()Indicates whether the specified field can be dragged to the row position.
getFilters()Gets all pivot filters of this pivot field.
getFormula()Gets formula of the calculated field .
getFunction()Represents the function used to summarize the PivotTable data field.
getGroupSettings()Gets the group settings of the pivot field.
getInsertBlankRow()Indicates whether inserting blank line after each item.
getItemCount()Gets the count of the base items in this pivot field.
getItems()Get all labels of pivot items in this field.
getName()Represents the name of PivotField.
getNonAutoSortDefault()Indicates whether a sort operation that will be applied to this pivot field is an autosort operation or a simple data sort.
getNumber()Represents the built-in display format of numbers and dates.
getNumberFormat()Represents the custom display format of numbers and dates.
getOriginalItems()Get the original base items;
getPivotFilterByType(int type)Gets the pivot filter of the pivot field by type
getPivotFilters()Gets the pivot filters of the pivot field
getPivotItems()Gets the pivot items of the pivot field
getPosition()Represents the index of PivotField in the region.
getRange()Gets the group range of the pivot field
getShowAllItems()Indicates whether all items displays in the PivotTable report, even if they don’t contain summary data.
getShowCompact()Indicates whether display labels from the next field in the same column on the Pivot Table view
getShowInOutlineForm()Indicates whether layout this field in outline form on the Pivot Table view
getShowSubtotalAtTop()when ShowInOutlineForm is true, then display subtotals at the top of the list of items instead of at the bottom
getShowValuesSetting()Gets the settings of showing values as when the ShowDataAs calculation is in use.
getSortSetting()Gets all settings of auto sorting
getSubtotals(int subtotalType)Indicates whether showing specified subtotal.
groupBy(CustomPiovtFieldGroupItem[] customGroupItems, boolean newField)Custom group the field.
groupBy(DateTime start, DateTime end, int[] groups, double interval, boolean firstAsNewField)Group the file by the date group types.
groupBy(double interval, boolean newField)Automatically group the field with internal
groupBy(double start, double end, double interval, boolean newField)Group the file by number.
hashCode()
hideDetail(boolean isHiddenDetail)Sets whether the PivotItems in a pivot field is hidden detail.That is collapse/expand this field.
hideItem(int index, boolean isHidden)Sets whether the specific PivotItem in a data field is hidden.
hideItem(String itemValue, boolean isHidden)Sets whether the specific PivotItem in a data field is hidden.
hideItemDetail(int index, boolean isHiddenDetail)Sets whether the specific PivotItem in a pivot field is hidden detail.
initPivotItems()Init the pivot items of the pivot field
isAscendShow()Indicates whether the specified PivotTable field is autoshown ascending.
isAscendSort()Indicates whether the specified PivotTable field is autosorted ascending.
isAutoShow()Indicates whether the specified PivotTable field is automatically shown,only valid for excel 2003.
isAutoSort()Indicates whether the specified PivotTable field is automatically sorted.
isAutoSubtotals()Indicates whether the specified field shows automatic subtotals.
isCalculatedField()Indicates whether the specified PivotTable field is calculated field.
isHiddenItem(int index)Gets whether the specific PivotItem is hidden.
isHiddenItemDetail(int index)Gets whether hidding the detail of the specific PivotItem..
isIncludeNewItemsInFilter()Indicates whether including new items to the field in manual filter.
isInsertPageBreaksBetweenItems()Indicates whether inserting page breaks after each item.
isMultipleItemSelectionAllowed()indicates whether the field can have multiple items selected in the page field The default value is false.
isRepeatItemLabels()Indicates whether repeating labels of the field in the region.
notify()
notifyAll()
setAscendShow(boolean value)Indicates whether the specified PivotTable field is autoshown ascending.
setAscendSort(boolean value)Indicates whether the specified PivotTable field is autosorted ascending.
setAutoShow(boolean value)Indicates whether the specified PivotTable field is automatically shown,only valid for excel 2003.
setAutoShowCount(int value)Represent the number of top or bottom items that are automatically shown in the specified PivotTable field.
setAutoShowField(int value)Represents auto show field index. -1 means PivotField itself.
setAutoSort(boolean value)Indicates whether the specified PivotTable field is automatically sorted.
setAutoSortField(int value)Represents the index of field which is auto sorted
setAutoSubtotals(boolean value)Indicates whether the specified field shows automatic subtotals.
setBaseFieldIndex(int value)Represents the base field for a custom calculation when the ShowDataAs calculation is in use.
setBaseIndex(int value)Represents the PivotField index in the base PivotFields.
setBaseItemIndex(int value)Represents the item in the base field for a custom calculation when the ShowDataAs calculation is in use.
setBaseItemPosition(int value)Represents the item in the base field for a custom calculation when the ShowDataAs calculation is in use.
setCurrentPageItem(short value)Represents the current page item showing for the page field (valid only for page fields).
setDataDisplayFormat(int value)Represents how to display the values in a data field of the pivot report.
setDisplayName(String value)Represents the PivotField display name.
setDragToColumn(boolean value)Indicates whether the specified field can be dragged to the column position.
setDragToData(boolean value)Indicates whether the specified field can be dragged to the data position.
setDragToHide(boolean value)Indicates whether the specified field can be dragged to the hide position.
setDragToPage(boolean value)Indicates whether the specified field can be dragged to the page position.
setDragToRow(boolean value)Indicates whether the specified field can be dragged to the row position.
setFunction(int value)Represents the function used to summarize the PivotTable data field.
setIncludeNewItemsInFilter(boolean value)Indicates whether including new items to the field in manual filter.
setInsertBlankRow(boolean value)Indicates whether inserting blank line after each item.
setInsertPageBreaksBetweenItems(boolean value)Indicates whether inserting page breaks after each item.
setMultipleItemSelectionAllowed(boolean value)indicates whether the field can have multiple items selected in the page field The default value is false.
setName(String value)Represents the name of PivotField.
setNonAutoSortDefault(boolean value)Indicates whether a sort operation that will be applied to this pivot field is an autosort operation or a simple data sort.
setNumber(int value)Represents the built-in display format of numbers and dates.
setNumberFormat(String value)Represents the custom display format of numbers and dates.
setRepeatItemLabels(boolean value)Indicates whether repeating labels of the field in the region.
setShowAllItems(boolean value)Indicates whether all items displays in the PivotTable report, even if they don’t contain summary data.
setShowCompact(boolean value)Indicates whether display labels from the next field in the same column on the Pivot Table view
setShowInOutlineForm(boolean value)Indicates whether layout this field in outline form on the Pivot Table view
setShowSubtotalAtTop(boolean value)when ShowInOutlineForm is true, then display subtotals at the top of the list of items instead of at the bottom
setSubtotals(int subtotalType, boolean shown)Sets whether the specified field shows that subtotals.
showValuesAs(int displayFormat, int baseField, int baseItemPositionType, int baseItem)Shows values of data field as different display format when the ShowDataAs calculation is in use.
sortBy(int sortType, int fieldSortedBy)Sorts this pivot field.
sortBy(int sortType, int fieldSortedBy, int dataType, String cellName)Sorts this pivot field.
toString()
ungroup()Ungroup the pivot field.
wait()
wait(long arg0)
wait(long arg0, int arg1)

addCalculatedItem(String name, String formula)

public void addCalculatedItem(String name, String formula)

Add a calculated formula item to the pivot field.

Remarks

Only supports to add calculated item to Row/Column field.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe item’s name.
formulajava.lang.StringThe formula of pivot item.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getAutoShowCount()

public int getAutoShowCount()

Represent the number of top or bottom items that are automatically shown in the specified PivotTable field.

Returns: int

getAutoShowField()

public int getAutoShowField()

Represents auto show field index. -1 means PivotField itself. It should be the index of the data fields.

Returns: int

getAutoSortField()

public int getAutoSortField()

Represents the index of field which is auto sorted. -1 means PivotField itself,others means the position of the data fields.

Returns: int

getBaseFieldIndex()

public int getBaseFieldIndex()

Represents the base field for a custom calculation when the ShowDataAs calculation is in use.

Remarks

NOTE: This property is now obsolete. Instead, please use PivotField.ShowValuesSetting.BaseFieldIndex property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.

Returns: int

getBaseIndex()

public int getBaseIndex()

Represents the PivotField index in the base PivotFields.

Returns: int

getBaseItemIndex()

public int getBaseItemIndex()

Represents the item in the base field for a custom calculation when the ShowDataAs calculation is in use. Valid only for data fields.

Remarks

NOTE: This property is now obsolete. Instead, please use PivotField.ShowValuesSetting.BaseItemIndex property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.

Returns: int

getBaseItemPosition()

public int getBaseItemPosition()

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.

See PivotItemPosition.

Remarks

NOTE: This property is now obsolete. Instead, please use PivotField.ShowValuesSetting.BaseItemPositionType property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.

Returns: int

getCalculatedFieldFormula()

public String getCalculatedFieldFormula()

Get the formula string of the specified calculated field .

Remarks

NOTE: This method is now obsolete. Instead, please use PivotField.GetFormula() method. This method will be removed 12 months later since August 2024. Aspose apologizes for any inconvenience you may have experienced.

Returns: java.lang.String

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getCurrentPageItem()

public short getCurrentPageItem()

Represents the current page item showing for the page field (valid only for page fields).

Returns: short

getDataDisplayFormat()

public int getDataDisplayFormat()

Represents how to display the values in a data field of the pivot report.

See PivotFieldDataDisplayFormat.

Remarks

NOTE: This property is now obsolete. Instead, please use PivotField.ShowValuesSetting.CalculationType property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.

Returns: int

getDisplayName()

public String getDisplayName()

Represents the PivotField display name.

Returns: java.lang.String

getDragToColumn()

public boolean getDragToColumn()

Indicates whether the specified field can be dragged to the column position. The default value is true.

Returns: boolean

getDragToData()

public boolean getDragToData()

Indicates whether the specified field can be dragged to the data position. The default value is true.

Returns: boolean

getDragToHide()

public boolean getDragToHide()

Indicates whether the specified field can be dragged to the hide position. The default value is true.

Returns: boolean

getDragToPage()

public boolean getDragToPage()

Indicates whether the specified field can be dragged to the page position. The default value is true.

Returns: boolean

getDragToRow()

public boolean getDragToRow()

Indicates whether the specified field can be dragged to the row position. The default value is true.

Returns: boolean

getFilters()

public PivotFilter[] getFilters()

Gets all pivot filters of this pivot field.

Returns: com.aspose.cells.PivotFilter[]

getFormula()

public String getFormula()

Gets formula of the calculated field .

Returns: java.lang.String

getFunction()

public int getFunction()

Represents the function used to summarize the PivotTable data field.

See ConsolidationFunction.

Returns: int

getGroupSettings()

public PivotFieldGroupSettings getGroupSettings()

Gets the group settings of the pivot field.

Remarks

If this field is not grouped, Null will be returned.

Returns: PivotFieldGroupSettings

getInsertBlankRow()

public boolean getInsertBlankRow()

Indicates whether inserting blank line after each item.

Returns: boolean

getItemCount()

public int getItemCount()

Gets the count of the base items in this pivot field.

Returns: int

getItems()

public String[] getItems()

Get all labels of pivot items in this field.

Returns: java.lang.String[]

getName()

public String getName()

Represents the name of PivotField.

Returns: java.lang.String

getNonAutoSortDefault()

public boolean getNonAutoSortDefault()

Indicates whether a sort operation that will be applied to this pivot field is an autosort operation or a simple data sort.

Returns: boolean

getNumber()

public int getNumber()

Represents the built-in display format of numbers and dates.

Returns: int

getNumberFormat()

public String getNumberFormat()

Represents the custom display format of numbers and dates.

Returns: java.lang.String

getOriginalItems()

public String[] getOriginalItems()

Get the original base items;

Returns: java.lang.String[]

getPivotFilterByType(int type)

public PivotFilter getPivotFilterByType(int type)

Gets the pivot filter of the pivot field by type

Parameters:

ParameterTypeDescription
typeint

Returns: PivotFilter

getPivotFilters()

public ArrayList getPivotFilters()

Gets the pivot filters of the pivot field

Remarks

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.

Returns: java.util.ArrayList

getPivotItems()

public PivotItemCollection getPivotItems()

Gets the pivot items of the pivot field

Returns: PivotItemCollection

getPosition()

public int getPosition()

Represents the index of PivotField in the region.

Returns: int

getRange()

public SxRng getRange()

Gets the group range of the pivot field

Remarks

NOTE: This method is now obsolete. Instead, please use PivotField.GroupSettings property. This method will be removed 12 months later since October 2023. Aspose apologizes for any inconvenience you may have experienced.

Returns: SxRng

getShowAllItems()

public boolean getShowAllItems()

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.

Returns: boolean

getShowCompact()

public boolean getShowCompact()

Indicates whether display labels from the next field in the same column on the Pivot Table view

Returns: boolean

getShowInOutlineForm()

public boolean getShowInOutlineForm()

Indicates whether layout this field in outline form on the Pivot Table view

Returns: boolean

getShowSubtotalAtTop()

public boolean getShowSubtotalAtTop()

when ShowInOutlineForm is true, then display subtotals at the top of the list of items instead of at the bottom

Remarks

Only works when ShowInOutlineForm is true.

Returns: boolean

getShowValuesSetting()

public PivotShowValuesSetting getShowValuesSetting()

Gets the settings of showing values as when the ShowDataAs calculation is in use.

Returns: PivotShowValuesSetting

getSortSetting()

public PivotFieldSortSetting getSortSetting()

Gets all settings of auto sorting

Returns: PivotFieldSortSetting

getSubtotals(int subtotalType)

public boolean getSubtotals(int subtotalType)

Indicates whether showing specified subtotal.

Parameters:

ParameterTypeDescription
subtotalTypeintPivotFieldSubtotalType. subtotal type.

Returns: boolean - Returns whether showing specified subtotal.

groupBy(CustomPiovtFieldGroupItem[] customGroupItems, boolean newField)

public boolean groupBy(CustomPiovtFieldGroupItem[] customGroupItems, boolean newField)

Custom group the field.

Parameters:

ParameterTypeDescription
customGroupItemsCustomPiovtFieldGroupItem[]The custom group items.
newFieldbooleanIndicates whether adding a new field to the pivottable

Returns: boolean - False means this field could not be grouped by date time.

groupBy(DateTime start, DateTime end, int[] groups, double interval, boolean firstAsNewField)

public boolean groupBy(DateTime start, DateTime end, int[] groups, double interval, boolean firstAsNewField)

Group the file by the date group types.

Parameters:

ParameterTypeDescription
startDateTimeThe start datetime
endDateTimeThe end of datetime
groupsint[]PivotGroupByType. Group types
intervaldoubleThe interval
firstAsNewFieldbooleanIndicates whether adding a new field to the pivottable. Only for the first group item.

Returns: boolean - False means this field could not be grouped by date time.

groupBy(double interval, boolean newField)

public void groupBy(double interval, boolean newField)

Automatically group the field with internal

Parameters:

ParameterTypeDescription
intervaldoubleThe internal of group. Automatic value will be assigned if it’s zero,
newFieldbooleanIndicates whether adding a new field to the pivottable.

groupBy(double start, double end, double interval, boolean newField)

public boolean groupBy(double start, double end, double interval, boolean newField)

Group the file by number.

Parameters:

ParameterTypeDescription
startdoubleThe start value
enddoubleThe end of value
intervaldoubleThe interval
newFieldbooleanIndicates whether adding a new field to the pivottable

Returns: boolean - False means this field could not be grouped by date time.

hashCode()

public native int hashCode()

Returns: int

hideDetail(boolean isHiddenDetail)

public void hideDetail(boolean isHiddenDetail)

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

Parameters:

ParameterTypeDescription
isHiddenDetailbooleanWhether hide the detail of the pivot field.

hideItem(int index, boolean isHidden)

public void hideItem(int index, boolean isHidden)

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

Parameters:

ParameterTypeDescription
indexintthe index of the pivotItem in the pivotField.
isHiddenbooleanwhether the specific PivotItem is hidden

hideItem(String itemValue, boolean isHidden)

public void hideItem(String itemValue, boolean isHidden)

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

Parameters:

ParameterTypeDescription
itemValuejava.lang.Stringthe value of the pivotItem in the pivotField.
isHiddenbooleanwhether the specific PivotItem is hidden

hideItemDetail(int index, boolean isHiddenDetail)

public void hideItemDetail(int index, boolean isHiddenDetail)

Sets whether the specific PivotItem in a pivot field is hidden detail.

Parameters:

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

initPivotItems()

public void initPivotItems()

Init the pivot items of the pivot field

isAscendShow()

public boolean isAscendShow()

Indicates whether the specified PivotTable field is autoshown ascending.

Returns: boolean

isAscendSort()

public boolean isAscendSort()

Indicates whether the specified PivotTable field is autosorted ascending.

Returns: boolean

isAutoShow()

public boolean isAutoShow()

Indicates whether the specified PivotTable field is automatically shown,only valid for excel 2003.

Returns: boolean

isAutoSort()

public boolean isAutoSort()

Indicates whether the specified PivotTable field is automatically sorted.

Returns: boolean

isAutoSubtotals()

public boolean isAutoSubtotals()

Indicates whether the specified field shows automatic subtotals. Default is true.

Returns: boolean

isCalculatedField()

public boolean isCalculatedField()

Indicates whether the specified PivotTable field is calculated field.

Returns: boolean

isHiddenItem(int index)

public boolean isHiddenItem(int index)

Gets whether the specific PivotItem is hidden.

Parameters:

ParameterTypeDescription
indexintThe index of the pivotItem in the pivotField.

Returns: boolean - whether the specific PivotItem is hidden

isHiddenItemDetail(int index)

public boolean isHiddenItemDetail(int index)

Gets whether hidding the detail of the specific PivotItem..

Parameters:

ParameterTypeDescription
indexintThe index of the pivotItem in the pivotField.

Returns: boolean - whether the specific PivotItem is hidden detail

isIncludeNewItemsInFilter()

public boolean isIncludeNewItemsInFilter()

Indicates whether including new items to the field in manual filter. The default value is false.

Returns: boolean

isInsertPageBreaksBetweenItems()

public boolean isInsertPageBreaksBetweenItems()

Indicates whether inserting page breaks after each item. The default value is false.

Returns: boolean

isMultipleItemSelectionAllowed()

public boolean isMultipleItemSelectionAllowed()

indicates whether the field can have multiple items selected in the page field The default value is false.

Returns: boolean

isRepeatItemLabels()

public boolean isRepeatItemLabels()

Indicates whether repeating labels of the field in the region. The default value is false.

Returns: boolean

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setAscendShow(boolean value)

public void setAscendShow(boolean value)

Indicates whether the specified PivotTable field is autoshown ascending.

Parameters:

ParameterTypeDescription
valueboolean

setAscendSort(boolean value)

public void setAscendSort(boolean value)

Indicates whether the specified PivotTable field is autosorted ascending.

Parameters:

ParameterTypeDescription
valueboolean

setAutoShow(boolean value)

public void setAutoShow(boolean value)

Indicates whether the specified PivotTable field is automatically shown,only valid for excel 2003.

Parameters:

ParameterTypeDescription
valueboolean

setAutoShowCount(int value)

public void setAutoShowCount(int value)

Represent the number of top or bottom items that are automatically shown in the specified PivotTable field.

Parameters:

ParameterTypeDescription
valueint

setAutoShowField(int value)

public void setAutoShowField(int value)

Represents auto show field index. -1 means PivotField itself. It should be the index of the data fields.

Parameters:

ParameterTypeDescription
valueint

setAutoSort(boolean value)

public void setAutoSort(boolean value)

Indicates whether the specified PivotTable field is automatically sorted.

Parameters:

ParameterTypeDescription
valueboolean

setAutoSortField(int value)

public void setAutoSortField(int value)

Represents the index of field which is auto sorted. -1 means PivotField itself,others means the position of the data fields.

Parameters:

ParameterTypeDescription
valueint

setAutoSubtotals(boolean value)

public void setAutoSubtotals(boolean value)

Indicates whether the specified field shows automatic subtotals. Default is true.

Parameters:

ParameterTypeDescription
valueboolean

setBaseFieldIndex(int value)

public void setBaseFieldIndex(int value)

Represents the base field for a custom calculation when the ShowDataAs calculation is in use.

Remarks

NOTE: This property is now obsolete. Instead, please use PivotField.ShowValuesSetting.BaseFieldIndex property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.

Parameters:

ParameterTypeDescription
valueint

setBaseIndex(int value)

public void setBaseIndex(int value)

Represents the PivotField index in the base PivotFields.

Parameters:

ParameterTypeDescription
valueint

setBaseItemIndex(int value)

public void setBaseItemIndex(int value)

Represents the item in the base field for a custom calculation when the ShowDataAs calculation is in use. Valid only for data fields.

Remarks

NOTE: This property is now obsolete. Instead, please use PivotField.ShowValuesSetting.BaseItemIndex property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.

Parameters:

ParameterTypeDescription
valueint

setBaseItemPosition(int value)

public void setBaseItemPosition(int value)

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.

See PivotItemPosition.

Remarks

NOTE: This property is now obsolete. Instead, please use PivotField.ShowValuesSetting.BaseItemPositionType property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.

Parameters:

ParameterTypeDescription
valueint

setCurrentPageItem(short value)

public void setCurrentPageItem(short value)

Represents the current page item showing for the page field (valid only for page fields).

Parameters:

ParameterTypeDescription
valueshort

setDataDisplayFormat(int value)

public void setDataDisplayFormat(int value)

Represents how to display the values in a data field of the pivot report.

See PivotFieldDataDisplayFormat.

Remarks

NOTE: This property is now obsolete. Instead, please use PivotField.ShowValuesSetting.CalculationType property instead. This method will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.

Parameters:

ParameterTypeDescription
valueint

setDisplayName(String value)

public void setDisplayName(String value)

Represents the PivotField display name.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setDragToColumn(boolean value)

public void setDragToColumn(boolean value)

Indicates whether the specified field can be dragged to the column position. The default value is true.

Parameters:

ParameterTypeDescription
valueboolean

setDragToData(boolean value)

public void setDragToData(boolean value)

Indicates whether the specified field can be dragged to the data position. The default value is true.

Parameters:

ParameterTypeDescription
valueboolean

setDragToHide(boolean value)

public void setDragToHide(boolean value)

Indicates whether the specified field can be dragged to the hide position. The default value is true.

Parameters:

ParameterTypeDescription
valueboolean

setDragToPage(boolean value)

public void setDragToPage(boolean value)

Indicates whether the specified field can be dragged to the page position. The default value is true.

Parameters:

ParameterTypeDescription
valueboolean

setDragToRow(boolean value)

public void setDragToRow(boolean value)

Indicates whether the specified field can be dragged to the row position. The default value is true.

Parameters:

ParameterTypeDescription
valueboolean

setFunction(int value)

public void setFunction(int value)

Represents the function used to summarize the PivotTable data field.

See ConsolidationFunction.

Parameters:

ParameterTypeDescription
valueint

setIncludeNewItemsInFilter(boolean value)

public void setIncludeNewItemsInFilter(boolean value)

Indicates whether including new items to the field in manual filter. The default value is false.

Parameters:

ParameterTypeDescription
valueboolean

setInsertBlankRow(boolean value)

public void setInsertBlankRow(boolean value)

Indicates whether inserting blank line after each item.

Parameters:

ParameterTypeDescription
valueboolean

setInsertPageBreaksBetweenItems(boolean value)

public void setInsertPageBreaksBetweenItems(boolean value)

Indicates whether inserting page breaks after each item. The default value is false.

Parameters:

ParameterTypeDescription
valueboolean

setMultipleItemSelectionAllowed(boolean value)

public void setMultipleItemSelectionAllowed(boolean value)

indicates whether the field can have multiple items selected in the page field The default value is false.

Parameters:

ParameterTypeDescription
valueboolean

setName(String value)

public void setName(String value)

Represents the name of PivotField.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setNonAutoSortDefault(boolean value)

public void setNonAutoSortDefault(boolean value)

Indicates whether a sort operation that will be applied to this pivot field is an autosort operation or a simple data sort.

Parameters:

ParameterTypeDescription
valueboolean

setNumber(int value)

public void setNumber(int value)

Represents the built-in display format of numbers and dates.

Parameters:

ParameterTypeDescription
valueint

setNumberFormat(String value)

public void setNumberFormat(String value)

Represents the custom display format of numbers and dates.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setRepeatItemLabels(boolean value)

public void setRepeatItemLabels(boolean value)

Indicates whether repeating labels of the field in the region. The default value is false.

Parameters:

ParameterTypeDescription
valueboolean

setShowAllItems(boolean value)

public void setShowAllItems(boolean value)

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.

Parameters:

ParameterTypeDescription
valueboolean

setShowCompact(boolean value)

public void setShowCompact(boolean value)

Indicates whether display labels from the next field in the same column on the Pivot Table view

Parameters:

ParameterTypeDescription
valueboolean

setShowInOutlineForm(boolean value)

public void setShowInOutlineForm(boolean value)

Indicates whether layout this field in outline form on the Pivot Table view

Parameters:

ParameterTypeDescription
valueboolean

setShowSubtotalAtTop(boolean value)

public void setShowSubtotalAtTop(boolean value)

when ShowInOutlineForm is true, then display subtotals at the top of the list of items instead of at the bottom

Remarks

Only works when ShowInOutlineForm is true.

Parameters:

ParameterTypeDescription
valueboolean

setSubtotals(int subtotalType, boolean shown)

public void setSubtotals(int subtotalType, boolean shown)

Sets whether the specified field shows that subtotals.

Parameters:

ParameterTypeDescription
subtotalTypeintPivotFieldSubtotalType. subtotals type.
shownbooleanwhether the specified field shows that subtotals.

showValuesAs(int displayFormat, int baseField, int baseItemPositionType, int baseItem)

public void showValuesAs(int displayFormat, int baseField, int baseItemPositionType, int baseItem)

Shows values of data field as different display format when the ShowDataAs calculation is in use.

Remarks

Only for data field.

Parameters:

ParameterTypeDescription
displayFormatintPivotFieldDataDisplayFormat. The data display format type.
baseFieldintThe index to the field which ShowDataAs calculation bases on.
baseItemPositionTypeintPivotItemPositionType. The position type of base iteam.
baseItemintThe index to the base item which ShowDataAs calculation bases on. Only works when baseItemPositionType is custom.

sortBy(int sortType, int fieldSortedBy)

public void sortBy(int sortType, int fieldSortedBy)

Sorts this pivot field.

Parameters:

ParameterTypeDescription
sortTypeintSortOrder. The type of sorting this field.
fieldSortedByintThe index of pivot field sorted by. -1 means sorting by data labels of this field, others mean the index of data field sorted by.

sortBy(int sortType, int fieldSortedBy, int dataType, String cellName)

public void sortBy(int sortType, int fieldSortedBy, int dataType, String cellName)

Sorts this pivot field.

Parameters:

ParameterTypeDescription
sortTypeintSortOrder. The type of sorting this field.
fieldSortedByintThe index of pivot field sorted by. -1 means sorting by data labels of this field, others mean the index of data field sorted by.
dataTypeintPivotLineType. The type of data sorted by.
cellNamejava.lang.StringSort by values in the row or column

toString()

public String toString()

Returns: java.lang.String

ungroup()

public void ungroup()

Ungroup the pivot field.

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int