ピボット接続をNode.jsをC++経由で削除
Contents
[
Hide
]
可能な使用シナリオ
Excelでスライサーとピボットテーブルの関連付けを解除したい場合は、スライサーを右クリックして「レポート接続…」を選択します。オプションリストのチェックボックスで操作できます。同様に、Aspose.Cells APIを使用してプログラム的にスライサーとピボットテーブルの関連付けを解除する場合は、Slicer.removePivotConnection(PivotTable)メソッドを使用してください。これにより関連付けが解除されます。
スライサーとピボットテーブルの非連携
次のサンプルコードは、既存のスライサーを含むサンプルExcelファイルをロードし、スライサーにアクセスしてピボットテーブルとの関連付けを解除します。最後に、ワークブックを出力Excelファイルとして保存します。
サンプルコード
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"));