Jasper Report Table Component

The Table component in JasperReports is a powerful tool to display tabular data. It is more flexible than simply placing fields in the detail band, especially for sub-datasets.

Creating a Table

To add a table to your report:

  1. Drag the Table element from the Palette into your report band (usually Summary or Detail).
  2. The Table Wizard will open.

Table Wizard Steps

  • Dataset: Create a new dataset or use an existing one. For tables, you usually need a separate dataset if the data source is different from the main report.
  • Connection: Select the data connection for the dataset.
  • Columns: Select fields to display as columns.
  • Layout: Choose headers, footers, and grouping options.

Styling

You can style individual cells, rows, or columns. Jaspersoft Studio provides table styles (alternating row colors, header styles) that can be applied automatically.

Frequently Asked Questions

What is the Table component in JasperReports?

The Table component lets you display data in neat rows and columns inside a Jasper report. It has its own dataset, so it can show a list of records — like orders or employees — with column headers, repeating detail rows, and optional grouping, independent of the main report.

How do I add a Table to a Jasper report?

In Jaspersoft Studio, drag the Table element onto your report, connect it to a dataset (a query or data source), then pick the fields you want as columns. The wizard generates the header and detail rows, which you can then style and resize.

What is the difference between a Table and a Crosstab in JasperReports?

A Table shows records in fixed rows and columns, like a spreadsheet list. A Crosstab summarizes and pivots data — rows and columns are generated dynamically from your values, such as sales by region across months. Use a Table for lists and a Crosstab for summaries.

Can a Jasper Table use a different dataset than the main report?

Yes. Each Table has its own dataset run, so it can pull from a separate query or data source than the rest of the report. This is useful when you want a detail listing that does not match the main report's data.