Back to Devexpress

PivotTableCollection.Remove(PivotTable) Method

officefileapi-devexpress-dot-spreadsheet-dot-pivottablecollection-dot-remove-x28-devexpress-dot-spreadsheet-dot-pivottable-x29.md

latest6.0 KB
Original Source

PivotTableCollection.Remove(PivotTable) Method

Removes the specified pivot table from the collection.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void Remove(
    PivotTable table
)
vb
Sub Remove(
    table As PivotTable
)

Parameters

NameTypeDescription
tablePivotTable

A PivotTable object to be removed from the collection.

|

Remarks

Note that calling the Remove method also disposes an element removed from the collection.

To remove a pivot table at the specified index in the collection, use the PivotTableCollection.RemoveAt method. To remove all pivot tables from the collection at once, use the PivotTableCollection.Clear method.

To add a new pivot table to the collection, use the PivotTableCollection.Add method.

Example

View Example

csharp
Worksheet worksheet = workbook.Worksheets["Report1"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Remove the pivot table from the collection.
worksheet.PivotTables.Remove(pivotTable);
vb
Dim worksheet As Worksheet = workbook.Worksheets("Report1")
workbook.Worksheets.ActiveWorksheet = worksheet

' Access the pivot table by its name in the collection.
Dim pivotTable As PivotTable = worksheet.PivotTables("PivotTable1")
' Remove the pivot table from the collection.
worksheet.PivotTables.Remove(pivotTable)

The following code snippets (auto-collected from DevExpress Examples) contain references to the Remove(PivotTable) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-spreadsheet-pivot-table-api-examples/CS/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotTableActions.cs#L63

csharp
// Remove the pivot table from the collection.
worksheet.PivotTables.Remove(pivotTable);

winforms-spreadsheet-pivot-table-api/CS/SpreadsheetPivotTableExamples/CodeExamples/PivotTableActions.cs#L59

csharp
// Remove the pivot table from the collection.
worksheet.PivotTables.Remove(pivotTable);

spreadsheet-document-api-pivot-table-examples/CS/SpreadsheetDocServerPivotAPI/CodeExamples/PivotTableActions.cs#L69

csharp
// Remove the pivot table from the collection.
worksheet.PivotTables.Remove(pivotTable);

wpf-spreadsheet-pivot-table-api-examples/VB/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotTableActions.vb#L62

vb
' Remove the pivot table from the collection.
worksheet.PivotTables.Remove(pivotTable)

winforms-spreadsheet-pivot-table-api/VB/SpreadsheetPivotTableExamples/CodeExamples/PivotTableActions.vb#L58

vb
' Remove the pivot table from the collection.
worksheet.PivotTables.Remove(pivotTable)

spreadsheet-document-api-pivot-table-examples/VB/SpreadsheetDocServerPivotAPI/CodeExamples/PivotTableActions.vb#L64

vb
' Remove the pivot table from the collection.
            worksheet.PivotTables.Remove(pivotTable)
#End Region ' #RemoveTable

See Also

RemoveAt(Int32)

Clear()

PivotTableCollection Interface

PivotTableCollection Members

DevExpress.Spreadsheet Namespace