حذف جدول الدوران من ورقة العمل
Contents
[
Hide
]
المكتبة Aspose.Cells لبيثون via .NET توفر ميزة لحذف أو إزالة الجدول المحوري من ورقة عمل. يمكنك حذف الجدول المحوري باستخدام كائن الجدول المحوري أو موقع الجدول المحوري. يرجى استخدام الطريقة Worksheet.pivot_tables.remove(pivot_table) لحذف الجدول المحوري باستخدام كائن الجدول المحوري والطريقة Worksheet.pivot_tables.remove_at(index, keep_data) لحذف كائن الجدول المحوري باستخدام موقعه داخل مجموعة الجدول المحوري.
كيفية حذف الجدول المحوري من ورقة العمل باستخدام مكتبة Aspose.Cells لبيثون إكسل
تحتوي رمز العينة التالي على حذف جدولين للدوران من ورقة العمل. أولاً يقوم بإزالة جدول الدوران باستخدام الطريقة Worksheet.pivot_tables.remove(pivot_table) ثم يزيل جدول الدوران باستخدام الطريقة Worksheet.pivot_tables.remove_at(index, keep_data)
This file contains 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 | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Create workbook object from source Excel file | |
workbook = Workbook(dataDir + "source.xlsx") | |
# Access the first worksheet | |
worksheet = workbook.worksheets[0] | |
# Access the first pivot table object | |
pivotTable = worksheet.pivot_tables[0] | |
# Remove pivot table using pivot table object | |
worksheet.pivot_tables.remove(pivotTable) | |
# OR you can remove pivot table using pivot table position by uncommenting below line | |
# worksheet.PivotTables.RemoveAt(0); | |
# Save the workbook | |
workbook.save(dataDir + "output_out.xlsx") |