ابحث عن الجداول المتداخلة أو الجداول المحورية التابعة للجدول المحوري الأصل وقم بتحديثها
Contents
[
Hide
]
سيناريوهات الاستخدام الممكنة
في بعض الأحيان ، يستخدم أحد الجداول المحورية جدولًا محوريًا آخر كمصدر بيانات ، لذلك يطلق عليه الجدول المحوري الفرعي أو الجدول المحوري المتداخل. يمكنك العثور على الجداول المحورية الفرعية للجدول المحوري الأصل باستخدامPivotTable.getChildren () طريقة.
ابحث عن الجداول المتداخلة أو الجداول المحورية التابعة للجدول المحوري الأصل وقم بتحديثها
يقوم نموذج التعليمات البرمجية التالي بتحميل ملفنموذج لملف Excelالتي تحتوي على ثلاثة جداول محورية. الجدولان المحوريان السفليان هما جدولان ثانويان للجدول المحوري أعلاه كما هو موضح في لقطة الشاشة هذه. يعثر الرمز على الجدول المحوري للأطفال باستخدامPivotTable.getChildren () ثم تحديثها واحدة تلو الأخرى.
عينة من الرموز
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); | |
} |