Spread Windows Forms 18
Spread Windows Forms 18 Product Documentation / Developer's Guide / Customizing Row or Column Interaction / Managing Grouping of Rows of User Data / Setting the Appearance of Grouped Rows
In This Topic
    Setting the Appearance of Grouped Rows
    In This Topic

    You can customize the appearance of the group headers and the grouped rows. For an introduction to the user interface for grouping, refer to Using Grouping.

    You can set up the display so that the items are shown initially all expanded or all collapsed when grouping is performed. The GroupingPolicy property only applies to new groups.

    You can set the colors and other formatting of both the hierarchy names and the data in the rows when grouping is performed.

    You can hide or display the grouping bar at the top of the sheet.

    The following table describes the members used for customizing the appearance of grouped rows:

    Grouping API Member Description
    GroupInfo Class that represents grouping information
    GroupInfoCollection Collection of grouping information

    For more information on other hierarchical displays of data, refer to Working with Hierarchical Data Display.

    You can also define a set of properties in an array list called GroupInfo. Set the appearance of grouped rows by adding styles to the array list of appearance properties for grouping. A collection of GroupInfo objects is in the GroupInfoCollection. To set the appearance settings in a GroupInfo to a particular sheet, set the GroupInfos property on that sheet. Appearance settings for grouping include:

    Example

    This example sets the different appearance for group headers in primary and secondary groups. The appearance of group headers remains same from secondary group onwards.

    C#
    Copy Code
    fpSpread1.AllowColumnMove = true;
    fpSpread1.ActiveSheet.GroupBarInfo.Visible = true;
    fpSpread1.ActiveSheet.GroupBarInfo.BackColor = Color.Aquamarine;
    fpSpread1.ActiveSheet.GroupBarInfo.Height = 75;
    fpSpread1.ActiveSheet.GroupMaximumLevel = 3;
    fpSpread1.ActiveSheet.GroupBarInfo.GroupVerticalIndent = 20;
    fpSpread1.ActiveSheet.AllowGroup = true;
    FarPoint.Win.Spread.GroupInfo gi = new FarPoint.Win.Spread.GroupInfo();
    gi.BackColor = Color.Yellow;
    FarPoint.Win.Spread.GroupInfo gi2 = new FarPoint.Win.Spread.GroupInfo();
    gi2.BackColor = Color.Green;
    FarPoint.Win.Spread.GroupInfoCollection gic = new FarPoint.Win.Spread.GroupInfoCollection();
    gic.AddRange(new FarPoint.Win.Spread.GroupInfo[] { gi, gi2 });
    fpSpread1.ActiveSheet.GroupInfos = gic;
    
    VB
    Copy Code
    FpSpread1.AllowColumnMove = True
    FpSpread1.ActiveSheet.GroupBarInfo.Visible = True
    FpSpread1.ActiveSheet.GroupBarInfo.BackColor = Color.Aquamarine
    FpSpread1.ActiveSheet.GroupBarInfo.Height = 75
    FpSpread1.ActiveSheet.GroupMaximumLevel = 3
    FpSpread1.ActiveSheet.GroupBarInfo.GroupVerticalIndent = 20
    FpSpread1.ActiveSheet.AllowGroup = True
    Dim gi As New FarPoint.Win.Spread.GroupInfo()
    gi.BackColor = Color.Yellow
    Dim gi2 As New FarPoint.Win.Spread.GroupInfo()
    gi2.BackColor = Color.Green
    Dim gic As New FarPoint.Win.Spread.GroupInfoCollection()
    gic.AddRange(New FarPoint.Win.Spread.GroupInfo() {gi, gi2})
    FpSpread1.ActiveSheet.GroupInfos = gic
    

    Note:

    • Only column and sheet appearance settings remain when grouping is turned on. Since rows and cells are moved when the grouping feature is turned on, any style or span settings are ignored.
    • For more information about the group data model and the effect on the sheet data model, refer to Creating a Custom Group.
    See Also