officefileapi-devexpress-dot-spreadsheet-dot-pivotfieldreferencecollection-dot-remove-x28-devexpress-dot-spreadsheet-dot-pivotfieldreference-x29.md
Removes the specified row or column field from the collection.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
void Remove(
PivotFieldReference fieldReference
)
Sub Remove(
fieldReference As PivotFieldReference
)
| Name | Type | Description |
|---|---|---|
| fieldReference | PivotFieldReference |
A PivotFieldReference object that specifies the row or column field to be removed from the collection.
|
Use the Remove method to remove the specified row field from the PivotTable.RowFields collection (as shown in the example below), or the specified column field from the PivotTable.ColumnFields collection.
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 "Product" field from the row axis area.
pivotTable.RowFields.Remove(pivotTable.RowFields("Product"))
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 "Product" field from the row axis area.
pivotTable.RowFields.Remove(pivotTable.RowFields["Product"]);
To remove a row (or column) field from the PivotTable.RowFields (or PivotTable.ColumnFields) collection by its index, use the PivotFieldReferenceCollection.RemoveAt method. To remove all fields from the collection of row or column fields, use the PivotFieldReferenceCollection.Clear method.
The following code snippets (auto-collected from DevExpress Examples) contain references to the Remove(PivotFieldReference) 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.
// Remove the "Product" field from the row axis area.
pivotTable.RowFields.Remove(pivotTable.RowFields["Product"]);
#endregion #RemoveFromAxis
// Remove the "Product" field from the row axis area.
pivotTable.RowFields.Remove(pivotTable.RowFields["Product"]);
#endregion #RemoveFromAxis
// Remove the "Product" field from the row axis area.
pivotTable.RowFields.Remove(pivotTable.RowFields["Product"]);
#endregion #RemoveFromAxis
' Remove the "Product" field from the row axis area.
pivotTable.RowFields.Remove(pivotTable.RowFields("Product"))
' #End Region ' #RemoveFromAxis
' Remove the "Product" field from the row axis area.
pivotTable.RowFields.Remove(pivotTable.RowFields("Product"))
' #End Region ' #RemoveFromAxis
' Remove the "Product" field from the row axis area.
pivotTable.RowFields.Remove(pivotTable.RowFields("Product"))
#End Region ' #RemoveFromAxis
See Also
PivotFieldReferenceCollection Interface