Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread.Model Namespace / AggregationType Enumeration
Example Example


In This Topic
    AggregationType Enumeration
    In This Topic
    Specifies the type of aggregation on ranges of cells.
    Syntax
    'Declaration
     
    Public Enum AggregationType 
       Inherits System.Enum
    'Usage
     
    Dim instance As AggregationType
    public enum AggregationType : System.Enum 
    Members
    MemberDescription
    Avg Returns the average of cells in a range.
    AvgIgnoreHidden Returns the average of cells (ignores hidden values) in a range.
    Count Counts the number of cells in a range that contain numbers.
    CountA Counts the number of cells in a range that are not empty.
    CountAIgnoreHidden Counts the number of cells (ignores hidden values) in a range that are not empty.
    CountIgnoreHidden Counts the number of cells (ignores hidden values) in a range that contain numbers.
    Custom Specifies custom aggregation.
    Max Returns the maximum value of cells in a range.
    MaxIgnoreHidden Returns the maximum value of cells (ignores hidden values) in a range.
    Min Indicates the row count of the cells in the specified range of cells.
    MinIgnoreHidden Indicates the row count of the cells (ignores hidden values) in the specified range of cells.
    None Indicates that aggregation for the sheet is not supported.
    Product Multiplies all the cells in a range and returns the product.
    ProductIgnoreHidden Multiplies all the cells (ignores hidden values) in a range and returns the product.
    StDev Returns the standard deviation for a set of cells in a range.
    StDevIgnoreHidden Returns the standard deviation for a set of cells (ignores hidden values) in a range.
    StDevP Calculates standard deviation based on the entire population given as cells in a range.
    StDevPIgnoreHidden Calculates standard deviation based on the entire population given as cells (ignores hidden values) in a range.
    Sum Sums values of cells in a range.
    SumIgnoreHidden Sums values of cells (ignores hidden values) in a range.
    Var Calculates variance based on a sample of a population.
    VarIgnoreHidden Calculates variance based on a sample (ignores hidden values) of a population.
    VarP Calculates variance based on the entire population.
    VarPIgnoreHidden Calculates variance based on the entire population (ignores hidden values).
    Remarks
    AggregationType Function Code (Include Hidden Values) AggregationType Function Code (Ignore Hidden Values)
    Avg 1 AvgIgnoreHidden 101
    Count 2 CountIgnoreHidden 102
    CountA 3 CountAIgnoreHidden 103
    Max 4 MaxIgnoreHidden 104
    Min 5 MinIgnoreHidden 105
    Product 6 ProductIgnoreHidden 106
    StDev 7 StDevIgnoreHidden 107
    StDevP 8 StDevPIgnoreHidden 108
    Sum 9 SumIgnoreHidden 109
    Var 10 VarIgnoreHidden 110
    VarP 11 VarPIgnoreHidden 111
    Example

    This example sets the AggregationType.

    fpSpread1.Sheets[0].RowCount=8;
    fpSpread1.Sheets[0].ColumnCount = 15;
    fpSpread1.Sheets[0].GroupBarInfo.Visible = true;
    fpSpread1.Sheets[0].AllowGroup = true;
    fpSpread1.Sheets[0].GroupFooterVisible = true;
    fpSpread1.Sheets[0].ColumnFooter.Visible = true;
    fpSpread1.Sheets[0].ColumnFooter.RowCount = 2;
    fpSpread1.Sheets[0].ColumnFooter.Columns[12].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
    fpSpread1.Sheets[0].ColumnFooter.Cells[0, 12].RowSpan = 2; 
    //Value
    for (int r = 0; r < fpSpread1.Sheets[0].RowCount; r++)
    {
            for (int j = 0; j < fpSpread1.Sheets[0].ColumnCount; j++)
        {
            fpSpread1.Sheets[0].Models.Data.SetValue(r, j, j + r * fpSpread1.Sheets[0].ColumnCount); 
        }
    }
    int i=0;
    fpSpread1.Sheets[0].ColumnFooter.SetAggregationFormat(0, 1, "Sum:{0}");
    fpSpread1.Sheets[0].ColumnFooter.SetAggregationType(0,1, FarPoint.Win.Spread.Model.AggregationType.Sum); 
    fpSpread1.Sheets[0].Models.ColumnFooterRowAxis.SetResizable(1, true);
    fpSpread1.Sheets[0].ColumnFooter.Cells[0, i].Value = "Sum"; 
    
    private void fpSpread1_Grouped(object sender, EventArgs e)
     {
      FarPoint.Win.Spread.Model.GroupDataModel gdm;
      gdm = (FarPoint.Win.Spread.Model.GroupDataModel)fpSpread1.ActiveSheet.Models.Data;
      gdm.GroupFooterVisible = true;
      FarPoint.Win.Spread.Model.Group g1 = (FarPoint.Win.Spread.Model.Group)gdm.Groups[1];           
      ((FarPoint.Win.Spread.Model.IAggregationSupport)g1.GroupFooter.DataModel).SetCellAggregationType(0, 0, FarPoint.Win.Spread.Model.AggregationType.Sum);
    ((FarPoint.Win.Spread.Model.IAggregationSupport)g1.GroupFooter.DataModel).SetCellAggregationFormat(0, 0, "Sum: {0}");
      fpSpread1.ActiveSheet.Models.Data = gdm;
      }
    fpSpread1.Sheets(0).RowCount = 8
    fpSpread1.Sheets(0).ColumnCount = 15
    fpSpread1.Sheets(0).GroupBarInfo.Visible = True
    fpSpread1.Sheets(0).AllowGroup = True
    fpSpread1.Sheets(0).GroupFooterVisible = True
    fpSpread1.Sheets(0).ColumnFooter.Visible = True
    fpSpread1.Sheets(0).ColumnFooter.RowCount = 2
    fpSpread1.Sheets(0).ColumnFooter.Columns(12).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left
    'Value
            Dim r As Integer
            Dim j As Integer
            For r = 0 To fpSpread1.Sheets(0).RowCount
                For j = 0 To fpSpread1.Sheets(0).ColumnCount
                    fpSpread1.Sheets(0).Models.Data.SetValue(r, j, j + r * fpSpread1.Sheets(0).ColumnCount)
                Next j
            Next r
            Dim i As Integer
            i = 0
    fpSpread1.Sheets(0).ColumnFooter.SetAggregationFormat(0, 1, "Sum:{0}")
    fpSpread1.Sheets(0).ColumnFooter.SetAggregationType(0, 1, FarPoint.Win.Spread.Model.AggregationType.Sum)
    fpSpread1.Sheets(0).Models.ColumnFooterRowAxis.SetResizable(1, True)
    fpSpread1.Sheets(0).ColumnFooter.Cells(0, i).Value = "Sum"
    
    Private Sub fpSpread1_Grouped(ByVal sender As Object, ByVal e As System.EventArgs) Handles fpSpread1.Grouped
            Dim gdm As FarPoint.Win.Spread.Model.GroupDataModel
            Dim g1 As FarPoint.Win.Spread.Model.Group
            gdm = fpSpread1.Sheets(0).Models.Data
            gdm.GroupFooterVisible = True
            g1 = gdm.Groups(1)
            CType(g1.GroupFooter.DataModel, FarPoint.Win.Spread.Model.IAggregationSupport).SetCellAggregationType(0, 0, FarPoint.Win.Spread.Model.AggregationType.Sum)
    CType(g1.GroupFooter.DataModel, FarPoint.Win.Spread.Model.IAggregationSupport).SetCellAggregationFormat(0, 0, "Sum: {0}")
            fpSpread1.ActiveSheet.Models.Data = gdm
        End Sub
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             FarPoint.Win.Spread.Model.AggregationType

    See Also