Expanding and collapsing Pivot Table items
After generating a pivot table, you sometimes want to collapse or expand all or individual items in a row- or column field.
You can do this with EPPlus using the ExcelPivotTableFieldItemsCollection.ShowDetails method or the ExcelPivotTableFieldItem.ShowDetails Property.
First however you must refresh the pivot table cache, so the cache items are generated.
Here is an example of how to collapse all items for a column field.
You can also collapse or expand individual items after the items cache has been refreshed.