Spread ASP.NET 6.0 Product Documentation
Grouped Event
See Also  Example Send Feedback
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > FpSpread Class : Grouped Event


Glossary Item Box

Occurs when the user is done grouping.

Syntax

Visual Basic (Declaration) 
Public Event Grouped As EventHandler
Visual Basic (Usage)Copy Code
Dim instance As FpSpread
Dim handler As EventHandler
 
AddHandler instance.Grouped, handler
C# 
public event EventHandler Grouped

Remarks

The EventHandler receives an argument containing data related to this event.

Example

This example uses the Grouped event.
C#Copy Code
FpSpread1.Sheets[0].RowCount = 8;
FpSpread1.Sheets[0].ColumnCount = 15;
this.FpSpread1.ActiveSheetView.GroupBarVisible = true;
this.FpSpread1.ActiveSheetView.AllowGroup = true;
this.FpSpread1.ActiveSheetView.GroupFooterVisible = true;
this.FpSpread1.ActiveSheetView.ColumnFooter.Visible = true;
this.FpSpread1.ActiveSheetView.ColumnFooter.RowCount = 2;
this.FpSpread1.ActiveSheetView.ColumnFooter.DefaultStyle.Border.BorderStyle = BorderStyle.Double;
this.FpSpread1.ActiveSheetView.ColumnFooter.Columns[12].HorizontalAlign = HorizontalAlign.Left;
this.FpSpread1.ActiveSheetView.ColumnFooter.Cells[0, 12].RowSpan = 2;
 //Value
for (int r = 0; r < this.FpSpread1.ActiveSheetView.RowCount; r++)
                           {
for (int j = 0; j < this.FpSpread1.ActiveSheetView.ColumnCount; j++)
                               {
                               }
                           }
int i = 0;
this.FpSpread1.ActiveSheetView.Columns[i].AggregationType = FarPoint.Web.Spread.Model.AggregationType.Sum;
this.FpSpread1.ActiveSheetView.ColumnFooter.Cells[0, i].Value = "Sum";
this.FpSpread1.ActiveSheetView.ColumnFooter.Cells[1, i].Value = "Sum:[{0}]"; 

//Change group footer styles
protected void FpSpread1_Grouped(object sender, EventArgs e)
        {
FarPoint.Web.Spread.Model.GroupFooter gf = default(FarPoint.Web.Spread.Model.GroupFooter);
FarPoint.Web.Spread.GroupInfo gi = default(FarPoint.Web.Spread.GroupInfo);
gf = ((FarPoint.Web.Spread.Model.GroupDataModel )FpSpread1.ActiveSheetView.DataModel).GetGroupFooter(2);
gi = FpSpread1.ActiveSheetView.GetGroupFooterInfo(gf);
gi.Font.Name = "Verdana";
gi.Font.Size = 8;
gi.ForeColor = System.Drawing.Color.Red;
}

//Put custom text in groups
//protected void FpSpread1_Grouped(object sender, EventArgs e)
//        {
//            FarPoint.Web.Spread.Model.GroupDataModel gdm = default(FarPoint.Web.Spread.Model.GroupDataModel);
//            FarPoint.Web.Spread.Model.Group g1 = default(FarPoint.Web.Spread.Model.Group);
//            gdm = FpSpread1.Sheets(0).DataModel;
//            g1 = gdm.Groups(0);
//            g1.Text = "test";
//        }
//Put custom text in footers
//FpSpread1.ActiveSheetView.Columns[0].AggregationType = FarPoint.Web.Spread.Model.AggregationType.Custom;
//protected void FpSpread1_Aggregate(object sender, FarPoint.Web.Spread.Model.AggregateArgs e)
//{
//	e.Result = "test";
//}
Visual BasicCopy Code
FpSpread1.Sheets(0).RowCount = 8
FpSpread1.Sheets(0).ColumnCount = 15
FpSpread1.ActiveSheetView.GroupBarVisible = True
FpSpread1.ActiveSheetView.AllowGroup = True
FpSpread1.ActiveSheetView.GroupFooterVisible = True
FpSpread1.ActiveSheetView.ColumnFooter.Visible = True
FpSpread1.ActiveSheetView.ColumnFooter.RowCount = 2
FpSpread1.ActiveSheetView.ColumnFooter.DefaultStyle.Border.BorderStyle = BorderStyle.Double 

'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.ActiveSheetView.DataModel.SetValue(r, j, j + r * FpSpread1.ActiveSheetView.ColumnCount) 
Next j
Next r
Dim i As Integer
i = 0
FpSpread1.ActiveSheetView.Columns(0).AggregationType = FarPoint.Web.Spread.Model.AggregationType.Sum
FpSpread1.ActiveSheetView.ColumnFooter.Cells(0, i).Value = "Sum" 
FpSpread1.ActiveSheetView.ColumnFooter.Cells(1, i).Value = "Sum:[{0}]" 

 Protected Sub FpSpread1_Grouped(ByVal sender As Object, ByVal e As System.EventArgs) Handles FpSpread1.Grouped
'Change Group Footer styles
Dim gf As FarPoint.Web.Spread.Model.GroupFooter
Dim gi As FarPoint.Web.Spread.GroupInfo
gf = CType(FpSpread1.ActiveSheetView.DataModel, FarPoint.Web.Spread.Model.GroupDataModel).GetGroupFooter(2)
gi = FpSpread1.ActiveSheetView.GetGroupFooterInfo(gf)
gi.Font.Name = "Verdana"
gi.Font.Size = 8
gi.ForeColor = System.Drawing.Color.Red
'Change Group Text
'Dim gdm As FarPoint.Web.Spread.Model.GroupDataModel
'Dim g1 As FarPoint.Web.Spread.Model.Group
'gdm = FpSpread1.Sheets(0).DataModel
'g1 = gdm.Groups(0)
'g1.Text = "test"
    End Sub

'Put custom text in footers
'FpSpread1.ActiveSheetView.Columns(0).AggregationType = FarPoint.Web.Spread.Model.AggregationType.Custom
'Protected Sub FpSpread1_Aggregate(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.Model.AggregateArgs) Handles 'FpSpread1.Aggregate
'        e.Result = "test"
'End Sub

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2002-2012 GrapeCity, Inc. All Rights Reserved.