Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
If you want to disassociate a slicer and pivot table in Excel, you need to right‑click the slicer and select the “Report Connections…" item. In the options list, you can check the appropriate box. Similarly, if you want to disassociate a slicer and pivot table using the Aspose.Cells API programmatically, please use the Slicer.removePivotConnection(PivotTable) method. It will disassociate the slicer and the pivot table.
The following sample code loads the sample Excel file that contains an existing slicer. It accesses the slicers and then disassociates the slicer from the pivot table. Finally, it saves the workbook as the output Excel file.
const AsposeCells = require("aspose.cells.node");
const path = require("path");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "remove-pivot-connection.xlsx");
// Load sample Excel file containing slicer.
const workbook = new AsposeCells.Workbook(filePath);
// Access first worksheet.
const worksheet = workbook.getWorksheets().get(0);
// Access the first PivotTable inside the PivotTable collection.
const pivotTable = worksheet.getPivotTables().get(0);
// Access the first slicer inside the slicer collection.
const slicer = worksheet.getSlicers().get(0);
// Remove PivotTable connection.
slicer.removePivotConnection(pivotTable);
// Save the workbook in output XLSX format.
workbook.save(path.join(dataDir, "remove-pivot-connection-out.xlsx"));
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.