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

    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

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

    Methods

    Assign(Base)

    Declaration
    public override void Assign(Base source)
    Parameters
    Type Name Description
    Base source
    Overrides
    TableBase.Assign(Base)

    GetCustomScript()

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

    GetData()

    Declaration
    public override void GetData()
    Overrides
    ReportComponentBase.GetData()

    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)

    Declaration
    public override void OnAfterData(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e
    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()

    Declaration
    public override void RestoreState()
    Overrides
    TableBase.RestoreState()

    SaveState()

    Declaration
    public override void SaveState()
    Overrides
    TableBase.SaveState()

    Serialize(FRWriter)

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

    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.