TdxReport.ReportName Property
Specifies the report name.
Declaration
property ReportName: string read; write;
Property Value
| Type | Description |
|---|---|
| string | The report name. |
Remarks
Use the ReportName property to define a report name for export operations when the Layout property contains a non-empty report template. Report Viewer and Report Designer dialogs also display the ReportName property value in the form caption.
The GetExportResultFileName function returns the full exported file name composed of the ReportName property value and the file name extension that corresponds to the current export format.
End-User Functionality
To save the current report template state during the current session, users can click the hamburger button in the Report Designer dialog and select the Save option. If the TdxReport.ReportName property value is an empty string, the Report Designer dialog prompts a user to specify a report name:

The report is saved in memory. You can access the report using the Layout property.
Code Examples
Save Report Layout Changes to File on Every Change
The following code example saves the current report to a REPX file every time a user saves pending changes in the Report Designer dialog:
uses
dxReport; // Declares the TdxReport class
// ...
procedure TMyForm.dxReport1LayoutChanged(ASender: TdxReport);
begin
ASender.Layout.SaveToFile(ASender.ReportName + '.repx');
end;
Save Report Layout to Database on Every Change
The following code example saves the current report to an existing BLOB dataset field every time a user saves pending changes in the Report Designer dialog:
uses
dxReport, // Declares the TdxReport class
dxmdaset; // Declares the TdxMemData class and related types
// ...
procedure TMyForm.dxReport1LayoutChanged(ASender: TdxReport);
begin
dxMemData1.Edit;
dxMemData1.FieldByName('TemplateName').AsString := ASender.ReportName;
dxMemData1.FieldByName('TemplateLayout').Assign(ASender.Layout);
dxMemData1.Post;
end;
Generate Reports Based on In-Memory Data
The following code example loads an XML-based report template (TdxReport.Layout) from a REPX file, populates the template with test data defined in a connection string, and exports the resulting report as a PNG image:
uses
dxReport, // Declares the TdxReport component and related types
dxReport.ConnectionString.JSON; // Declares the TdxReportInMemoryJSONConnection component
// ...
procedure TMyForm.Button1Click(Sender: TObject);
var
AJSONDataConnection: TdxReportInMemoryJSONConnection;
AReport: TdxReport;
AFileStream: TFileStream;
begin
AJSONDataConnection := TdxReportInMemoryJSONConnection.Create(Self);
try
AJSONDataConnection.Name := 'JSONData';
// Specify in-memory report data as a connection string
AJSONDataConnection.ConnectionString :=
'Json=''[{"id":1, "caption":"test1"},{"id":2, "caption":"test2"}]''';
AReport := TdxReport.Create(Self);
try
AReport.ReportName := 'Report';
AReport.Layout.LoadFromFile('Report.repx'); // Loads a report template
AFileStream := TFileStream.Create('Report.png', fmOpenReadWrite);
try
AReport.ExportToImage(AFileStream); // Exports the report in the default image export format (PNG)
finally
AFileStream.Free;
end;
finally
AReport.Free;
end;
finally
AJSONDataConnection.Free;
end;
end;
Related GitHub-Hosted Example Projects
Default Value
The ReportName property’s default value is an empty string.
The default ReportName property value indicates that the ShowDesigner procedure displays an empty template in the Report Designer dialog, even if the Layout property contains a non-empty template. Any subsequent saved changes made in the Report Designer dialog override both ReportName and Layout property values.