## Tabulars

A tabular is a component designed to lay out other components. Unlike a table component, that is used to display a dataset, a tabular is a set of cells that can each display a dataset in a component.

### Inserting a tabular in a report

A tabular can be inserted in the report areas listed in Component placement.

To insert a tabular into a report, use either of the following ways:

- Using dialog
  1. Do one of the following to bring out the Insert Tabular dialog:
     - Click Insert > Tabular on the menu bar.
     - Click the Insert Tabular button on the Insert toolbar.
  2. Specify the number of rows and columns, and the border width and tabular width as required.
  3. Click the OK button to close the dialog.

     If the mouse pointer is in the report body or a cell of another tabular, the tabular will be inserted there upon clicking OK. Otherwise, you need to click the mouse button in the desired location to place the tabular there.

- By dragging and dropping

  From the Toolbox panel, drag Tabular to the desired location in the report which allows the insertion of a tabular, and a tabular will then be created there.

After a tabular has been created in a report, you can then:

- Insert the required components into the tabular cells. The components that can be inserted into a tabular cell are listed in Component placement. If the component inserted is larger than the tabular cell, you can right-click the tabular cell and select Auto Fit from the shortcut menu to make the component fully displayed in the tabular cell.
- Double-click a tabular cell and then input and modify text in it.

You can also customize the tabular appearance and behavior by setting properties in the Report Inspector, which can be saved as a CSS style for future use (for details, see Creating a CSS style).

### Merging and splitting tabular cells

In a tabular, adjacent cells that form a rectangle can be merged into one cell.

- To merge adjacent cells, select them, right-click and select Merge from the shortcut menu (or click the Merge button on the Standard toolbar). These cells will then be merged into one cell.
- To split a cell, follow the steps below:
  1. Right-click the cell and select Split from the shortcut menu.
  2. In the Split Cell dialog, check whether the cell will be split into rows or columns, and then specify how many rows/columns the cell will be split into.
  3. Click OK, and the cell will then be split according to your selection.

### Resizing, inserting and deleting columns/rows in a tabular

- To resize a column/row of a tabular, drag the right/bottom boundary of the column/row until the column/row is the width/height you want. If the boundary is not the rightmost/last one, the column width/row height will change, but the total width/height of the tabular will not change. If you want to change both the column width/row height and the tabular width/height, press the Shift button on the keyboard while dragging.
- To insert a column/row into a tabular, select a cell and right-click it. On the shortcut menu, click the corresponding inserting column/row item and a column/row will then be inserted according to your selection.
- To delete a column/row from a tabular, select all the cells in this column/row, right-click, and then select Delete Column/Delete Row from the shortcut menu.

### Formatting text and paragraphs in a tabular cell

When you enter text into a tabular cell, paragraphs are created. The text and paragraphs in a tabular cell can be easily formatted. For example, you can change the font face, font color of the text, the indentation of any paragraph. You can even find and replace a text string with another one easily as with a word processor. For detail, refer the specific topics in the Text boxes section.

See an example: The SampleComponents catalog, included with JReport Designer, contains reports that have examples of how each component type could be used in a report. For the tabular component example, open `<install_root>\Demo\Reports\SampleComponents\TabularReport.cls`.