Home  Products  Purchase  Downloads  Demos  Forums  Blogs  Ticket  Wiki  API  Corporate


com.aspose.cells
Class PivotField

java.lang.Object
  extended by com.aspose.cells.PivotField

public class PivotField
extends java.lang.Object

Represents a field in a PivotTable report.


Method Summary
 boolean dragToColumn()
          Indicates whether the specified field can be dragged to the column position.
 boolean dragToHide()
          Indicates whether the specified field can be dragged to the hide position.
 boolean dragToPage()
          Indicates whether the specified field can be dragged to the page position.
 boolean dragToRow()
          Indicates whether the specified field can be dragged to the row position.
 int getAutoShowCount()
          Gets the number of top or bottom items that are automatically shown in the specified PivotTable field.
 int getAutoShowField()
          Gets auto show field index.
 int getAutoSortField()
          Gets auto sort field index.
 int getBaseField()
          Gets the base field for a custom calculation.
 short getBaseItem()
          Gets the item in the base field for a custom calculation.
 short getCurrentPageItem()
          Gets the current page item showing for the page field (valid only for page fields).
 int getDataDisplayFormat()
          Gets how to display the values contained in a data field.
 java.lang.String getDisplayName()
          Gets the PivotField display name.
 int getFunction()
          Gets the function used to summarize the PivotTable data field.
 java.lang.String getName()
          Gets the PivotField name.
 int getNumber()
          Gets the built-in display format of numbers and dates.
 java.lang.String getNumberFormat()
          Represents the custom display format of numbers and dates.
 PivotItems getPivotItems()
          Gets the pivot items in the field.
 int getPosition()
          Get the position of the PivotField int the specific PivotFields.
 boolean getShowCompact()
          Indicates when ShowInOutlineForm is true, whether the application will display fields compactly in the sheet on which this PivotTable resides.
 boolean getShowInOutlineForm()
          Indicates whether layout this field in outline form on the Pivot Table view.
 boolean getShowSubtotalAtTop()
          Indicates when ShowInOutlineForm is true, whether the application will display subtotals at the top of the list of items instead of at the bottom.
 boolean getSubtotals(short subtotals)
          Gets whether the specified field shows that subtotals.
 void hideItem(int index, boolean isHidden)
          Sets whether the specific PivotItem in a data field is hidden.
 boolean isAscendShow()
          Gets whether the specified PivotTable field is autoshown ascending.
 boolean isAscendSort()
          Indicates whether the specified PivotTable field is autosorted ascending.
 boolean isAutoShow()
          Indicates whether the specified PivotTable field is automatically shown.
 boolean isAutoSort()
          Indicates whether the specified PivotTable field is automatically sorted.
 boolean isAutoSubtotals()
          Gets whether the specified field shows automatic subtotals.
 boolean isHiddenItem(int index)
          Indicates whether the specific PivotItem is hidden.
 void setAscendShow(boolean isAscendShow)
          Sets whether the specified PivotTable field is autoshown ascending.
 void setAscendSort(boolean isAscendSort)
          Sets whether the specified PivotTable field is autosorted ascending.
 void setAutoShow(boolean isAutoShow)
          Sets whether the specified PivotTable field is automatically shown.
 void setAutoShowCount(int count)
          Gets the number of top or bottom items that are automatically shown in the specified PivotTable field.
 void setAutoShowField(int dataFieldIndex)
          Sets auto show field index.
 void setAutoSort(boolean isAutoSort)
          Sets whether the specified PivotTable field is automatically sorted.
 void setAutoSortField(int dataFieldIndex)
          Sets auto sort field index.
 void setAutoSubtotals(boolean isAutoSubtotals)
          Sets whether the specified field shows automatic subtotals.
 void setBaseField(int baseFieldIndex)
          Sets the base field for a custom calculation.
 void setBaseItem(int baseItemIndex)
          Sets the item in the base field for a custom calculation.
 void setCurrentPageItem(int baseItemIndex)
          Sets the current page item showing for the page field (valid only for page fields).
 void setDataDisplayFormat(short dataDisplayFormat)
          Sets how to display the values contained in a data field.
 void setDisplayName(java.lang.String displayName)
          Sets the PivotField display name.
 void setDragToColumn(boolean dragToColumn)
          Indicates whether the specified field can be dragged to the column position.
 void setDragToHide(boolean dragToHide)
          Indicates whether the field can be hidden by being dragged off the PivotTable report.
 void setDragToPage(boolean dragToPage)
          Indicates whether the specified field can be dragged to the page position.
 void setDragToRow(boolean dragToRow)
          Indicates whether the specified field can be dragged to the row position.
 void setFunction(int function)
          Sets the function used to summarize the PivotTable data field.
 void setNumber(int number)
          Sets the built-in display format of numbers and dates.
 void setNumberFormat(java.lang.String numberFormat)
          Represents the custom display format of numbers and dates.
 void setShowAllItems(boolean showAllItems)
          Indicates whether all items in the PivotTable report are displayed, even if they don't contain summary data.
 void setShowCompact(boolean _showCompact)
          Indicates when ShowInOutlineForm is true, whether the application will display fields compactly in the sheet on which this PivotTable resides.
 void setShowInOutlineForm(boolean _showInOutlineForm)
          Indicates whether layout this field in outline form on the Pivot Table view.
 void setShowSubtotalAtTop(boolean _showSubtotalAtTop)
          Indicates when ShowInOutlineForm is true, whether the application will display subtotals at the top of the list of items instead of at the bottom.
 void setSubtotals(short subtotals, boolean shown)
          Sets whether the specified field shows that subtotals.
 boolean showAllItems()
          Indicates whether all items in the PivotTable report are displayed, even if they don't contain summary data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPosition

public int getPosition()
Get the position of the PivotField int the specific PivotFields.

Returns:
the position of the PivotField.

getName

public java.lang.String getName()
Gets the PivotField name.

Returns:
the PivotField name.

getPivotItems

public PivotItems getPivotItems()
Gets the pivot items in the field.

Returns:
the pivot items.

getDisplayName

public java.lang.String getDisplayName()
Gets the PivotField display name.

Returns:
the PivotField display name.

setDisplayName

public void setDisplayName(java.lang.String displayName)
Sets the PivotField display name.

Parameters:
displayName - the PivotField display name.

setSubtotals

public void setSubtotals(short subtotals,
                         boolean shown)
Sets whether the specified field shows that subtotals.

Parameters:
subtotals - subtotals type.
shown - whether the field shows that subtotal.
Throws:
java.lang.IllegalArgumentException - if the subtotals type is invalid.
CellsException - if the pivotField is data field or read-only.
See Also:
PivotFieldSubtotalType

getSubtotals

public boolean getSubtotals(short subtotals)
Gets whether the specified field shows that subtotals.

Parameters:
subtotals - subtotals type.
Returns:
whether the specified field shows that subtotals.
Throws:
java.lang.IllegalArgumentException - if the subtotals type is invalid.
See Also:
PivotFieldSubtotalType

isAutoSubtotals

public boolean isAutoSubtotals()
Gets whether the specified field shows automatic subtotals. Default is true.

Returns:
whether the specified field shows automatic subtotals.

setAutoSubtotals

public void setAutoSubtotals(boolean isAutoSubtotals)
Sets whether the specified field shows automatic subtotals.

Parameters:
isAutoSubtotals - whether the specified field shows automatic subtotals.
Throws:
CellsException - if the pivotField is data field or read-only.

dragToColumn

public boolean dragToColumn()
Indicates whether the specified field can be dragged to the column position. The default value is true.

Returns:
whether the specified field can be dragged to the column position.

setDragToColumn

public void setDragToColumn(boolean dragToColumn)
Indicates whether the specified field can be dragged to the column position. The default value is true.

Parameters:
dragToColumn - whether the specified field can be dragged to the column position.

dragToHide

public boolean dragToHide()
Indicates whether the specified field can be dragged to the hide position. The default value is true.

Returns:
whether the specified field can be dragged to the hide position.

setDragToHide

public void setDragToHide(boolean dragToHide)
Indicates whether the field can be hidden by being dragged off the PivotTable report. The default value is true.

Parameters:
dragToHide - the field can be hidden by being dragged off the PivotTable report.

dragToRow

public boolean dragToRow()
Indicates whether the specified field can be dragged to the row position. The default value is true.

Returns:
whether the specified field can be dragged to the row position.

setDragToRow

public void setDragToRow(boolean dragToRow)
Indicates whether the specified field can be dragged to the row position. The default value is true.

Parameters:
dragToRow - whether the specified field can be dragged to the row position.

dragToPage

public boolean dragToPage()
Indicates whether the specified field can be dragged to the page position. The default value is true.

Returns:
whether the specified field can be dragged to the page position.

setDragToPage

public void setDragToPage(boolean dragToPage)
Indicates whether the specified field can be dragged to the page position. The default value is true.

Parameters:
dragToPage - whether the specified field can be dragged to the page position.

showAllItems

public boolean showAllItems()
Indicates whether all items in the PivotTable report are displayed, even if they don't contain summary data. The default value is false.

Returns:
whether all items in the PivotTable report are displayed.

setShowAllItems

public void setShowAllItems(boolean showAllItems)
Indicates whether all items in the PivotTable report are displayed, even if they don't contain summary data. The default value is false.

Parameters:
showAllItems - Indicates whether all items in the PivotTable report are displayed,

isAutoSort

public boolean isAutoSort()
Indicates whether the specified PivotTable field is automatically sorted.

Returns:
whether the specified PivotTable field is automatically sorted.

setAutoSort

public void setAutoSort(boolean isAutoSort)
Sets whether the specified PivotTable field is automatically sorted.

Parameters:
isAutoSort - whether the specified PivotTable field is automatically sorted.

isAscendSort

public boolean isAscendSort()
Indicates whether the specified PivotTable field is autosorted ascending.

Returns:
whether the specified PivotTable field is autosorted ascending.

setAscendSort

public void setAscendSort(boolean isAscendSort)
Sets whether the specified PivotTable field is autosorted ascending. Only effects when the field is autosorted.Default value is true.

Parameters:
isAscendSort - whether the specified PivotTable field is autosorted ascending.

getAutoSortField

public int getAutoSortField()
Gets auto sort field index. -1 means PivotField itself.

Returns:
auto sort field index.

setAutoSortField

public void setAutoSortField(int dataFieldIndex)
Sets auto sort field index. -1 means PivotField itself. Only effects when the field is autosorted.

Parameters:
dataFieldIndex - auto sort field index.
Throws:
java.lang.IllegalArgumentException - if data field index is out of range.

isAutoShow

public boolean isAutoShow()
Indicates whether the specified PivotTable field is automatically shown.

Returns:
whether the specified PivotTable field is automatically shown.

setAutoShow

public void setAutoShow(boolean isAutoShow)
Sets whether the specified PivotTable field is automatically shown.

Parameters:
isAutoShow - whether the specified PivotTable field is automatically shown.

isAscendShow

public boolean isAscendShow()
Gets whether the specified PivotTable field is autoshown ascending.

Returns:
whether the specified PivotTable field is autoshown ascending.

setAscendShow

public void setAscendShow(boolean isAscendShow)
Sets whether the specified PivotTable field is autoshown ascending. Only effects when the field is autoshown.Default value is true.

Parameters:
isAscendShow - whether the specified PivotTable field is autoshown ascending.

getAutoShowCount

public int getAutoShowCount()
Gets the number of top or bottom items that are automatically shown in the specified PivotTable field.

Returns:
the number of top or bottom items.

setAutoShowCount

public void setAutoShowCount(int count)
Gets the number of top or bottom items that are automatically shown in the specified PivotTable field. Only effects when the field is autoshown.Default value is 10.

Parameters:
count - the number of top or bottom items

getAutoShowField

public int getAutoShowField()
Gets auto show field index. -1 means PivotField itself.

Returns:
auto show field index.

setAutoShowField

public void setAutoShowField(int dataFieldIndex)
Sets auto show field index. -1 means PivotField itself. Only effects when the field is autoshown.

Parameters:
dataFieldIndex - auto show field index.
Throws:
java.lang.IllegalArgumentException - if data field index is out of range.

getFunction

public int getFunction()
Gets the function used to summarize the PivotTable data field.

Returns:
the function used to summarize the PivotTable data field.
See Also:
ConsolidationFunction

setFunction

public void setFunction(int function)
Sets the function used to summarize the PivotTable data field.

Parameters:
function - the function used to summarize the PivotTable data field.
Throws:
java.lang.IllegalArgumentException - if the function is an invalid consolidation function.
CellsException - if the pivotField is read-only.
See Also:
ConsolidationFunction

getDataDisplayFormat

public int getDataDisplayFormat()
Gets how to display the values contained in a data field.

Returns:
how to display the values contained in a data field.
See Also:
PivotFieldDataDisplayFormat

setDataDisplayFormat

public void setDataDisplayFormat(short dataDisplayFormat)
Sets how to display the values contained in a data field.

Parameters:
dataDisplayFormat - how to display the values contained in a data field.
Throws:
CellsException - if the pivotField is read-only.
java.lang.IllegalArgumentException - if data display format is invalid.
See Also:
PivotFieldDataDisplayFormat

getBaseField

public int getBaseField()
Gets the base field for a custom calculation.

Returns:
the base field for a custom calculation.

setBaseField

public void setBaseField(int baseFieldIndex)
Sets the base field for a custom calculation. This property is valid only for data fields.

Parameters:
baseFieldIndex - the base field for a custom calculation.
Throws:
java.lang.IllegalArgumentException - if base field index is out of range.
CellsException - if the pivotField is read-only.

setBaseItem

public void setBaseItem(int baseItemIndex)
Sets the item in the base field for a custom calculation. Valid only for data fields.

Parameters:
baseItemIndex - the item in the base field for a custom calculation. It could be base item index , PivotItemPosition.NEXT or PivotItemPosition.PREVIOUS.
Throws:
CellsException - if the pivotField is read-only.
java.lang.IllegalArgumentException - if base item index is out of range.

getBaseItem

public short getBaseItem()
Gets the item in the base field for a custom calculation.

Returns:
the item in the base field for a custom calculation.

getCurrentPageItem

public short getCurrentPageItem()
Gets the current page item showing for the page field (valid only for page fields).

Returns:
the current page item showing for the page field

setCurrentPageItem

public void setCurrentPageItem(int baseItemIndex)
Sets the current page item showing for the page field (valid only for page fields).

Parameters:
baseItemIndex - the current page item showing for the page field (valid only for page fields). It could be base item index or PivotItemPosition.ALL.
Throws:
java.lang.IllegalArgumentException - if base item index is out of range.

getNumber

public int getNumber()
Gets the built-in display format of numbers and dates.

Returns:
the built-in display format of numbers and dates.

setNumber

public void setNumber(int number)
Sets the built-in display format of numbers and dates.

Parameters:
number - the built-in formatting number.
Throws:
java.lang.IllegalArgumentException - if number is invalid.
CellsException - if the pivotField is read-only.
See Also:
Style.setNumber(int)

getNumberFormat

public java.lang.String getNumberFormat()
Represents the custom display format of numbers and dates.


setNumberFormat

public void setNumberFormat(java.lang.String numberFormat)
Represents the custom display format of numbers and dates.

Parameters:
numberFormat -

isHiddenItem

public boolean isHiddenItem(int index)
Indicates whether the specific PivotItem is hidden.

Parameters:
index - the PivotItem index.
Returns:
whether the specific PivotItem is hidden.
Throws:
java.lang.IllegalArgumentException - if index is out of range.

hideItem

public void hideItem(int index,
                     boolean isHidden)
Sets whether the specific PivotItem in a data field is hidden.

Parameters:
index - the PivotItem index.
isHidden - whether the specific PivotItem in a data field is hidden.
Throws:
java.lang.IllegalArgumentException - if index is out of range.

getShowInOutlineForm

public boolean getShowInOutlineForm()
Indicates whether layout this field in outline form on the Pivot Table view.

Returns:
true indicates the items in this field will be shown in outline form. false indicates the items in this field will not be shown in outline form.

setShowInOutlineForm

public void setShowInOutlineForm(boolean _showInOutlineForm)
Indicates whether layout this field in outline form on the Pivot Table view.

Parameters:
_showInOutlineForm - true indicates the items in this field will be shown in outline form. false indicates the items in this field will not be shown in outline form.

getShowCompact

public boolean getShowCompact()
Indicates when ShowInOutlineForm is true, whether the application will display fields compactly in the sheet on which this PivotTable resides.

Returns:
true indicates the next field should be displayed in the same column of the sheet. false indicates each pivot field will display in its own column in the sheet.

setShowCompact

public void setShowCompact(boolean _showCompact)
Indicates when ShowInOutlineForm is true, whether the application will display fields compactly in the sheet on which this PivotTable resides.

Parameters:
_showCompact - true indicates the next field should be displayed in the same column of the sheet. false indicates each pivot field will display in its own column in the sheet.

getShowSubtotalAtTop

public boolean getShowSubtotalAtTop()
Indicates when ShowInOutlineForm is true, whether the application will display subtotals at the top of the list of items instead of at the bottom.

Returns:
true indicates a subtotal will be display at the top of the group. false indicates subtotal will not be displayed at the top of the group.

setShowSubtotalAtTop

public void setShowSubtotalAtTop(boolean _showSubtotalAtTop)
Indicates when ShowInOutlineForm is true, whether the application will display subtotals at the top of the list of items instead of at the bottom.

Parameters:
_showSubtotalAtTop - true indicates a subtotal will be display at the top of the group. false indicates subtotal will not be displayed at the top of the group.