親ピボット テーブルのネストされたピボット テーブルまたは子ピボット テーブルを検索して更新する

考えられる使用シナリオ

あるピボット テーブルが別のピボット テーブルをデータ ソースとして使用する場合があるため、子ピボット テーブルまたはネストされたピボット テーブルと呼ばれます。親ピボット テーブルの子ピボット テーブルは、[ピボットテーブル.getChildren()](https://reference.aspose.com/cells/java/com.aspose.cells/pivottable#getChildren()) 方法。

親ピボット テーブルのネストされたピボット テーブルまたは子ピボット テーブルを検索して更新する

次のサンプル コードは、サンプル Excel ファイル3 つのピボット テーブルが含まれています。下の 2 つのピボット テーブルは、このスクリーンショットに示すように、上のピボット テーブルの子です。コードは、ピボットテーブル.getChildren() メソッドを実行し、それらを 1 つずつ更新します。

todo:画像_代替_文章

サンプルコード

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Load sample Excel file
Workbook wb = new Workbook("sampleFindAndRefreshNestedOrChildrenPivotTables.xlsx");
//Access first worksheet
Worksheet ws = wb.getWorksheets().get(0);
//Access third pivot table
PivotTable ptParent = ws.getPivotTables().get(2);
//Access the children of the parent pivot table
PivotTable[] ptChildren = ptParent.getChildren();
//Refresh all the children pivot table
int count = ptChildren.length;
for (int idx = 0; idx < count; idx++)
{
//Access the child pivot table
PivotTable ptChild = ptChildren[idx];
//Refresh the child pivot table
ptChild.refreshData();
ptChild.calculateData();
}