Add Pivot Connection

Possible Usage Scenarios

If you want to associate a slicer and a pivot table in Excel, you need to right‑click the slicer and select the “Report Connections…” item. In the options list, you can check or uncheck the boxes. Similarly, if you want to associate a slicer and a pivot table programmatically using the Aspose.Cells Java API, please use the Slicer.addPivotConnection(PivotTable pivot) method. It will associate the slicer with the pivot table.

Associate Slicer and PivotTable

The following sample code loads the sample Excel file that contains an existing slicer. It accesses the slicer and then associates the slicer with the pivot table. Finally, it saves the workbook as the output Excel file.

Sample Code