---
title: "Building Reports in Java"
---

To build a report from a template, you can use one of the `ReportingEngine.buildReport` overloads. The following table describes parameters of these overloads.

| Parameter | Description |
| :- | :- |
| `document` | A template document. At runtime, this document instance is populated with a data from the specified source and becomes a ready report. |
| `dataSource` | An object providing a data to populate the specified template. The object must be of one of the following types:- A traditional Mail Merge data source (see "Working with Traditional Mail Merge Data Sources" for more information)- An object of a custom visible type (see "Working with Types" for more information)- An `XmlDataSource` instance (see "Accessing XML Data" for more information)- A `JsonDataSource` instance (see "Accessing JSON Data" for more information)- A `CsvDataSource` instance (see "Accessing CSV Data" for more information) |
| `dataSourceName` | The identifier of the specified data source object within the specified template. You can omit this identifier, if the template uses the contextual object member access (see "Using Contextual Object Member Access" for more information) when dealing with the data source. |

Given a template to be populated with a data from a `DataSet` instance that is identified as "ds" within the template, you can use the following code to build the corresponding report.

```java
Document doc = ...    // Loading a template document.
DataSet dataSet = ... // Setting up a data set.
ReportingEngine engine = new ReportingEngine();
engine.buildReport(doc, dataSet, "ds");
```

Given a visible `Person` class defined in your application and a template to be populated with a data about a single `Person` instance using the contextual object member access, you can use the following code to build the corresponding report.

```java
Document doc = ...    // Loading a template document.
Person person = ...   // Setting up a person data.
ReportingEngine engine = new ReportingEngine();
engine.buildReport(doc, person);
```
