العمل مع تنسيقات عرض البيانات لحقل البيانات في جدول الإحصائيات المحورية

“ترتيب من الأصغر إلى الأكبر” و “ترتيب من الأكبر إلى الأصغر” خيار شكل العرض

يوفر ASpose.Cells القدرة على تعيين خيار تنسيق العرض لحقول الجدول المحوري. لهذا، توفر واجهة برمجة التطبيقات العقارية PivotShowValuesSetting.setCalculationType. لتحديد الترتيب من الأكبر إلى الأصغر، قد تقوم بتعيين خاصية PivotShowValuesSetting.setCalculationType إلى PivotFieldDataDisplayFormat.RankLargestToSmallest. المقتطف البرمجي التالي يوضح ضبط خيارات تنسيق العرض.

يمكن تنزيل ملفات الأصل والإخراج العينية من هنا لاختبار كود العينة:

ملف إكسل المصدر

ملف إكسل الإخراج

const AsposeCells = require("aspose.cells.node");
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// directories
var sourceDir = RunExamples.Get_SourceDirectory()
var outputDir = RunExamples.Get_OutputDirectory()
// Load a template file
var workbook = new AsposeCells.Workbook(sourceDir + "PivotTableSample.xlsx");
// Get the first worksheet
var worksheet = workbook.getWorksheets().get(0);
var pivotIndex = 0;
// Accessing the PivotTable
var pivotTable = worksheet.getPivotTables().get(pivotIndex);
// Accessing the data fields.
var pivotFields = pivotTable.getDataFields();
// Accessing the first data field in the data fields.
var pivotField = pivotFields.get(0);
// Setting data display format
pivotField.getShowValuesSetting().setCalculationType(AsposeCells.PivotFieldDataDisplayFormat.RankLargestToSmallest);
pivotTable.calculateData();
// Saving the Excel file
workbook.save(outputDir + "PivotTableDataDisplayFormatRanking_out.xlsx");