Ana Pivot Tablosunun İçindeki Yerleşik veya Çocuk Pivot Tablolarını Bul ve Yenile

Olası Kullanım Senaryoları

Bazı durumlarda, bir pivot tablosu diğer bir pivot tablosunu veri kaynağı olarak kullandığı için buna çocuk pivot tablosu veya yerleşik pivot tablosu denir. PivotTable.getChildren() yöntemi kullanarak bir ana pivot tablosunun çocuk pivot tablolarını bulabilirsiniz.

Ana Pivot Tablosunun İçindeki Yerleşik veya Çocuk Pivot Tablolarını Bul ve Yenile

Aşağıdaki örnek kod, üç pivot tablosunu içeren örnek Excel dosyasını yükler. Alt iki pivot tablosu, yukarıdaki pivot tablosunun çocuklarıdır. Kod, PivotTable.getChildren() yöntemini kullanarak çocuk pivot tablosunu bulur ve ardından bunları tek tek yeniler.

todo:image_alt_text

Örnek Kod

// 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();
}