Class BandBase
Base class for all bands.
Inheritance
Inherited Members
Namespace: FastReport
Assembly: FastReport.OpenSource.dll
Syntax
public abstract class BandBase : BreakableComponent, IFRSerializable, IParent
Constructors
BandBase()
Initializes a new instance of the BandBase class with default settings.
Declaration
public BandBase()
Properties
AbsLeft
Gets the absolute left coordinate of the object.
Declaration
public override float AbsLeft { get; }
Property Value
Type | Description |
---|---|
System.Single |
Overrides
AbsRowNo
Gets an absolute row number (the same value returned by the "AbsRow#" system variable).
Declaration
public int AbsRowNo { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
AbsTop
Gets the absolute top coordinate of the object.
Declaration
public override float AbsTop { get; }
Property Value
Type | Description |
---|---|
System.Single |
Overrides
AfterLayoutEvent
Gets or sets a script event name that will be fired after the child objects layout was finished.
Declaration
public string AfterLayoutEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
BeforeLayoutEvent
Gets or sets a script event name that will be fired before the band layouts its child objects.
Declaration
public string BeforeLayoutEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Child
Gets or sets a child band that will be printed right after this band.
Declaration
public ChildBand Child { get; set; }
Property Value
Type | Description |
---|---|
ChildBand |
Remarks
Typical use of child band is to print several objects that can grow or shrink. It also can be done using the shift feature (via ShiftMode property), but in some cases it's not possible.
FirstRowStartsNewPage
Gets or sets a value indicating that the first row can start a new report page.
Declaration
public bool FirstRowStartsNewPage { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Use this property if StartNewPage is set to true. Normally the new page is not started when printing the first data row, to avoid empty first page.
Guides
Gets or sets collection of guide lines for this band.
Declaration
public FloatCollection Guides { get; set; }
Property Value
Type | Description |
---|---|
FloatCollection |
IsFirstRow
Gets a value indicating that this is the first data row.
Declaration
public bool IsFirstRow { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsLastRow
Gets a value indicating that this is the last data row.
Declaration
public bool IsLastRow { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
KeepChild
Gets or sets a value indicating that the band should be printed together with its child band.
Declaration
public bool KeepChild { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Objects
Gets a collection of report objects belongs to this band.
Declaration
public ReportComponentCollection Objects { get; }
Property Value
Type | Description |
---|---|
ReportComponentCollection |
OutlineExpression
Gets or sets an outline expression.
Declaration
public string OutlineExpression { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Outline is a tree control displayed in the preview window. It represents the prepared report structure. Each outline node can be clicked to navigate to the item in the prepared report.
To create the outline, set this property to any valid expression that represents the outline node text. This expression will be calculated when band is about to print, and its value will be added to the outline. Thus, nodes' hierarchy in the outline is similar to the bands' hierarchy in a report. That means there will be the main and subordinate outline nodes, corresponding to the main and subordinate bands in a report (a report with two levels of data or with groups can exemplify the point).
PrintOnBottom
Gets or sets a value indicating that the band should be printed on the page bottom.
Declaration
public bool PrintOnBottom { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
RepeatBandNTimes
Gets or sets a value that determines the number of repetitions of the same band.
Declaration
public int RepeatBandNTimes { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Repeated
Gets a value indicating that band is reprinted on a new page.
Declaration
public bool Repeated { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This property is applicable to the DataHeaderBand and GroupHeaderBand only. It returns true if its RepeatOnAllPages property is true and band is reprinted on a new page.
RowNo
Gets a row number (the same value returned by the "Row#" system variable).
Declaration
public int RowNo { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
This property can be used when running a report. It may be useful to print hierarchical row numbers in a master-detail report, like this:
1.1
1.2
2.1
2.2
To do this, put the Text object on a detail data band with the following text in it:
[Data1.RowNo].[Data2.RowNo]
StartNewPage
Gets or sets a value indicating that the band should be printed from a new page.
Declaration
public bool StartNewPage { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
New page is not generated when printing very first group or data row. This is made to avoid empty first page.
Methods
AddChild(Base)
Adds a child object to this object's childs.
Declaration
public virtual void AddChild(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Object to add. |
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
Break(BreakableComponent)
Breaks the contents of the object.
Declaration
public override bool Break(BreakableComponent breakTo)
Parameters
Type | Name | Description |
---|---|---|
BreakableComponent | breakTo | Object to put the part of content to that does not fit in this object. These two objects must have the same type. |
Returns
Type | Description |
---|---|
System.Boolean | true if there is enough space in this object to display at least one text line. |
Overrides
Remarks
Do not call this method directly, it is used by the report engine. You should override it if you are writing a new FastReport object.
This method must break the contents of the object. The part of content that fit in current object's bounds should remain in this object, the part that does not fit should be transferred to breakTo object.
CalcHeight()
Calculates the object's height.
Declaration
public override float CalcHeight()
Returns
Type | Description |
---|---|
System.Single | Actual object's height, in pixels. |
Overrides
Remarks
Applicable to objects that contain several text lines, such as TextObject. Returns the height needed to display all the text lines.
CanContain(Base)
Gets a value indicating that this object can contain the specified child object.
Declaration
public virtual 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. |
GetChildObjects(ObjectCollection)
Gets a list of child objects.
Declaration
public virtual void GetChildObjects(ObjectCollection list)
Parameters
Type | Name | Description |
---|---|---|
ObjectCollection | list | List to fill with values. |
GetChildOrder(Base)
Returns z-order of the specified child object.
Declaration
public virtual int GetChildOrder(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Child object. |
Returns
Type | Description |
---|---|
System.Int32 | Z-order of the specified object. |
Remarks
This method must return the index of a specified child object in the internal child list.
GetData()
Gets the data from a datasource that the object is connected to.
Declaration
public override void GetData()
Overrides
Remarks
This method is called by the report engine before processing the object.
Do not call it directly. You may override it if you are developing a new FastReport component. In this method you should get the data from a datasource that the object is connected to.
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.
InitializeComponent()
Initializes the object before running a report.
Declaration
public override void InitializeComponent()
Overrides
Remarks
This method is used by the report engine, do not call it directly.
OnAfterLayout(EventArgs)
This method fires the AfterLayout event and the script code connected to the AfterLayoutEvent.
Declaration
public void OnAfterLayout(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnBeforeLayout(EventArgs)
This method fires the BeforeLayout event and the script code connected to the BeforeLayoutEvent.
Declaration
public void OnBeforeLayout(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
RemoveChild(Base)
Removes a specified object from this object's childs.
Declaration
public virtual void RemoveChild(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child |
RestoreState()
Restores the object's state after printing it.
Declaration
public override void RestoreState()
Overrides
Remarks
This method is called by the report engine after processing the object.
Do not call it directly. You may override it if you are developing a new FastReport component. In this method you should restore the object properties that were saved by the SaveState() method.
SaveState()
Saves the object's state before printing it.
Declaration
public override void SaveState()
Overrides
Remarks
This method is called by the report engine before processing the object.
Do not call it directly. You may override it if you are developing a new FastReport component. In this method you should save any object properties that may be changed during the object printing. The standard implementation saves the object's bounds, visibility, bookmark and hyperlink.
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).
SetChildOrder(Base, Int32)
Sets the z-order of the specified object.
Declaration
public virtual void SetChildOrder(Base child, int order)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Child object. |
System.Int32 | order | New Z-order. |
Remarks
This method must place the specified child object at the specified position in the internal child list.
UpdateLayout(Single, Single)
Updates the children layout when the size of this object is changed by dx, dy values.
Declaration
public virtual void UpdateLayout(float dx, float dy)
Parameters
Type | Name | Description |
---|---|---|
System.Single | dx | X delta. |
System.Single | dy | Y delta. |
Remarks
This method must update positions/sizes of child objects whose Dock or Anchor properties are set to non-default values.
Events
AfterLayout
This event occurs after the child objects layout was finished.
Declaration
public event EventHandler AfterLayout
Event Type
Type | Description |
---|---|
System.EventHandler |
BeforeLayout
This event occurs before the band layouts its child objects.
Declaration
public event EventHandler BeforeLayout
Event Type
Type | Description |
---|---|
System.EventHandler |