Group Pivot Fields in the Pivot Table

Possible Usage Scenarios

Microsoft Excel allows you to group pivot fields of the pivot table. When there is a large amount of data related to a pivot field, it is often useful to group them into sections. Aspose.Cells also provides this feature using the PivotTable.SetManualGroupField() method.

Group Pivot Fields in the Pivot Table

The following sample code loads the sample Excel file and performs grouping on the first pivot field using the PivotTable.SetManualGroupField() method. It then refreshes and calculates data of the pivot table and saves the workbook as output Excel file. The screenshot shows the effect of the sample code on the sample Excel file. As you can see in the screenshot, the first pivot field is now grouped by months and quarters.


Sample Code