Spread Windows Forms 9.0 Product Documentation
Grouping Event
Example 


Occurs when the user performs grouping.
Syntax
'Declaration
 
Public Event Grouping As GroupingEventHandler
'Usage
 
Dim instance As FpSpread
Dim handler As GroupingEventHandler
 
AddHandler instance.Grouping, handler
public event GroupingEventHandler Grouping
Event Data

The event handler receives an argument of type GroupingEventArgs containing data related to this event. The following GroupingEventArgs properties provide information specific to this event.

PropertyDescription
CancelDetermines whether to cancel the grouping.  
GroupComparerGets or sets the group comparer.  
SortInfoGets the sorting information.  
Remarks

This event is raised by the OnGrouping method when the user groups rows.

Example
This example uses the Grouping event.
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.SetAggregationType(0, 1, FarPoint.Win.Spread.Model.AggregationType.Sum);
fpSpread1.Sheets[0].ColumnFooter.Cells[0, i].Value = "Sum";

private void fpSpread1_Grouping(object sender, FarPoint.Win.Spread.GroupingEventArgs e)
        {
            listBox1.Items.Add("grouping");
        }
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
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.SetAggregationType(0, 1, FarPoint.Win.Spread.Model.AggregationType.Sum)
FpSpread1.Sheets(0).ColumnFooter.Cells(0, i).Value = "Sum"
    End Sub

    Private Sub FpSpread1_Grouping(sender As Object, e As FarPoint.Win.Spread.GroupingEventArgs) Handles FpSpread1.Grouping
ListBox1.Items.Add("grouping")
    End Sub
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

FpSpread Class
FpSpread Members

 

 


Copyright © GrapeCity, inc. All rights reserved.