menu

Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PivotDataFields - Xamarin.Android API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PivotDataFields

    Represents pivot table data fields collection.

    Inheritance
    System.Object
    CollectionBase<PivotDataField>
    CollectionBaseEx<PivotDataField>
    PivotDataFields
    Implements
    System.Collections.Generic.IList<PivotDataField>
    System.Collections.Generic.ICollection<PivotDataField>
    System.Collections.Generic.IEnumerable<PivotDataField>
    System.Collections.IEnumerable
    IParentApplication
    ICloneParent
    IPivotDataFields
    Inherited Members
    CollectionBase<PivotDataField>.Add(PivotDataField)
    CollectionBase<PivotDataField>.Capacity
    CollectionBase<PivotDataField>.Clear()
    CollectionBase<PivotDataField>.Contains(PivotDataField)
    CollectionBase<PivotDataField>.CopyTo(PivotDataField[], Int32)
    CollectionBase<PivotDataField>.Count
    CollectionBase<PivotDataField>.GetEnumerator()
    CollectionBase<PivotDataField>.IndexOf(PivotDataField)
    CollectionBase<PivotDataField>.InnerList
    CollectionBase<PivotDataField>.Insert(Int32, PivotDataField)
    CollectionBase<PivotDataField>.IsReadOnly
    CollectionBase<PivotDataField>.Item[Int32]
    CollectionBase<PivotDataField>.List
    CollectionBase<PivotDataField>.Remove(PivotDataField)
    CollectionBase<PivotDataField>.RemoveAt(Int32)
    CollectionBaseEx<PivotDataField>.add_Cleared(CollectionBaseEx.CollectionClear<>)
    CollectionBaseEx<PivotDataField>.add_Clearing(CollectionBaseEx.CollectionClear<>)
    CollectionBaseEx<PivotDataField>.add_Inserted(CollectionBaseEx.CollectionChange<>)
    CollectionBaseEx<PivotDataField>.add_Inserting(CollectionBaseEx.CollectionChange<>)
    CollectionBaseEx<PivotDataField>.add_Removed(CollectionBaseEx.CollectionChange<>)
    CollectionBaseEx<PivotDataField>.add_Removing(CollectionBaseEx.CollectionChange<>)
    CollectionBaseEx<PivotDataField>.add_Set(CollectionBaseEx.CollectionSet<>)
    CollectionBaseEx<PivotDataField>.add_Setting(CollectionBaseEx.CollectionSet<>)
    CollectionBaseEx<PivotDataField>.AppImplementation
    CollectionBaseEx<PivotDataField>.Application
    CollectionBaseEx<PivotDataField>.Changed
    CollectionBaseEx<PivotDataField>.ChangeName(IDictionary, ValueChangedEventArgs)
    CollectionBaseEx<PivotDataField>.Cleared
    CollectionBaseEx<PivotDataField>.Clearing
    CollectionBaseEx<PivotDataField>.ClearMaxValues()
    CollectionBaseEx<PivotDataField>.Clone(Object)
    CollectionBaseEx<PivotDataField>.EnsureCapacity(Int32)
    CollectionBaseEx<PivotDataField>.FindParent(Type)
    CollectionBaseEx<PivotDataField>.FindParent(Type, Boolean)
    CollectionBaseEx<PivotDataField>.GenerateDefaultName(ICollection<PivotDataField>, String)
    CollectionBaseEx<PivotDataField>.GenerateDefaultName(ICollection, String)
    CollectionBaseEx<PivotDataField>.GenerateDefaultName(String, ICollection[])
    CollectionBaseEx<PivotDataField>.Inserted
    CollectionBaseEx<PivotDataField>.Inserting
    CollectionBaseEx<PivotDataField>.OnClear()
    CollectionBaseEx<PivotDataField>.OnClearComplete()
    CollectionBaseEx<PivotDataField>.OnInsert(Int32, PivotDataField)
    CollectionBaseEx<PivotDataField>.OnInsertComplete(Int32, PivotDataField)
    CollectionBaseEx<PivotDataField>.OnRemove(Int32, PivotDataField)
    CollectionBaseEx<PivotDataField>.OnRemoveComplete(Int32, PivotDataField)
    CollectionBaseEx<PivotDataField>.OnSet(Int32, PivotDataField, PivotDataField)
    CollectionBaseEx<PivotDataField>.OnSetComplete(Int32, PivotDataField, PivotDataField)
    CollectionBaseEx<PivotDataField>.Parent
    CollectionBaseEx<PivotDataField>.QuietMode
    CollectionBaseEx<PivotDataField>.remove_Cleared(CollectionBaseEx.CollectionClear<>)
    CollectionBaseEx<PivotDataField>.remove_Clearing(CollectionBaseEx.CollectionClear<>)
    CollectionBaseEx<PivotDataField>.remove_Inserted(CollectionBaseEx.CollectionChange<>)
    CollectionBaseEx<PivotDataField>.remove_Inserting(CollectionBaseEx.CollectionChange<>)
    CollectionBaseEx<PivotDataField>.remove_Removed(CollectionBaseEx.CollectionChange<>)
    CollectionBaseEx<PivotDataField>.remove_Removing(CollectionBaseEx.CollectionChange<>)
    CollectionBaseEx<PivotDataField>.remove_Set(CollectionBaseEx.CollectionSet<>)
    CollectionBaseEx<PivotDataField>.remove_Setting(CollectionBaseEx.CollectionSet<>)
    CollectionBaseEx<PivotDataField>.Removed
    CollectionBaseEx<PivotDataField>.Removing
    CollectionBaseEx<PivotDataField>.Set
    CollectionBaseEx<PivotDataField>.SetParent(Object)
    CollectionBaseEx<PivotDataField>.Setting
    Namespace: Syncfusion.XlsIO.Implementation.PivotTables
    Assembly: Syncfusion.XlsIO.Portable.dll
    Syntax
    public class PivotDataFields : CollectionBaseEx<PivotDataField>, IList<PivotDataField>, ICollection<PivotDataField>, IEnumerable<PivotDataField>, IEnumerable, IParentApplication, ICloneParent, IPivotDataFields

    Constructors

    PivotDataFields(IApplication, Object)

    Initializes new instance of pivot table data fields collection.

    Declaration
    public PivotDataFields(IApplication application, object parent)
    Parameters
    Type Name Description
    IApplication application

    Application object for the new instance.

    System.Object parent

    Parent object for the new instance.

    Properties

    Item[String]

    Gets a IPivotDataField with the specified name from the collection. Read-only.

    Declaration
    public IPivotDataField this[string name] { get; }
    Parameters
    Type Name Description
    System.String name

    Pivot data field name

    Property Value
    Type
    IPivotDataField
    Examples

    The following code illustrates how to get the pivot table data field by data field name.

          using (ExcelEngine excelEngine = new ExcelEngine())
          {
            //Create a worksheet.        
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(2);
            IWorksheet sheet = workbook.Worksheets[0];
            IWorksheet pivotSheet = workbook.Worksheets[1];
            sheet.Range["A1"].Text = "Student ID";
            sheet.Range["B1"].Text = "Student Name";
            sheet.Range["C1"].Text = "Mark(Out of 100)";
            sheet.Range["D1"].Text = "Student City";
            sheet.Range["A1:D1"].AutofitColumns();
            sheet.Range["A2"].Number = 1;
            sheet.Range["A3"].Number = 2;
            sheet.Range["A4"].Number = 3;
            sheet.Range["A5"].Number = 4;
            sheet.Range["A6"].Number = 5;
            sheet.Range["B2"].Text = "Andrew";
            sheet.Range["B3"].Text = "Marson";
            sheet.Range["B4"].Text = "Jack";
            sheet.Range["B5"].Text = "Sam";
            sheet.Range["B6"].Text = "Breto";
            sheet.Range["C2"].Number = 77;
            sheet.Range["C3"].Number = 45;
            sheet.Range["C4"].Number = 92;
            sheet.Range["C5"].Number = 39;
            sheet.Range["C6"].Number = 55;
            sheet.Range["D2"].Text = "Chennai";
            sheet.Range["D3"].Text = "Bangalore";
            sheet.Range["D4"].Text = "Chennai";
            sheet.Range["D5"].Text = "Mysore";
            sheet.Range["D6"].Text = "Bangalore";
            IPivotCache cache = workbook.PivotCaches.Add(sheet["A1:D6"]);
            IPivotTable pivotTable = pivotSheet.PivotTables.Add("PivotTable1", pivotSheet["A1"], cache);  
            pivotTable.Fields[1].Axis = PivotAxisTypes.Row;
            pivotTable.Fields[3].Axis = PivotAxisTypes.Column;
            IPivotField datafield = pivotTable.Fields[2];
            pivotTable.DataFields.Add(datafield, "Sum of Marks", PivotSubtotalTypes.Sum);
    
            //Gets a pivot data field with the specified name from the collection
            IPivotDataField pivotDataField = pivotTable.DataFields["Sum of Marks"];
            pivotDataField.Name = "SUM Marks";
            pivotDataField.Subtotal = PivotSubtotalTypes.Average;
    
            pivotTable.BuiltInStyle = PivotBuiltInStyles.PivotStyleMedium20;
            workbook.SaveAs("PivotTables.xlsx");
            workbook.Close();
          }

    Methods

    Add(IPivotField, String, PivotSubtotalTypes)

    Adds a new data field to the PivotDataField collection.

    Declaration
    public IPivotDataField Add(IPivotField field, string name, PivotSubtotalTypes subtotal)
    Parameters
    Type Name Description
    IPivotField field

    The parent field to use.

    System.String name

    The name for the new data field.

    PivotSubtotalTypes subtotal

    The subtotal function for the new data field.

    Returns
    Type Description
    IPivotDataField

    Returns a pivot data field.

    Examples

    Following code snippet illustrates how to add a pivot data field to the pivot table.

    ExcelEngine excelEngine = new ExcelEngine();
    IApplication application = excelEngine.Excel;
    IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
    IWorksheet worksheet = workbook.Worksheets[0];
    
    // Create Pivot cache with the given data range
    IPivotCache cache = workbook.PivotCaches.Add(worksheet["A1:H50"]);  
    //Create "PivotTable1" with the cache at the specified range
    IPivotTable pivotTable = worksheet.PivotTables.Add("PivotTable1", worksheet["A1"], cache);
    //Add Pivot table fields (Row and Column fields)
    pivotTable.Fields[2].Axis = PivotAxisTypes.Row;
    pivotTable.Fields[6].Axis = PivotAxisTypes.Row;
    pivotTable.Fields[3].Axis = PivotAxisTypes.Column;
    
    //Add data field
    IPivotField field = pivotTable.Fields[5];
    pivotTable.DataFields.Add(field, "Sum", PivotSubtotalTypes.Sum);

    Explicit Interface Implementations

    IPivotDataFields.get_Item(Int32)

    Declaration
    IPivotDataField IPivotDataFields.get_Item(int index)
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type
    IPivotDataField

    IPivotDataFields.Item[Int32]

    Gets a pivot data field with the specified index from the collection. Read-only.

    Declaration
    IPivotDataField IPivotDataFields.this[] { get; }
    Parameters
    Type Name Description
    System.Int32 index

    Zero-based index of the data field to return.

    Returns
    Type
    IPivotDataField

    Implements

    System.Collections.Generic.IList<>
    System.Collections.Generic.ICollection<>
    System.Collections.Generic.IEnumerable<>
    System.Collections.IEnumerable
    IParentApplication
    ICloneParent
    IPivotDataFields
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved