Class GroupHeaderBand
Represents a group header band.
Inheritance
Inherited Members
Namespace: FastReport
Assembly: FastReport.OpenSource.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)
Adds a child object to this object's childs.
Declaration
public override void AddChild(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Object to add. |
Overrides
Assign(Base)
Copies the contents of another, similar object.
Declaration
public override void Assign(Base source)
Parameters
Type | Name | Description |
---|---|---|
Base | source | Source object to copy the contents from. |
Overrides
Remarks
Call Assign to copy the properties from another object of the same type. The standard form of a call to Assign is
destination.Assign(source);
which tells the destination object to copy the contents of the source object to itself. In this method, all child objects are ignored. If you want to copy child objects, use the AssignAll(Base) method.
See Also
CanContain(Base)
Gets a value indicating that this object can contain the specified child object.
Declaration
public override bool CanContain(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Child object. |
Returns
Type | Description |
---|---|
System.Boolean | true if this object can contain the specified child object; otherwise, false. |
Overrides
GetChildObjects(ObjectCollection)
Gets a list of child objects.
Declaration
public override void GetChildObjects(ObjectCollection list)
Parameters
Type | Name | Description |
---|---|---|
ObjectCollection | list | List to fill with values. |
Overrides
GetExpressions()
Gets all expressions contained in the object.
Declaration
public override string[] GetExpressions()
Returns
Type | Description |
---|---|
System.String[] | Array of expressions or null if object contains no expressions. |
Overrides
Remarks
Do not call this method directly. You may override it if you are developing a new component for FastReport.
This method is called by FastReport each time before run a report. FastReport do this to collect all expressions and compile them. For example, GetExpressions method of the TextObject class parses the text and returns all expressions found in the text.
RemoveChild(Base)
Removes a specified object from this object's childs.
Declaration
public override void RemoveChild(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child |
Overrides
Serialize(FRWriter)
Serializes the object.
Declaration
public override void Serialize(FRWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FRWriter | writer | Writer object. |
Overrides
Remarks
Do not call this method directly. You should override it if you are developing a new component for FastReport.
This method is called when the object needs to save the state. It may happen when:
- saving the report to the file or stream;
- saving the report to the designer's undo buffer;
- assigning the object to another object using the Assign(Base) or AssignAll(Base) methods;
- saving the object to the designer's clipboard;
- saving the object to the preview (when run a report).