• Jim Beers

Adding DevExpress Reports to Existing Applications

Step 1: Create a new Report Class

To add a DevExpress report to an existing application, begin by opening your project solution in Visual Studio.

With the project selected in the solution explorer, right-click the project node>select Add DevExpress Item>Report Wizard>Give the report a name and click OK.

This launches the DevExpress Report Wizard Dialogue. If you are creating a new report, select data-bound report. For simplicity's sake, we'll show you how to load an already created report definition into the Visual Studio report designer.

In this scenario, you'll want to choose add an empty report to the project (select Empty Report>Finish).

This creates a DevExpress report class. When a report is created using the DevExpress XtraReports suite in Visual Studio, there are 3 files generated in relation to the XtraReport class:

  1. The main class declaration—where user-defined code should be placed

  2. A file to store class-related, designer-generated code

  3. An RESX file—used to store report resources such as queries or connection strings

It is essential to understand the interactions between these sources when creating a reporting application, but when using the report designer to create a report, most code is automatically generated for you.

Step 2: Load a Previously Created Report to the new Report Class

With the report designer open, toggle the report's smart-tag in the upper left-hand corner. Select Open/Import and navigate to wherever you store your report documents. Select the report to load and click Open.

Step 3: Modify Report Data Source through the Designer

If the data source wasn't serialized in the report definition, you can modify the report's data source by clicking on the report's smart tag, and selecting the Data source drop down menu. From here you can assign an existing data source to the report, or add a new report data source via the Data Source Wizard.

332 views0 comments