Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+
Row

PivotDataFieldCollection.Insert(Int32, PivotField, String) Method

Inserts a data field into the PivotDataFieldCollection collection at the specified index.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

PivotDataField Insert(
    int index,
    PivotField field,
    string name
)

Parameters

Name Type Description
index Int32

A zero-based integer which specifies the position at which the field should be inserted.

field PivotField

A PivotField object representing the field to insert into the collection.

name String

A String value that specifies the data field name in the pivot table. This value is assigned to the PivotDataField.Name property.

Returns

Type Description
PivotDataField

A PivotDataField object which represents the inserted data field.

Remarks

Use the Insert method to add a new field to the data area of the PivotTable report at the specified position.

If the index parameter is negative or exceeds the number of elements within the collection, a ArgumentOutOfRangeException exception is raised. When inserting a new field, the data fields that follow the insertion point move down to accommodate the new field. The indexes of the moved fields are updated as well.

To add a new data field to the end of a collection, use the PivotDataFieldCollection.Add method overloads. To remove a data field from the collection, use the PivotDataFieldCollection.Remove or PivotDataFieldCollection.RemoveAt method. You can also use the PivotDataFieldCollection.Clear method to remove all fields from the PivotTable’s data area.

See Also