Tabulars
A tabular is a component designed to lay out other components. Unlike a table component which is used to display a dataset, a tabular is a set of cells that can each display a dataset in a component.
Tabulars are not supported in library components and page reports that are created using business views. A web report is initially a tabular with a single cell, and you cannot insert another tabular into a web report.
Below is a list of the sections covered in this topic:
- Inserting a Tabular in a Report
- Inserting Components into a Tabular
- Merging and Splitting Tabular Cells
- Resizing, Inserting, and Deleting Columns/Rows in a Tabular
See an example: The SampleComponents catalog, included with Logi 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
.
Inserting a Tabular in a Report
A tabular can be inserted in the page report areas listed in Component Placement.
To insert a tabular into a page report, use either of the following ways:
- Using dialog
- Position the mouse pointer at the destination where you want to insert the tabular.
- Select Insert > Tabular or Home > Insert > Tabular. The Insert Tabular dialog appears.
- Specify the number of rows and columns, and the border width and tabular width as required.
- Select 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 selecting OK. Otherwise, you need to select the mouse button in the desired location to place the tabular there.
- By dragging and dropping
From the Components panel, drag the Tabular button to the desired location in the report which allows the insertion of a tabular, and a tabular with two rows and columns by default will then be created there.
Inserting Components into a Tabular
The components that can be inserted into a tabular cell are listed in Component Placement. The most common component to place into a tabular cell is a data component. You can insert a table, crosstab or chart and for a page report a banded object in a tabular cell. It is usually best to only place a single data component into a tabular cell. Then at runtime,
- For tabulars in a page report, the cell will expand to whatever length the data component in it grows to. For example placing a crosstab in a cell followed by a chart, the crosstab can grow in length based on the data. As long as they are in separate cells they will not overlap.
- For the web report tabular, scrollbars will be added for the data component if it cannot be fully displayed in a tabular cell.
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 display in the tabular cell.
If you place multiple components into a cell you should change the Position property to static, then the components will flow one after the other and will not overlap which is usually the desired result.
You can also double-click a tabular cell and input text in it as you would do in a text box. 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 details, refer the specific topics in Text Boxes.
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 select Home > Merge. These cells will then be merged into one cell.
- To split a cell:
- Right-click the cell and select Split from the shortcut menu, or select Home > Split.
- 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.
- Select OK, and the cell is then 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, select 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.