diff --git a/Delphi/PDFReportGenerator.dpr b/Delphi/PDFReportGenerator.dpr index 3e8a0ac..2bf1a51 100644 --- a/Delphi/PDFReportGenerator.dpr +++ b/Delphi/PDFReportGenerator.dpr @@ -39,7 +39,6 @@ begin AConnection.ConnectionString := 'XpoProvider=SQLite; Data Source=nwind.db; Mode=ReadOnly'; // Step 3: Define Report Parameter Values - AReport.Parameters.LoadFromLayout; // Set the "OrderIdParameter" value in the report layout AReport.Parameters['OrderIdParameter'].Value := AOrderID; diff --git a/Delphi/PDFReportGenerator.res b/Delphi/PDFReportGenerator.res index cf4b026..08cdae7 100644 Binary files a/Delphi/PDFReportGenerator.res and b/Delphi/PDFReportGenerator.res differ diff --git a/README.md b/README.md index 344164e..930a79c 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,9 @@ You can [import a report layout from a REPX file][file-example] or [load a layou This example imports a report layout from the [Order.repx] file. -**Delphi:** + +#### Delphi + ```delphi AReport := TdxReport.Create(nil); // AReport: TdxReport; try @@ -73,6 +75,7 @@ finally AReport.Free; end; ``` + ### Step 2: Create a Database Connection @@ -80,7 +83,9 @@ end; Create a database connection component to supply data to the report. This example uses a SQLite sample database ([nwind.db]). -**Delphi:** + +#### Delphi + ```delphi // AConnection: TdxBackendDatabaseSQLConnection; AConnection := TdxBackendDatabaseSQLConnection.Create(nil); @@ -94,6 +99,7 @@ finally AConnection.Free; end; ``` + For detailed information on data source management and supported database engines, refer to the following help topic: [VCL Backend: Supported Database Systems][supported-dbms]. @@ -106,22 +112,25 @@ Parameters allow you to modify database queries and generate different reports based on the same report template and underlying data. For example, [Order.repx] includes a single `OrderIDParameter` that filters data by order ID. -To modify parameters, load them using the [TdxReport.Parameters.LoadFromLayout] method -and assign values to [TdxReport.Parameters] list members as follows: +To modify parameters, assign values to [TdxReport.Parameters] list members as follows: + + +#### Delphi -**Delphi:** ```delphi -AReport.Parameters.LoadFromLayout; // Set the "OrderIdParameter" value in the report layout AReport.Parameters['OrderIdParameter'].Value := AOrderID; ``` + ### Step 4: Export Report Content to a File This example exports a report to a PDF file using the [TdxReport.ExportToPDF] method: -**Delphi:** + +#### Delphi + ```delphi AStream := TMemoryStream.Create; // AStream: TMemoryStream; try @@ -133,6 +142,8 @@ finally AStream.Free; end; ``` + + For detailed information on available export formats, refer to the following help topic: [TdxReport.ExportTo]. @@ -144,11 +155,11 @@ using a list of parameters. You need to initialize the report layout and data connection once (steps 1 and 2) and repeat steps 3 and 4 for each parameter. -**Delphi:** + +#### Delphi + ```delphi // ... -AReport.LoadParametersFromReport; - for AOrderID in AOrderIDList: AReport.Parameters['OrderIdParameter'].Value := AOrderID; @@ -163,6 +174,7 @@ for AOrderID in AOrderIDList: end; end; ``` + ## Files to Review @@ -179,34 +191,44 @@ end; ## Documentation -- [Introduction to VCL Reports](https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports) -- [Tutorial: Create a table report using the Report Wizard](https://docs.devexpress.com/VCL/405760/ExpressReports/getting-started/create-table-report-using-report-wizard) -- [Use SQLite as a data source for reports (as demonstrated in the current example)](https://docs.devexpress.com/VCL/405750/ExpressCrossPlatformLibrary/vcl-backend/database-engines/vcl-backend-sqlite-support) +- [Introduction to VCL Reports][reports-intro] +- [Tutorial: Create a table report using the Report Wizard][wizard-tutorial] +- [Use SQLite as a data source for reports (as demonstrated in the current example)][sqlite-data-source] - API reference: - - [TdxReport](https://docs.devexpress.com/VCL/dxReport.TdxReport) - - [TdxReport.ExportToPDF], [TdxReport.ExportTo][TdxReport.ExportTo] - - [TdxReport.Layout](https://docs.devexpress.com/VCL/dxReport.TdxReport.Layout) + - [TdxReport] + - [TdxReport.ExportToPDF], [TdxReport.ExportTo] + - [TdxReport.Layout] - [TdxReport.Parameters] - - [TdxReport.Parameters.LoadFromLayout] - - [TdxBackendDatabaseSQLConnection](https://docs.devexpress.com/VCL/dxBackend.ConnectionString.SQL.TdxBackendDatabaseSQLConnection) - + - [TdxBackendDatabaseSQLConnection] + [designer]: https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports [supported-dbms]: https://docs.devexpress.com/VCL/405703/ExpressCrossPlatformLibrary/vcl-backend/vcl-backend-supported-database-systems +[reports-intro]: https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports +[wizard-tutorial]: https://docs.devexpress.com/VCL/405760/ExpressReports/getting-started/create-table-report-using-wizard-tutorial +[sqlite-data-source]: https://docs.devexpress.com/VCL/405750/ExpressCrossPlatformLibrary/vcl-backend/database-engines/vcl-backend-sqlite-support + + +[TdxReport]: https://docs.devexpress.com/VCL/dxReport.TdxReport +[TdxReport.Layout]: https://docs.devexpress.com/VCL/dxReport.TdxReport.Layout [TdxReport.ExportToPDF]: https://docs.devexpress.com/VCL/dxReport.TdxReport.ExportToPDF(System.Classes.TStream) [TdxReport.ExportTo]: https://docs.devexpress.com/VCL/dxReport.TdxReport.ExportTo%28dxBackend.TdxReportExportFormat-System.Classes.TStream%29#available-export-formats [TdxReport.Parameters]: https://docs.devexpress.com/VCL/dxReport.TdxReport.Parameters -[TdxReport.Parameters.LoadFromLayout]: https://docs.devexpress.com/VCL/dxReport.Parameters.TdxReportParameters.LoadFromLayout +[TdxBackendDatabaseSQLConnection]: https://docs.devexpress.com/VCL/dxBackend.ConnectionString.SQL.TdxBackendDatabaseSQLConnection ## More Examples - [Store Report Layouts in REPX Files][file-example] - [Store Report Layouts in a Database][database-example] +- [Filter data records in a report][filter-data-records] +- [Localize the Report Viewer and Report Designer][localize] - + [file-example]: https://github.com/DevExpress-Examples/vcl-reports-store-layout-template-file [database-example]: https://github.com/DevExpress-Examples/vcl-reports-store-layout-template-database +[filter-data-records]: https://github.com/DevExpress-Examples/vcl-filter-report-preview-based-on-grid-selected-rows +[localize]: https://github.com/DevExpress-Examples/vcl-reports-localize ## Does This Example Address Your Development Requirements/Objectives?