vcl-dxreport-dot-tdxreport.md
Displays the Report Designer dialog.
procedure ShowDesigner;
Call ShowDesigner and ShowViewer procedures to display Web-based Report Designer and Report Viewer dialogs. Global skin and palette settings defined using the Project Settings dialog or a TdxSkinController component affect both TdxReport dialogs.
The Report Designer dialog allows users to design and configure the current report template, including placeholder positions, source dataset fields, appearance settings, etc. All saved changes made in this dialog update the Layout property value and raise the OnLayoutChanged event. For example, you can handle this event to save report template changes to a file.
Note
A ShowDesigner procedure call always displays an empty report template in the Report Designer dialog if the ReportName property is unspecified. Every time you save pending changes in the Report Designer dialog, Layout and ReportName property values are updated automatically.
A ShowDesigner procedure call raises the OnDesignerFormShow event.
Right-click a TdxReport component on a form to display the component’s context menu:
Click the Designer… item to display the Web-based Report Designer dialog at design time. Alternatively, you can double-click a TdxReport component.
Tip
All applied report template changes are saved to a DFM file as a Layout property value.
View Example: Store Report Layouts within Text FilesView Example: Store Report Layouts in a DatabaseView Example: Localize the DevExpress Report Viewer and Report Designer
The following code example uses the TdxBackendDatabaseSQLConnection component to connect to a demo database (devav.sqlite3), displays the Report Designer dialog, and saves all changes made to the UserReport.repx file:
uses
dxReport, // Declares the TdxReport component and related types
dxBackend.ConnectionString.SQL; // Declares the TdxBackendDatabaseSQLConnection component
// ...
procedure TMyForm.Button1Click(Sender: TObject);
var
ADataConnection: TdxBackendDatabaseSQLConnection;
AReport: TdxReport;
begin
ADataConnection := TdxBackendDatabaseSQLConnection.Create(Self); // Creates a database connection
try
ADataConnection.Name := 'SQLite Database Connection';
// Specify a connection string required to connect to a demo database (devav.sqlite3)
ADataConnection.ConnectionString := 'XpoProvider=SQLite;' + // Specifies the database engine type
'Data Source=C:\Users\Public\Documents\DevExpress VCL Demos\MegaDemos\' +
'Product Demos\ExpressReports\Data\devav.sqlite3';
AReport := TdxReport.Create(Self); // Creates a TdxReport component
try
AReport.ShowDesigner; // Displays the Report Designer dialog
AReport.Layout.SaveToFile('UserReport.repx'); // Saves the report template state to a file
finally
AReport.Free; // Releases the created TdxReport component
end;
finally
ADataConnection.Free; // Releases the database connection component
end;
end;
#include "dxReport.hpp" // Declares the TdxReport component and related types
#include "dxBackend.ConnectionString.SQL.hpp" // Declares the TdxBackendDatabaseSQLConnection component
// Add the following linker directives to the corresponding CPP source file:
#pragma link "dxReport" // Required to use dxReport.hpp declarations
#if defined(_WIN64) // Required to use dxBackend.ConnectionString.SQL.hpp declarations
#pragma link "dxBackend.ConnectionString.SQL.o"
#else
#pragma link "dxBackend.ConnectionString.SQL.obj"
// ...
void __fastcall TMyForm::Button1Click(TObject *Sender)
{
TdxBackendDatabaseSQLConnection *ADataConnection;
TdxReport *AReport;
ADataConnection = new TdxBackendDatabaseSQLConnection(this); // Creates a database connection
try
{
ADataConnection->Name = "SQLite Database Connection";
// Specify a connection string required to connect to a demo database (devav.sqlite3)
ADataConnection->ConnectionString = "XpoProvider=SQLite;" // Specifies the database engine type
"Data Source=C:\\Users\\Public\\Documents\\DevExpress VCL Demos\\MegaDemos\\"
"Product Demos\\ExpressReports\\Data\\devav.sqlite3";
AReport = new TdxReport(this); // Creates a TdxReport component
try
{
AReport->ShowDesigner(); // Displays the Report Designer dialog
AReport->Layout->SaveToFile("UserReport.repx"); // Saves the report template state to a file
}
__finally
{
delete AReport; // Releases the created TdxReport component
}
}
__finally
{
delete ADataConnection; // Releases the database connection component
}
}
See Also
Report Viewer and Designer UI Localization