Bir Çalışma Sayfasından Pivot Tablosunu Sil
Contents
[
Hide
]
Aspose.Cells for Python via .NET, Çalışma Sayfasından Pivot Tablosunu Silme veya Kaldırma özelliği sağlar. Pivot tablosunu pivot tablo nesnesi veya pivot tablosu konumunu kullanarak silebilirsiniz. Lütfen pivot tablosunu pivot tablo nesnesi kullanarak silmek için Worksheet.pivot_tables.remove(pivot_table) yöntemini ve pivot tablosu koleksiyonu içindeki konumunu kullanarak pivot tablosu nesnesini silmek için Worksheet.pivot_tables.remove_at(index, keep_data) yöntemini kullanın.
Aspose.Cells for Python Excel Kütüphanesi Kullanarak Çalışma Sayfasından Pivot Tablosunu Nasıl Sileceğiniz
Aşağıdaki örnek kod, çalışma sayfasından iki pivot tablosunu siler. İlk önce Worksheet.pivot_tables.remove(pivot_table) yöntemini kullanarak pivot tablosunu kaldırır, ardından Worksheet.pivot_tables.remove_at(index, keep_data) yöntemini kullanarak pivot tablosunu kaldırır.
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") |