Search Results for

    Show / Hide Table of Contents

    Class TableObject

    Represents a table object that consists of several rows and columns.

    Inheritance
    System.Object
    Base
    ComponentBase
    ReportComponentBase
    BreakableComponent
    TableBase
    TableObject
    Implements
    IFRSerializable
    IParent
    Inherited Members
    TableBase.Rows
    TableBase.Columns
    TableBase.FixedRows
    TableBase.FixedColumns
    TableBase.PrintOnParent
    TableBase.RepeatHeaders
    TableBase.RepeatRowHeaders
    TableBase.RepeatColumnHeaders
    TableBase.Layout
    TableBase.WrappedGap
    TableBase.AdjustSpannedCellsWidth
    TableBase.Item[Int32, Int32]
    TableBase.ResultTable
    TableBase.Draw(FRPaintEventArgs)
    TableBase.IsVisible(FRPaintEventArgs)
    TableBase.GetCellData(Int32, Int32)
    TableBase.IsInsideSpan(TableCell)
    TableBase.CreateUniqueNames()
    TableBase.CanContain(Base)
    TableBase.GetChildObjects(ObjectCollection)
    TableBase.AddChild(Base)
    TableBase.RemoveChild(Base)
    TableBase.GetChildOrder(Base)
    TableBase.SetChildOrder(Base, Int32)
    TableBase.UpdateLayout(Single, Single)
    TableBase.CalcWidth()
    TableBase.CalcHeight()
    TableBase.Break(BreakableComponent)
    TableBase.Sum(TableCell)
    TableBase.Min(TableCell)
    TableBase.Max(TableCell)
    TableBase.Avg(TableCell)
    TableBase.Count(TableCell)
    BreakableComponent.CanBreak
    BreakableComponent.BreakTo
    ReportComponentBase.BeforePrint
    ReportComponentBase.AfterPrint
    ReportComponentBase.AfterData
    ReportComponentBase.Click
    ReportComponentBase.Exportable
    ReportComponentBase.ExportableExpression
    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.IsCompilationNeeded
    ReportComponentBase.Cursor
    ReportComponentBase.MouseMoveEvent
    ReportComponentBase.MouseUpEvent
    ReportComponentBase.MouseDownEvent
    ReportComponentBase.MouseEnterEvent
    ReportComponentBase.MouseLeaveEvent
    ReportComponentBase.ApplyStyle(Style)
    ReportComponentBase.SaveStyle()
    ReportComponentBase.RestoreStyle()
    ReportComponentBase.DrawBackground(FRPaintEventArgs)
    ReportComponentBase.Validate()
    ReportComponentBase.Deserialize(FRReader)
    ReportComponentBase.OnClick(EventArgs)
    ReportComponentBase.OnAfterLoad()
    ReportComponentBase.HasClickListeners()
    ReportComponentBase.ResetData()
    ReportComponentBase.InitializeComponent()
    ReportComponentBase.FinalizeComponent()
    ReportComponentBase.GetExpressions()
    ReportComponentBase.OnBeforePrint(EventArgs)
    ReportComponentBase.OnAfterPrint(EventArgs)
    ComponentBase.AbsBottom
    ComponentBase.AbsBounds
    ComponentBase.AbsLeft
    ComponentBase.AbsRight
    ComponentBase.AbsTop
    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.VisibleExpression
    ComponentBase.Printable
    ComponentBase.PrintableExpression
    ComponentBase.Width
    ComponentBase.CalcVisibleExpression(String)
    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.Disposed
    Base.SetProp(Base, Base)
    Base.FloatDiff(Single, Single)
    Base.DeserializeSubItems(FRReader)
    Base.ExtractDefaultMacros(String)
    Base.Dispose(Boolean)
    Base.Dispose()
    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.ExtractMacros()
    Base.IsHaveToConvert(Object)
    Base.GetConvertedObjects()
    Base.ForEachAllConvectedObjects(Object)
    Namespace: FastReport.Table
    Assembly: FastReport.Base.dll
    Syntax
    public class TableObject : TableBase, IDisposable, IFRSerializable, IParent
    Remarks

    To add/remove columns, use the Columns collection. To add/remove rows, use the Rows collection. To initialize a table with specified number of columns and rows, use ColumnCount and RowCount properties.

    To print a table in code, use the ManualBuild event. In the manual build mode, you can use aggregate functions. The following functions available:

    Aggregate functionDescription
    Sum(cell)Calculates the sum of values in specified table cell.
    Min(cell)Calculates the minimum of values in specified table cell.
    Max(cell)Calculates the maximum of values in specified table cell.
    Avg(cell)Calculates the average of values in specified table cell.
    Count(cell)Calculates the number of repeats of a specified table cell.

    To print aggregate value, place the aggregate function call in the table cell: [Count(Cell2)].

    Constructors

    TableObject()

    Initializes a new instance of the TableObject class.

    Declaration
    public TableObject()

    Properties

    ColumnCount

    Gets or sets a number of columns in the table.

    Declaration
    public override int ColumnCount { get; set; }
    Property Value
    Type Description
    System.Int32
    Overrides
    TableBase.ColumnCount

    ManualBuildAutoSpans

    Determines whether to manage cell spans automatically during manual build.

    Declaration
    public bool ManualBuildAutoSpans { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    The default value for this property is true. If you set it to false, you need to manage spans in your ManualBuild event handler.

    ManualBuildEvent

    Gets or sets a script method name that will be used to handle the ManualBuild event.

    Declaration
    public string ManualBuildEvent { get; set; }
    Property Value
    Type Description
    System.String
    Remarks

    If you use this event, you must handle the table print process manually. See the ManualBuild event for details.

    RowCount

    Gets or sets a number of rows in the table.

    Declaration
    public override int RowCount { get; set; }
    Property Value
    Type Description
    System.Int32
    Overrides
    TableBase.RowCount

    Methods

    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
    TableBase.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 method.

    See Also
    AssignAll(Base)

    GetCustomScript()

    Returns a custom code that will be added to the report script before report is run.

    Declaration
    public override string GetCustomScript()
    Returns
    Type Description
    System.String

    A custom script text, if any. Otherwise returns null.

    Overrides
    Base.GetCustomScript()
    Remarks

    This method may return any valid code that may be inserted into the report script. Currently it is used in the TableObject to define the following script methods: Sum, Min, Max, Avg, Count.

    Note: you must take into account the current script language - C# or VB.Net. You may check it via Report.ScriptLanguage property.

    GetData()

    Gets the data from a datasource that the object is connected to.

    Declaration
    public override void GetData()
    Overrides
    ReportComponentBase.GetData()
    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.

    GetDataAsync(CancellationToken)

    Declaration
    public override async Task GetDataAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    ReportComponentBase.GetDataAsync(CancellationToken)

    OnAfterData(EventArgs)

    This method fires the AfterData event and the script code connected to the AfterDataEvent.

    Declaration
    public override void OnAfterData(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    Event data.

    Overrides
    ReportComponentBase.OnAfterData(EventArgs)

    OnManualBuild(EventArgs)

    This method fires the ManualBuild event and the script code connected to the ManualBuildEvent.

    Declaration
    public void OnManualBuild(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    Event data.

    PageBreak()

    Adds a page before rows or columns.

    Declaration
    public void PageBreak()
    Remarks

    Call this method to insert a page break before the next row or column that you intend to print using PrintRow(s) or PrintColumn(s) methods. See the ManualBuild event for more details.

    PrintColumn(Int32)

    Prints a column with specified index.

    Declaration
    public void PrintColumn(int index)
    Parameters
    Type Name Description
    System.Int32 index

    Index of a column to print.

    Remarks

    See the ManualBuild event for more details.

    PrintColumns()

    Prints all columns.

    Declaration
    public void PrintColumns()
    Remarks

    See the ManualBuild event for more details.

    PrintColumns(Int32[])

    Prints columns with specified indices.

    Declaration
    public void PrintColumns(int[] indices)
    Parameters
    Type Name Description
    System.Int32[] indices

    Indices of columns to print.

    Remarks

    See the ManualBuild event for more details.

    PrintRow(Int32)

    Prints a row with specified index.

    Declaration
    public void PrintRow(int index)
    Parameters
    Type Name Description
    System.Int32 index

    Index of a row to print.

    Remarks

    See the ManualBuild event for more details.

    PrintRows()

    Prints all rows.

    Declaration
    public void PrintRows()
    Remarks

    See the ManualBuild event for more details.

    PrintRows(Int32[])

    Prints rows with specified indices.

    Declaration
    public void PrintRows(int[] indices)
    Parameters
    Type Name Description
    System.Int32[] indices

    Indices of rows to print.

    Remarks

    See the ManualBuild event for more details.

    RestoreState()

    Restores the object's state after printing it.

    Declaration
    public override void RestoreState()
    Overrides
    TableBase.RestoreState()
    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
    TableBase.SaveState()
    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
    TableBase.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 methods;
    • saving the object to the designer's clipboard;
    • saving the object to the preview (when run a report).

    Events

    ManualBuild

    Allows to print table rows/columns dynamically.

    Declaration
    public event EventHandler ManualBuild
    Event Type
    Type Description
    System.EventHandler
    Remarks

    This event is used to handle the table print process in a code. Using special methods like PrintRow(Int32), PrintColumn(Int32) you can print specified rows/columns.

    First way is to repeat specified row(s) to get a table that will grow downwards. To do this, you have to call the PrintRow method followed by the PrintColumns method.

    Another way is to repeat the specified column(s) to get a table that grows sidewards. To do this, call the PrintColumn method followed by the PrintRows method.

    Finally, the third way is to repeat rows and columns. The table will grow downwards and sidewards. To do this, call the PrintRow method followed by the PrintColumn method (or vice versa).

    caution

    When you print a table row-by-row, you must call one of the PrintColumn, PrintColumns methods right after the PrintRow method. In the same manner, when you print a table column-by-column, call one of the PrintRow, PrintRows methods right after the PrintColumn method. If you ignore this rule you will get an exception.

    Examples

    In this example, we will consider all three ways to print a table which has 3 rows and 3 columns.

    Case 1: print a table downwards.

    // print table header (the first row)
    Table1.PrintRow(0);
    Table1.PrintColumns();
    // print table body (the second row)
    for (int i = 0; i < 10; i++)
    {
      Table1.PrintRow(1);
      Table1.PrintColumns();
    }
    // print table footer (the third row)
    Table1.PrintRow(2);
    Table1.PrintColumns();

    Case 2: print a table sidewards.

    // print table header (the first column)
    Table1.PrintColumn(0);
    Table1.PrintRows();
    // print table body (the second column)
    for (int i = 0; i < 10; i++)
    {
      Table1.PrintColumn(1);
      Table1.PrintRows();
    }
    // print table footer (the third column)
    Table1.PrintColumn(2);
    Table1.PrintRows();

    Case 3: print a table downwards and sidewards.

    // print the first row with all its columns
    Table1.PrintRow(0);
    // print header column
    Table1.PrintColumn(0);
    // print 10 data columns
    for (int i = 0; i < 10; i++)
    {
      Table1.PrintColumn(1);
    }
    // print footer column
    Table1.PrintColumn(2);
    
    // print table body (the second row)
    for (int i = 0; i < 10; i++)
    {
      // print data row with all its columns
      Table1.PrintRow(1);
      Table1.PrintColumn(0);
      for (int j = 0; j < 10; j++)
      {
        Table1.PrintColumn(1);
      }
      Table1.PrintColumn(2);
    }
    
    // print table footer (the third row)
    Table1.PrintRow(2);
    // again print all columns in the table footer
    Table1.PrintColumn(0);
    for (int i = 0; i < 10; i++)
    {
      Table1.PrintColumn(1);
    }
    Table1.PrintColumn(2);

    Implements

    IFRSerializable
    IParent
    Back to top © 1998-2025 Copyright Fast Reports Inc.