Class GroupHeaderBand
Represents a group header band.
Inheritance
Inherited Members
Namespace: FastReport
Assembly: FastReport.Base.dll
Syntax
public class GroupHeaderBand : HeaderFooterBandBase, IFRSerializable, IParent
Remarks
A simple group consists of one GroupHeaderBand and the DataBand that is set to the Data property. To create the nested groups, use the NestedGroup property.
caution
Only the last nested group can have data band.
Use the Condition property to set the group condition. The SortOrder property can be used to set the sort order for group's data rows. You can also use the Sort property of the group's DataBand to specify additional sort.
Examples
This example shows how to create nested groups.
ReportPage page = report.Pages[0] as ReportPage;
// create the main group
GroupHeaderBand mainGroup = new GroupHeaderBand();
mainGroup.Height = Units.Millimeters * 10;
mainGroup.Name = "MainGroup";
mainGroup.Condition = "[Orders.CustomerName]";
// add a group to the page
page.Bands.Add(mainGroup);
// create the nested group
GroupHeaderBand nestedGroup = new GroupHeaderBand();
nestedGroup.Height = Units.Millimeters * 10;
nestedGroup.Name = "NestedGroup";
nestedGroup.Condition = "[Orders.OrderDate]";
// add it to the main group
mainGroup.NestedGroup = nestedGroup;
// create a data band
DataBand dataBand = new DataBand();
dataBand.Height = Units.Millimeters * 10;
dataBand.Name = "GroupData";
dataBand.DataSource = report.GetDataSource("Orders");
// connect the databand to the nested group
nestedGroup.Data = dataBand;
Constructors
GroupHeaderBand()
Initializes a new instance of the GroupHeaderBand class with default settings.
Declaration
public GroupHeaderBand()
Properties
Condition
Gets or sets the group condition.
Declaration
public string Condition { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This property can contain any valid expression. When running a report, this expression is calculated for each data row. When the value of this condition is changed, FastReport starts a new group.
Data
Gets or sets the group data band.
Declaration
public DataBand Data { get; set; }
Property Value
Type | Description |
---|---|
DataBand |
Remarks
Use this property to add a data band to a group. Note: only the last nested group can have Data band.
Examples
This example demonstrates how to add a data band to a group.
ReportPage page;
GroupHeaderBand group = new GroupHeaderBand();
group.Data = new DataBand();
page.Bands.Add(group);
Footer
Gets or sets a footer band.
Declaration
public DataFooterBand Footer { get; set; }
Property Value
Type | Description |
---|---|
DataFooterBand |
Remarks
To access a group footer band, use the GroupFooter property.
GroupFooter
Gets or sets a group footer.
Declaration
public GroupFooterBand GroupFooter { get; set; }
Property Value
Type | Description |
---|---|
GroupFooterBand |
Header
Gets or sets a header band.
Declaration
public DataHeaderBand Header { get; set; }
Property Value
Type | Description |
---|---|
DataHeaderBand |
KeepTogether
Gets or sets a value indicating that the group should be printed together on one page.
Declaration
public bool KeepTogether { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
NestedGroup
Gets or sets a nested group.
Declaration
public GroupHeaderBand NestedGroup { get; set; }
Property Value
Type | Description |
---|---|
GroupHeaderBand |
Remarks
Use this property to create nested groups.
caution
Only the last nested group can have data band.
Examples
This example demonstrates how to create a group with nested group.
ReportPage page;
GroupHeaderBand group = new GroupHeaderBand();
group.NestedGroup = new GroupHeaderBand();
group.NestedGroup.Data = new DataBand();
page.Bands.Add(group);
ResetPageNumber
Gets or sets a value that determines whether to reset the page numbers when this group starts print.
Declaration
public bool ResetPageNumber { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Typically you should set the StartNewPage property to true as well.
SortOrder
Gets or sets the sort order.
Declaration
public SortOrder SortOrder { get; set; }
Property Value
Type | Description |
---|---|
SortOrder |
Remarks
FastReport can sort data rows automatically using the Condition value.
Methods
AddChild(Base)
Declaration
public override void AddChild(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child |
Overrides
Assign(Base)
Declaration
public override void Assign(Base source)
Parameters
Type | Name | Description |
---|---|---|
Base | source |
Overrides
CanContain(Base)
Declaration
public override bool CanContain(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetChildObjects(ObjectCollection)
Declaration
public override void GetChildObjects(ObjectCollection list)
Parameters
Type | Name | Description |
---|---|---|
ObjectCollection | list |
Overrides
GetExpressions()
Declaration
public override string[] GetExpressions()
Returns
Type | Description |
---|---|
System.String[] |
Overrides
RemoveChild(Base)
Declaration
public override void RemoveChild(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child |
Overrides
Serialize(FRWriter)
Declaration
public override void Serialize(FRWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FRWriter | writer |