.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

PivotTable.Clear() Method

Removes all fields, formatting and report filters from the PivotTable report.

Namespace: DevExpress.Spreadsheet

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

Declaration

void Clear()

Remarks

The Clear method does not delete the pivot table, but resets it to the initial state, before any fields were added to it. The data connection, PivotTable cache and the report location are preserved.

To completely delete the PivotTable report from the worksheet, remove it from the worksheet’s PivotTableCollection by using the PivotTableCollection.Remove method.

Important

If the pivot table you wish to clear is based on the same data as other pivot tables in a document, the Clear method will also remove grouping, calculated fields, and calculated items from other shared PivotTable reports.

Example

Dim worksheet As Worksheet = workbook.Worksheets("Report1")
workbook.Worksheets.ActiveWorksheet = worksheet

' Clear the pivot table.
worksheet.PivotTables("PivotTable1").Clear()

The following code snippets (auto-collected from DevExpress Examples) contain references to the Clear() 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.

See Also