Bir Çalışma Sayfasından Pivot Tablosunu Sil
Contents
[
Hide
]
Aspose.Cells, bir Çalışma Sayfasından Pivot Tablosunu silme veya kaldırma özelliği sağlar. Pivot tablosu nesnesini veya pivot tablosu pozisyonunu kullanarak pivot tablosunu silebilirsiniz. Pivot tablosunu nesnesini kullanarak pivot tablosunu silmek için lütfen Worksheet.PivotTables.Remove() yöntemini ve pivot tablosu koleksiyonundaki pozisyonunu kullanarak pivot tablosunu silme yöntemi Worksheet.PivotTables.RemoveAt() kullanın.
Aşağıdaki örnek kod, çalışma sayfasından iki pivot tablosunu siler. İlk önce Worksheet.PivotTables.Remove() yöntemini kullanarak pivot tablosunu kaldırır, ardından Worksheet.PivotTables.RemoveAt() 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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create workbook object from source Excel file | |
Workbook workbook = new Workbook(dataDir + "source.xlsx"); | |
// Access the first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Access the first pivot table object | |
PivotTable pivotTable = worksheet.PivotTables[0]; | |
// Remove pivot table using pivot table object | |
worksheet.PivotTables.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"); |