Show / Hide Table of Contents

Class DataBand

This class represents the Data band.

Inheritance
System.Object
Base
ComponentBase
ReportComponentBase
BreakableComponent
BandBase
DataBand
Implements
IFRSerializable
IParent
Inherited Members
BandBase.BeforeLayout
BandBase.AfterLayout
BandBase.StartNewPage
BandBase.RepeatBandNTimes
BandBase.FirstRowStartsNewPage
BandBase.PrintOnBottom
BandBase.KeepChild
BandBase.OutlineExpression
BandBase.Child
BandBase.Objects
BandBase.Repeated
BandBase.BeforeLayoutEvent
BandBase.AfterLayoutEvent
BandBase.AbsLeft
BandBase.AbsTop
BandBase.Guides
BandBase.RowNo
BandBase.AbsRowNo
BandBase.IsFirstRow
BandBase.IsLastRow
BandBase.UpdateLayout(Single, Single)
BandBase.SaveState()
BandBase.RestoreState()
BandBase.CalcHeight()
BandBase.Break(BreakableComponent)
BandBase.GetData()
BandBase.OnBeforeLayout(EventArgs)
BandBase.OnAfterLayout(EventArgs)
BreakableComponent.CanBreak
BreakableComponent.BreakTo
ReportComponentBase.BeforePrint
ReportComponentBase.AfterPrint
ReportComponentBase.AfterData
ReportComponentBase.Click
ReportComponentBase.Exportable
ReportComponentBase.Border
ReportComponentBase.Fill
ReportComponentBase.FillColor
ReportComponentBase.Bookmark
ReportComponentBase.Hyperlink
ReportComponentBase.CanGrow
ReportComponentBase.CanShrink
ReportComponentBase.GrowToBottom
ReportComponentBase.ShiftMode
ReportComponentBase.Style
ReportComponentBase.EvenStyle
ReportComponentBase.HoverStyle
ReportComponentBase.EvenStylePriority
ReportComponentBase.PrintOn
ReportComponentBase.BeforePrintEvent
ReportComponentBase.AfterPrintEvent
ReportComponentBase.AfterDataEvent
ReportComponentBase.ClickEvent
ReportComponentBase.FlagSimpleBorder
ReportComponentBase.FlagUseBorder
ReportComponentBase.FlagUseFill
ReportComponentBase.FlagPreviewVisible
ReportComponentBase.FlagSerializeStyle
ReportComponentBase.FlagProvidesHyperlinkValue
ReportComponentBase.Cursor
ReportComponentBase.MouseMoveEvent
ReportComponentBase.MouseUpEvent
ReportComponentBase.MouseDownEvent
ReportComponentBase.MouseEnterEvent
ReportComponentBase.MouseLeaveEvent
ReportComponentBase.ApplyStyle(Style)
ReportComponentBase.SaveStyle()
ReportComponentBase.RestoreStyle()
ReportComponentBase.DrawBackground(FRPaintEventArgs)
ReportComponentBase.Draw(FRPaintEventArgs)
ReportComponentBase.IsVisible(FRPaintEventArgs)
ReportComponentBase.Deserialize(FRReader)
ReportComponentBase.OnClick(EventArgs)
ReportComponentBase.OnAfterLoad()
ReportComponentBase.HasClickListeners()
ReportComponentBase.FinalizeComponent()
ReportComponentBase.OnBeforePrint(EventArgs)
ReportComponentBase.OnAfterPrint(EventArgs)
ReportComponentBase.OnAfterData(EventArgs)
ComponentBase.AbsBottom
ComponentBase.AbsBounds
ComponentBase.AbsRight
ComponentBase.Anchor
ComponentBase.Bottom
ComponentBase.Bounds
ComponentBase.ClientSize
ComponentBase.Dock
ComponentBase.GroupIndex
ComponentBase.Height
ComponentBase.Left
ComponentBase.Right
ComponentBase.Tag
ComponentBase.Top
ComponentBase.Visible
ComponentBase.Printable
ComponentBase.Width
Base.Name
Base.Restrictions
Base.Flags
Base.Parent
Base.BaseName
Base.ClassName
Base.Report
Base.Page
Base.ChildObjects
Base.AllObjects
Base.ZOrder
Base.IsAncestor
Base.IsDesigning
Base.IsPrinting
Base.IsRunning
Base.OriginalComponent
Base.SetProp(Base, Base)
Base.FloatDiff(Single, Single)
Base.ExtractDefaultMacros(String)
Base.Dispose(Boolean)
Base.SetFlags(Flags, Boolean)
Base.SetReport(Report)
Base.SetName(String)
Base.SetParent(Base)
Base.SetParentCore(Base)
Base.FindObject(String)
Base.CreateUniqueName()
Base.Clear()
Base.BaseAssign(Base)
Base.AssignAll(Base)
Base.HasParent(Base)
Base.HasFlag(Flags)
Base.HasRestriction(Restrictions)
Base.InvokeEvent(String, Object)
Base.GetCustomScript()
Base.ExtractMacros()
Base.IsHaveToConvert(Object)
Base.GetConvertedObjects()
Base.ForEachAllConvectedObjects(Object)
Namespace: FastReport
Assembly: FastReport.OpenSource.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)

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
BandBase.AddChild(Base)

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
BandBase.Assign(Base)
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
AssignAll(Base)

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
BandBase.CanContain(Base)

DeserializeSubItems(FRReader)

Deserializes nested object properties.

Declaration
protected override void DeserializeSubItems(FRReader reader)
Parameters
Type Name Description
FRReader reader

Reader object.

Overrides
Base.DeserializeSubItems(FRReader)
Remarks

Typically the object serializes all properties to the single xml item:

<TextObject Name="Text2" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>

Some objects like DataBand have child objects that serialized in subitems:

<DataBand Name="Data1" Top="163" Width="718.2" Height="18.9">
  <TextObject Name="Text3" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
</DataBand>

To read such subitems, the DeserializeSubItems method is used. Base implementation reads the child objects. You may override it to read some specific subitems.

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
BandBase.GetChildObjects(ObjectCollection)

GetChildOrder(Base)

Returns z-order of the specified child object.

Declaration
public override int GetChildOrder(Base child)
Parameters
Type Name Description
Base child

Child object.

Returns
Type Description
System.Int32

Z-order of the specified object.

Overrides
BandBase.GetChildOrder(Base)
Remarks

This method must return the index of a specified child object in the internal child list.

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
BandBase.GetExpressions()
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.

InitDataSource()

Initializes the data source connected to this band.

Declaration
public void InitDataSource()

InitializeComponent()

Initializes the object before running a report.

Declaration
public override void InitializeComponent()
Overrides
BandBase.InitializeComponent()
Remarks

This method is used by the report engine, do not call it directly.

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
BandBase.RemoveChild(Base)

Serialize(FRWriter)

Serializes the object.

Declaration
public override void Serialize(FRWriter writer)
Parameters
Type Name Description
FRWriter writer

Writer object.

Overrides
BandBase.Serialize(FRWriter)
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).

SetChildOrder(Base, Int32)

Sets the z-order of the specified object.

Declaration
public override void SetChildOrder(Base child, int order)
Parameters
Type Name Description
Base child

Child object.

System.Int32 order

New Z-order.

Overrides
BandBase.SetChildOrder(Base, Int32)
Remarks

This method must place the specified child object at the specified position in the internal child list.

Implements

IFRSerializable
IParent
Back to top Generated by DocFX