تحديث وحساب الجدول المحوري الذي يحتوي على عناصر محسوبة
Contents
[
Hide
]
يدعم Aspose.Cells الآن تحديث وحساب الجدول المحوري باستخدام العناصر المحسوبة. الرجاء استخدامPivotTable.refreshData () وPivotTable.caclulateData () كالمعتاد لأداء هذه الوظيفة.
تحديث وحساب الجدول المحوري الذي يحتوي على عناصر محسوبة
يقوم نموذج التعليمات البرمجية التالي بتحميل ملفملف اكسل المصدرالذي يحتوي على جدول محوري يحتوي على ثلاثة عناصر محسوبة مثل “إضافة” و “div” و “div2”. نقوم أولاً بتغيير قيمة الخلية D2 إلى 20 ثم تحديث الجدول المحوري وحسابه باستخدام واجهات برمجة تطبيقات Aspose.Cells وحفظ المصنف بتنسيق PDF. النتائج فيالإخراج PDF يوضح أن Aspose.Cells قام بتحديث وحساب الجدول المحوري بعد أن تم حساب العناصر بنجاح. يمكنك التحقق من ذلك باستخدام Microsoft Excel عن طريق وضع القيمة 20 يدويًا في الخلية D2 ثم تحديث الجدول المحوري عبر مفتاح الاختصار Alt + F5 أو النقر فوق الزر “تحديث الجدول المحوري”.
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 | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(RefreshCalculatePivotTablehavingCalculatedItems.class); | |
// Load source excel file containing a pivot table having calculated | |
// items | |
Workbook wb = new Workbook(dataDir + "sample.xlsx"); | |
// Access first worksheet | |
Worksheet sheet = wb.getWorksheets().get(0); | |
// Change the value of cell D2 | |
sheet.getCells().get("D2").putValue(20); | |
// Refresh and calculate all the pivot tables inside this sheet | |
for (int i = 0; i < sheet.getPivotTables().getCount(); i++) { | |
PivotTable pt = sheet.getPivotTables().get(i); | |
pt.refreshData(); | |
pt.calculateData(); | |
} | |
// Save the workbook in output pdf | |
wb.save(dataDir + "output.pdf", SaveFormat.PDF); |