TdxReport Class
An AI-powered Report Generator component.
Declaration
TdxReport = class(
TcxCustomComponent
)
Remarks
TdxReport is a non-visual component designed to generate customizable reports based on templates populated with placeholder fields. The report generator implementation is based on the DevExpress Javascript Report Designer and Viewer adapted for use in native VCL apps (using modern web-based design capabilities based on WebView and ASP.NET Core).
All required .NET and JS dependencies are embedded into one self-contained EXE file transparently.

Note
The ExpressReports suite is available as a Community Technology Preview (CTP). Please review our pre-release software notes if you plan on using ExpressReports.
Bind to Data
TdxReport can populate placeholder fields in a template from different data sources stored in memory or a database. The TdxReportDataConnectionManager component allows you to manage data connection components designed to work with different data sources.
Tip
You can create data connection components directly in code, without TdxReportDataConnectionManager.
Refer to data connection class descriptions for detailed information and code examples.
Data Connection Components
- TdxReportInMemoryJSONConnection
- A component designed for interaction with data stored in memory.
- TdxReportDataSetJSONConnection
- A component designed to work with data in one or multiple datasets (TDataSet descendants).
- TdxReportDatabaseSQLConnection
A component designed to fetch data from an SQL database (SQL Server, PostgreSQL, SQLite, etc.).
Tip
This component relies on our ASP.NET Core Reporting engine based on the XPO ORM (powered by ADO.NET). Refer to the following topic for connection string examples: Specify a Connection String.
Main API Members
The list below outlines key members of the TdxReport class. These members allow you to configure templates, generate reports, and export report content in different target formats.
Report Content and Layout
- FilterString
- Specifies filter criteria for report data.
- Language
- Allows you to switch between available UI and report template localizations. Refer to the following topic for information on localization techniques: VCL Reports Localization.
- Layout
- Provides access to the report REPX template (as individual XML strings).
- OnLayoutChanged
- Allows you to respond to any report layout changes.
- ReportName
- Specifies the report name.
End-User Interaction
- ExportFormats
- Specifies export formats available to users in the Report Preview dialog.
- OnBrowserFileDownload
- Allows you to execute custom code in response to preview file download operations or to prevent users from downloading previews.
- OnPrintPreview
- Allows you to respond to print preview operations and obtain preview content as a PDF document.
- ShowDesigner | ShowViewer
- Display Web-based Report Designer and Report Preview dialogs. Global skin and palette settings (defined using the Project Settings dialog or a TdxSkinController component) affect these dialogs.
Synchronous Data Export
- ExportTimeout
- Specifies a timeout interval (in milliseconds) for all synchronous export operations.
- ExportTo
- Exports the current report to a stream in any supported format.
- ExportToCSV | ExportToDOCX | ExportToHTML | ExportToMHT | ExportToPDF | ExportToRTF | ExportToRTF | ExportToText | ExportToXLS | ExportToXLSX
- Export the current report to a stream in corresponding formats.
- ExportToImage
Exports the current report to a stream as an image (PNG is the default image export format).
Tip
The current image format is defined in Export Options available in the Web-based Report Preview dialog.
Asynchronous Data Export
- CancelPendingExport
- Cancels the pending asynchronous export operation.
- StartExportAsync | OnExported
- Allow you to export the current report to a stream asynchronously.
Code Examples
Related GitHub-Hosted Example Projects
Connect to an SQL Database and Edit Report Templates
The following code example uses the TdxReportDatabaseSQLConnection component to connect to a demo database (nwind.mdb), displays the Report Designer dialog, and saves all changes made to the UserReport.repx file:
uses
dxReport, // Declares the TdxReport component and related types
dxReport.ConnectionString.SQL; // Declares the TdxReportDatabaseSQLConnection component
// ...
procedure TMyForm.Button1Click(Sender: TObject);
var
ADataConnection: TdxReportDatabaseSQLConnection;
AReport: TdxReport;
begin
ADataConnection := TdxReportDatabaseSQLConnection.Create(Self);
try
ADataConnection.Name := 'DataConnection';
// Specify a connection string required to connect to a demo database (nwind.mdb)
ADataConnection.ConnectionString := 'XpoProvider=MSAccess;Provider=Microsoft.ACE.OLEDB.12.0;' +
'Data Source=C:\Users\Public\Documents\DevExpress VCL Demos\' +
'MegaDemos\Product Demos\ExpressPivotGrid\Data\nwind.mdb';
AReport := TdxReport.Create(Self);
try
AReport.ShowDesigner; // Displays the Web-based Report Designer dialog
AReport.Layout.SaveToFile('UserReport.repx'); // Saves the report template state to a file
finally
AReport.Free;
end;
finally
ADataConnection.Free;
end;
end;
Related Compiled Demo
To see the TdxReport component in action, run the Report Designer/Viewer demo in the VCL Demo Center installed with compiled VCL DevExpress demos. Click different items in the sidebar on the left to switch between demo features.
Tip
You can find full source code for the installed compiled Report demo in the following folder:
%PUBLIC%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressReports