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.get_children() yöntemi kullanarak bir ana pivot tablosunun çocuk pivot tablolarını bulabilirsiniz.
Ana Özet Tablosunun İçerisindeki veya Alt Tablolarını Bulma ve Yenileme
Aşağıdaki örnek kod, üç pivot tablosunu içeren örnek Excel dosyasını yükler. Alt iki pivot tablosu yukarıdaki pivot tablosunun alt pivot tablolarıdır ve bu ekran görüntüsünde gösterildiği gibi. Kod, PivotTable.get_children() yöntemini kullanarak alt pivot tablosunu bulur ve ardından birer birer yeniler.
Örnek Kod
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# Load sample Excel file | |
wb = Workbook("sampleFindAndRefreshNestedOrChildrenPivotTables.xlsx") | |
# Access first worksheet | |
ws = wb.worksheets[0] | |
# Access third pivot table | |
ptParent = ws.pivot_tables[2] | |
# Access the children of the parent pivot table | |
ptChildren = ptParent.get_children() | |
# Refresh all the children pivot table | |
count = len(ptChildren) | |
for idx in range(count): | |
# Access the child pivot table | |
ptChild = ptChildren[idx] | |
# Refresh the child pivot table | |
ptChild.refresh_data() | |
ptChild.calculate_data() |