Class TableBase
The base class for table-type controls such as TableObject and MatrixObject.
Inheritance
Inherited Members
Namespace: FastReport.Table
Assembly: FastReport.OpenSource.dll
Syntax
public class TableBase : BreakableComponent, IFRSerializable, IParent
Constructors
TableBase()
Initializes a new instance of the TableBase class.
Declaration
public TableBase()
Properties
AdjustSpannedCellsWidth
Gets or sets a value that determines whether to adjust the spanned cell's width when breaking the table across pages.
Declaration
public bool AdjustSpannedCellsWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
If set to true, the spanned cell's width will be adjusted to accomodate all contained text.
ColumnCount
Gets or sets a number of columns in the table.
Declaration
public virtual int ColumnCount { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Columns
Gets a collection of table columns.
Declaration
public TableColumnCollection Columns { get; }
Property Value
| Type | Description |
|---|---|
| TableColumnCollection |
FixedColumns
Gets or sets the number of fixed columns that will be repeated on each page.
Declaration
public int FixedColumns { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
FixedRows
Gets or sets the number of fixed rows that will be repeated on each page.
Declaration
public int FixedRows { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Item[Int32, Int32]
Gets or sets the table cell.
Declaration
public TableCell this[int col, int row] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | col | Column index. |
| System.Int32 | row | Row index. |
Property Value
| Type | Description |
|---|---|
| TableCell | The TableCell object that represents a cell. |
Layout
Gets or sets the table layout.
Declaration
public TableLayout Layout { get; set; }
Property Value
| Type | Description |
|---|---|
| TableLayout |
Remarks
This property affects printing the big table that breaks across pages.
RepeatColumnHeaders
Gets or sets a value that determines whether is necessary to repeat table Column header on each page.
Declaration
public virtual bool RepeatColumnHeaders { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
To define a table Column header, set the FixedColumns properties.
RepeatHeaders
Gets or sets a value that determines whether is necessary to repeat table header on each page.
Declaration
public bool RepeatHeaders { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
To define a table header, set the FixedRows and FixedColumns properties.
RepeatRowHeaders
Gets or sets a value that determines whether is necessary to repeat table Row header on each page.
Declaration
public virtual bool RepeatRowHeaders { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
To define a table Row header, set the FixedRows properties.
ResultTable
Gets a table which contains the result of rendering dynamic table.
Declaration
public TableResult ResultTable { get; }
Property Value
| Type | Description |
|---|---|
| TableResult |
Remarks
Use this property to access the result of rendering your table in dynamic mode. It may be useful if you want to center or right-align the result table on a page. In this case, you need to add the following code at the end of your ManualBuild event handler:
// right-align the table
Table1.ResultTable.Left = Engine.PageWidth - Table1.ResultTable.CalcWidth() - 1;
RowCount
Gets or sets a number of rows in the table.
Declaration
public virtual int RowCount { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Rows
Gets a collection of table rows.
Declaration
public TableRowCollection Rows { get; }
Property Value
| Type | Description |
|---|---|
| TableRowCollection |
WrappedGap
Gets or sets gap between parts of the table in wrapped layout mode.
Declaration
public float WrappedGap { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
This property is used if you set the Layout property to Wrapped.
Methods
AddChild(Base)
Adds a child object to this object's childs.
Declaration
public 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
Avg(TableCell)
Calculates an average of values in a specified cell.
Declaration
public object Avg(TableCell aggregateCell)
Parameters
| Type | Name | Description |
|---|---|---|
| TableCell | aggregateCell | The cell. |
Returns
| Type | Description |
|---|---|
| System.Object | The object that contains calculated value. |
Remarks
This method can be called from the ManualBuild event handler only.
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.
CalcWidth()
Calculates and returns the table width, in pixels.
Declaration
public float CalcWidth()
Returns
| Type | Description |
|---|---|
| System.Single |
CanContain(Base)
Gets a value indicating that this object can contain the specified child object.
Declaration
public 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. |
Count(TableCell)
Calculates number of repeats of a specified cell.
Declaration
public object Count(TableCell aggregateCell)
Parameters
| Type | Name | Description |
|---|---|---|
| TableCell | aggregateCell | The cell. |
Returns
| Type | Description |
|---|---|
| System.Object | The object that contains calculated value. |
Remarks
This method can be called from the ManualBuild event handler only.
CreateUniqueNames()
Creates unique names for all table elements such as rows, columns, cells.
Declaration
public void CreateUniqueNames()
Draw(FRPaintEventArgs)
Declaration
public override void Draw(FRPaintEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| FRPaintEventArgs | e |
Overrides
GetCellData(Int32, Int32)
Gets data of the table cell with specified column and row numbers.
Declaration
public TableCellData GetCellData(int col, int row)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | col | The column number. |
| System.Int32 | row | The row number. |
Returns
| Type | Description |
|---|---|
| TableCellData | TableCellData instance containing data of the table cell. |
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 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.
IsInsideSpan(TableCell)
Declaration
public bool IsInsideSpan(TableCell cell)
Parameters
| Type | Name | Description |
|---|---|---|
| TableCell | cell |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsVisible(FRPaintEventArgs)
Determines if the object is visible on current drawing surface.
Declaration
public override bool IsVisible(FRPaintEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| FRPaintEventArgs | e | Draw event arguments. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
Max(TableCell)
Calculates a maximum of values in a specified cell.
Declaration
public object Max(TableCell aggregateCell)
Parameters
| Type | Name | Description |
|---|---|---|
| TableCell | aggregateCell | The cell. |
Returns
| Type | Description |
|---|---|
| System.Object | The object that contains calculated value. |
Remarks
This method can be called from the ManualBuild event handler only.
Min(TableCell)
Calculates a minimum of values in a specified cell.
Declaration
public object Min(TableCell aggregateCell)
Parameters
| Type | Name | Description |
|---|---|---|
| TableCell | aggregateCell | The cell. |
Returns
| Type | Description |
|---|---|
| System.Object | The object that contains calculated value. |
Remarks
This method can be called from the ManualBuild event handler only.
RemoveChild(Base)
Removes a specified object from this object's childs.
Declaration
public 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 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.
Sum(TableCell)
Calculates a sum of values in a specified cell.
Declaration
public object Sum(TableCell aggregateCell)
Parameters
| Type | Name | Description |
|---|---|---|
| TableCell | aggregateCell | The cell. |
Returns
| Type | Description |
|---|---|
| System.Object | The object that contains calculated value. |
Remarks
This method can be called from the ManualBuild event handler only.
UpdateLayout(Single, Single)
Updates the children layout when the size of this object is changed by dx, dy values.
Declaration
public 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.