officefileapi-devexpress-dot-spreadsheet-dot-pivotcalculateditemcollection-dot-removeat-x28-system-dot-int32-x29.md
Removes the calculated item at the specified index from the collection.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
void RemoveAt(
int index
)
Sub RemoveAt(
index As Integer
)
| Name | Type | Description |
|---|---|---|
| index | Int32 |
A zero-based integer specifying the index of the calculated item to be removed. It should be non-negative and less than the number of elements in the collection.
|
To remove the specified calculated item from the collection, use the PivotCalculatedItemCollection.Remove method. To remove all calculated items from the collection at once, use the PivotCalculatedItemCollection.Clear method.
Worksheet worksheet = workbook.Worksheets["Report7"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Access the pivot field by its name in the collection.
PivotField field = pivotTable.Fields["Customer"];
// Add a calculated item to the "Customer" field.
field.CalculatedItems.Add("='Big Foods'*110%", "Big Foods Sales Plan");
//Remove the calculated item by its index from the collection.
field.CalculatedItems.RemoveAt(0);
Dim worksheet As Worksheet = workbook.Worksheets("Report7")
workbook.Worksheets.ActiveWorksheet = worksheet
' Access the pivot table by its name in the collection.
Dim pivotTable As PivotTable = worksheet.PivotTables("PivotTable1")
' Access the pivot field by its name in the collection.
Dim field As PivotField = pivotTable.Fields("Customer")
' Add a calculated item to the "Customer" field.
field.CalculatedItems.Add("='Big Foods'*110%", "Big Foods Sales Plan")
'Remove the calculated item by its index from the collection.
field.CalculatedItems.RemoveAt(0)
The following code snippets (auto-collected from DevExpress Examples) contain references to the RemoveAt(Int32) 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 calculated item by its index from the collection.
field.CalculatedItems.RemoveAt(0);
#endregion #RemoveCalculatedItem
//Remove the calculated item by its index from the collection.
field.CalculatedItems.RemoveAt(0);
#endregion #RemoveCalculatedItem
//Remove the calculated item by its index from the collection.
field.CalculatedItems.RemoveAt(0);
#endregion #RemoveCalculatedItem
'Remove the calculated item by its index from the collection.
field.CalculatedItems.RemoveAt(0)
' #End Region ' #RemoveCalculatedItem
'Remove the calculated item by its index from the collection.
field.CalculatedItems.RemoveAt(0)
' #End Region ' #RemoveCalculatedItem
'Remove the calculated item by its index from the collection.
field.CalculatedItems.RemoveAt(0)
#End Region ' #RemoveCalculatedItem
See Also
PivotCalculatedItemCollection Interface