TableGrid Fundamentals

Overview

The TableGrid component is used to print a table in a report. A table consists of rows and columns that define a grid of cells. Cells may contain objects such as Label, DBText, Memo, Image etc. Simply drag-and-drop the object to the Cell. The Cell by default manages the child object’s boundary based on the Cell’s Padding and the child object’s Anchors.

Use the RowCount and ColCount properties to specify the number of rows and cols.

Use the Row.RowType property to specify header, detail, footer rows.

Cell ColSpan and RowSpan can be used to define cells that span multiple cols and/or rows.

Use the MasterGrid property to link grids, so that when the master grid changes position or column widths, the linked grids automatically stay in sync.

Simple Data Grid

To generate a data grid, place a TableGrid in a Report or SubReport DetailBand. Add data-aware objects, such DBText, DBMemo, DBImage to each Cell.

Download example Simple Data Grid

Design Actions

From the report designer, the following mouse actions are available:

  • Select Grid – click inside edge of left, top corner
  • Resize Grid – drag right-bottom sizing handle
  • Resize Grid Width – width drag right-middle sizing handle
  • Resize Grid Height – height drag bottom-middle sizing handle
  • Select Cell –  click inside a cell
  • Multi-select – shift-click each cell
  • Select Row – click left inside edge of row
  • Select Col –  click top inside edge of column
  • Resize Col – drag the column border
  • Resize Row – drag the row border

The report tree can also be used to select grid, row, and cell objects

The grid context menu can be accessed by pressing right mouse button over any cell. The Row and Col items have subitems for Select, Add, Insert, and Delete. The Cell menu item has subitems for Merge and Divide.

Code Access

To access/modify a grid via code, the following properties and methods are available: