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.
Code Examples
Related GitHub-Hosted Example Projects
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;
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.