Specifying the absolute position of the Pivot Item
Contents
[
Hide
]
Sometimes, the user needs to specify the absolute position of the pivot items, Aspose.Cells API has exposed a few new properties and a method to achieve this user requirement.
- Added PivotItem.setPosition() property that can be used to specify the position index in all the PivotItems regardless of the parent node. Added PivotItem.setPositionInSameParentNode() property that can be used to specify the position index in the PivotItems under the same parent node.
- Added PivotItem.move(int count, boolean isSameParent) method in order to move the item up or down based on the count value, where the count is the number of positions to move the PivotItem up or down. If the count value is less than zero, the item will be moved up whereas if the count value is larger than zero, the PivotItem will move down, Boolean type isSameParent parameter specifying whether the moving operation has to be performed in the same parent node or not.
- Obsoleted the PivotItem.move(int count) method, therefore, it is suggested to use the newly added method PivotItem.move(int count, boolean isSameParent) instead.
Please note, it is necessary to call the PivotTable.refreshData and PivotTable.calculateData methods before using PivotItem.setPosition(), PivotItem.setPositionInSameParentNode() properties and PivotItem.move(int count, boolean isSameParent) method.
Sample Code
The following sample code creates a Pivot Table and then it specifies the Pivot Items positions in the same parent node.