Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

The example uses a DevExpress memory-based dataset for report layout storage: [TdxMemData].
You can modify the application to use any other [TDataSet] descendant instead.
To review our data module implementation, see the following file: [uData.pas]/[uData.cpp].

Check warning on line 36 in README.md

View workflow job for this annotation

GitHub Actions / vale

[vale] README.md#L36

[Microsoft.We] Only use we/us when you refer to our organization.
Raw output
{"message": "[Microsoft.We] Only use we/us when you refer to our organization.", "location": {"path": "README.md", "range": {"start": {"line": 36, "column": 11}}}, "severity": "WARNING"}

The instructions assume that you start with a Delphi or C++Builder project that already includes
a configured data source for DevExpress Reports.
Expand Down Expand Up @@ -82,7 +82,10 @@
To load a layout definition to the [TdxReport] component, you must specify
report name ([TdxReport.ReportName]) and layout ([TdxReport.Layout]):

```pas
<!-- start-code-block -->
#### Delphi

```delphi
procedure TMainForm.LoadReportNameAndLayout();
begin
// Ensure that the dataset has at least one record or a new record is being created:
Expand All @@ -96,6 +99,7 @@
dxReport1.Layout.Assign(DataModule1.mdLayoutsLayout);
end;
```
<!-- end-code-block -->

To load a different report, assign a new report name and layout.
The assigned report replaces the current layout definition.
Expand All @@ -106,7 +110,10 @@
Once you assigned a name and layout to the [TdxReport] component,
you can display [Report Designer][dx-report-designer] and [Report Viewer][dx-report-viewer] dialogs:

```pas
<!-- start-code-block -->
#### Delphi

```delphi
procedure TMainForm.btnDesignClick(Sender: TObject);
begin
LoadReportFromLayout; // Loads a report layout definition from the database
Expand All @@ -119,6 +126,8 @@
dxReport1.ShowViewer; // Displays the Report Viewer
end;
```
<!-- end-code-block -->



### Step 4: Store Report Layouts in a Dataset
Expand All @@ -127,7 +136,10 @@
the value of [TdxReport.Layout] changes and an [OnLayoutChanged] event is called.
Handle this event to save layout changes to the active dataset record.

```pas
<!-- start-code-block -->
#### Delphi

```delphi
procedure TMainForm.dxReport1LayoutChanged(ASender: TdxReport);
begin
// Start editing the active dataset record:
Expand All @@ -141,6 +153,8 @@
DataModule1.mdLayouts.Post;
end;
```
<!-- end-code-block -->



### Step 5: Persist Data between Application Sessions
Expand All @@ -150,7 +164,10 @@
To save the dataset to a file and restore data on app restart,
handle `OnCreate` and `OnDestroy` events of the data module:

```pas
<!-- start-code-block -->
#### Delphi

```delphi
const
DataFileName = 'data.dat';

Expand All @@ -166,6 +183,8 @@
mdLayouts.SaveToBinaryFile(DataFileName)
end;
```
<!-- end-code-block -->



## Files to Review
Expand Down
Loading