Class DataBand
This class represents the Data band.
Inheritance
Inherited Members
Namespace: FastReport
Assembly: FastReport.Base.dll
Syntax
public class DataBand : BandBase, IFRSerializable, IParent
Remarks
Use the DataSource property to connect the band to a datasource. Set the Filter property if you want to filter data rows. The Sort property can be used to sort data rows.
Constructors
DataBand()
Initializes a new instance of the DataBand class.
Declaration
public DataBand()
Properties
Bands
Gets a collection of detail bands.
Declaration
public BandCollection Bands { get; }
Property Value
Type | Description |
---|---|
BandCollection |
CollectChildRows
Gets or sets a value indicating that the databand should collect child data rows.
Declaration
public bool CollectChildRows { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This property determines how the master-detail report is printed. Default behavior is:
MasterData row1
-- DetailData row1
-- DetailData row2
-- DetailData row3
MasterData row2
-- DetailData row1
-- DetailData row2
When you set this property to true, the master databand will collect all child data rows under a single master data row:
MasterData row1
-- DetailData row1
-- DetailData row2
-- DetailData row3
-- DetailData row4
-- DetailData row5
Columns
Gets the band columns.
Declaration
public BandColumns Columns { get; }
Property Value
Type | Description |
---|---|
BandColumns |
DataSource
Gets or sets a data source. Please note: data source have to be enabled.
Declaration
public DataSourceBase DataSource { get; set; }
Property Value
Type | Description |
---|---|
DataSourceBase |
Filter
Gets the row filter expression.
Declaration
public string Filter { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This property can contain any valid boolean expression. If the expression returns false, the corresponding data row will not be printed.
Footer
Gets or sets a footer band.
Declaration
public DataFooterBand Footer { get; set; }
Property Value
Type | Description |
---|---|
DataFooterBand |
Header
Gets or sets a header band.
Declaration
public DataHeaderBand Header { get; set; }
Property Value
Type | Description |
---|---|
DataHeaderBand |
IdColumn
Gets or sets the key column that identifies the data row.
Declaration
public string IdColumn { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This property is used when printing a hierarchic list.
To print the hierarchic list, you have to setup three properties: IdColumn, ParentIdColumn and Indent. First two properties are used to identify the data row and its parent; the Indent property specifies the indent that will be used to shift the databand according to its hierarchy level.
When printing hierarchy, FastReport shifts the band to the right (by value specified in the Indent property), and also decreases the width of the band by the same value. You may use the Anchor property of the objects on a band to indicate whether the object should move with the band, or stay on its original position, or shrink.
Indent
Gets or sets the indent that will be used to shift the databand according to its hierarchy level.
Declaration
public float Indent { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
This property is used when printing a hierarchic list. See description of the IdColumn property for more details.
KeepDetail
Gets or sets a value indicating that the band should be printed together with all its detail rows.
Declaration
public bool KeepDetail { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
KeepTogether
Gets or sets a value indicating that all band rows should be printed together on one page.
Declaration
public bool KeepTogether { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
MaxRows
Limits the maximum number of rows in a datasource. 0 means no limit.
Declaration
public int MaxRows { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
ParentIdColumn
Gets or sets the column that identifies the parent data row.
Declaration
public string ParentIdColumn { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This property is used when printing a hierarchic list. See description of the IdColumn property for more details.
PrintIfDatasourceEmpty
Gets or sets a value that determines whether to print a band if its datasource is empty.
Declaration
public bool PrintIfDatasourceEmpty { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
PrintIfDetailEmpty
Gets or sets a value that determines whether to print a band if all its detail rows are empty.
Declaration
public bool PrintIfDetailEmpty { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Relation
Gets or sets a relation used to establish a master-detail relationship between this band and its parent.
Declaration
public Relation Relation { get; set; }
Property Value
Type | Description |
---|---|
Relation |
Remarks
Use this property if there are several relations exist between two data sources. If there is only one relation (in most cases it is), you can leave this property empty.
ResetPageNumber
Gets or sets a value that determines whether to reset the page numbers when this band 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.
RowCount
Gets or sets a number of rows in the virtual data source.
Declaration
public int RowCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Use this property if your data band is not connected to any data source. In this case the virtual data source with the specified number of rows will be used.
Sort
Gets the collection of sort conditions.
Declaration
public SortCollection Sort { get; }
Property Value
Type | Description |
---|---|
SortCollection |
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
DeserializeSubItems(FRReader)
Declaration
protected override void DeserializeSubItems(FRReader reader)
Parameters
Type | Name | Description |
---|---|---|
FRReader | reader |
Overrides
GetChildObjects(ObjectCollection)
Declaration
public override void GetChildObjects(ObjectCollection list)
Parameters
Type | Name | Description |
---|---|---|
ObjectCollection | list |
Overrides
GetChildOrder(Base)
Declaration
public override int GetChildOrder(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child |
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
GetExpressions()
Declaration
public override string[] GetExpressions()
Returns
Type | Description |
---|---|
System.String[] |
Overrides
InitDataSource()
Initializes the data source connected to this band.
Declaration
public void InitDataSource()
InitializeComponent()
Declaration
public override void InitializeComponent()
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 |
Overrides
SetChildOrder(Base, Int32)
Declaration
public override void SetChildOrder(Base child, int order)
Parameters
Type | Name | Description |
---|---|---|
Base | child | |
System.Int32 | order |