العمل مع تنسيقات عرض البيانات لحقل البيانات في جدول الإحصائيات المحورية
Contents
[
Hide
]
Aspose.Cells for Python via .NET يدعم جميع صيغ عرض بيانات حقل البيانات.
كيفية تعيين خيار “تصنيفات من الأصغر إلى الأكبر” و “تصنيفات من الأكبر إلى الأصغر” لخيار صيغة العرض
Aspose.Cells for Python via .NET يوفر القدرة على تعيين خيارات صيغة العرض لحقول Pivot. لهذا، يقدم الواجهة البرمجية الخاصية PivotField.data_display_format. لتصنيف من الأكبر إلى الأصغر، يمكنك تعيين الخاصية PivotField.data_display_format إلى PivotFieldDataDisplayFormat.RANK_LARGEST_TO_SMALLEST. يوضح مقتطف الكود التالي تعيين خيارات صيغة العرض.
يمكن تنزيل ملفات الأصل والإخراج العينية من هنا لاختبار كود العينة:
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
from aspose.cells import Workbook | |
from aspose.cells.pivot import PivotFieldDataDisplayFormat | |
# directories | |
sourceDir = "./" | |
outputDir = "./" | |
# Load a template file | |
workbook = Workbook(sourceDir + "PivotTableSample.xlsx") | |
# Get the first worksheet | |
worksheet = workbook.worksheets[0] | |
pivotIndex = 0 | |
# Accessing the PivotTable | |
pivotTable = worksheet.pivot_tables[pivotIndex] | |
# Accessing the data fields. | |
pivotFields = pivotTable.data_fields | |
# Accessing the first data field in the data fields. | |
pivotField = pivotFields[0] | |
# Setting data display format | |
pivotField.data_display_format = PivotFieldDataDisplayFormat.RANK_LARGEST_TO_SMALLEST | |
pivotTable.calculate_data() | |
# Saving the Excel file | |
workbook.save(outputDir + "PivotTableDataDisplayFormatRanking_out.xlsx") |