Skip to content

Commit 9799d74

Browse files
committed
readme: Add meta-markup to the code snippet blocks
Experimental markup to improve example import to the DevExpress Support Center.
1 parent aae84ff commit 9799d74

1 file changed

Lines changed: 146 additions & 142 deletions

File tree

README.md

Lines changed: 146 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,146 @@
1-
<!-- default badges list -->
2-
![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/1051124732/25.2.3%2B)
3-
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/T1306454)
4-
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
5-
[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives)
6-
<!-- default badges end -->
7-
8-
# DevExpress&nbsp;VCL&nbsp;Reports&nbsp;– Import&nbsp;and&nbsp;Save Report&nbsp;Layouts to XML&nbsp;Files
9-
10-
This example uses XML-based REPX files as [report layout](https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports) storage.
11-
12-
Run the app and execute the following actions:
13-
14-
- Customize our predefined layout and save it to a new file.
15-
- Create a new report layout and save it to a file.
16-
- Import a report layout you created earlier from a file.
17-
18-
<img width="450" src="./images/app.png" alt="An application with buttons to create a new report, import and save reports, open a report designer and report viewer" />
19-
20-
21-
## Prerequisites
22-
23-
[DevExpress Reports Prerequisites](https://docs.devexpress.com/VCL/405773/ExpressCrossPlatformLibrary/vcl-backend/reports-dashboards-app-deployment#vcl-reportsdashboards-prerequisites)
24-
25-
26-
## Implementation Details
27-
28-
### Import a Report Layout from a File
29-
30-
To import (load) a report layout from a file, call the
31-
[`Layout.LoadFromFile`](https://docwiki.embarcadero.com/Libraries/Athens/en/System.Classes.TStrings.LoadFromFile)
32-
method and assign a name to the
33-
[`ReportName`](https://docs.devexpress.com/VCL/dxReport.TdxReport.ReportName) property:
34-
35-
**Delphi:**
36-
```delphi
37-
procedure TMainForm.ImportReport(const AFileName: string);
38-
begin
39-
// Import a report layout from a file
40-
dxReport1.Layout.LoadFromFile(AFileName);
41-
// Assign the file's name as an internal report name
42-
dxReport1.ReportName := ChangeFileExt(ExtractFileName(AFileName), '');
43-
end;
44-
```
45-
46-
**C++Builder:**
47-
```cpp
48-
void __fastcall TMainForm::ImportReport(const String &FileName)
49-
{
50-
// Import a report layout from a file
51-
dxReport1->Layout->LoadFromFile(FileName);
52-
// Assign the file's name as an internal report name
53-
dxReport1->ReportName = ChangeFileExt(ExtractFileName(FileName), "");
54-
}
55-
```
56-
57-
> [!Note]
58-
> An internal report name may differ from the source REPX file name.
59-
60-
61-
### Save a Report Layout to a File
62-
63-
To save the current report layout to a file, call the
64-
[`Layout.SaveToFile`](https://docwiki.embarcadero.com/Libraries/Athens/en/System.Classes.TStrings.SaveToFile) method:
65-
66-
**Delphi:**
67-
```delphi
68-
procedure TMainForm.SaveReport(const AFileName: string);
69-
begin
70-
// Save the report layout to a file
71-
dxReport1.Layout.SaveToFile(AFileName);
72-
end;
73-
```
74-
75-
**C++Builder:**
76-
```cpp
77-
void __fastcall TMainForm::SaveReport(const String &FileName)
78-
{
79-
// Save the report layout to a file
80-
dxReport1->Layout->SaveToFile(FileName);
81-
}
82-
```
83-
84-
> [!Note]
85-
> Internal report names are not stored in REPX files.
86-
87-
88-
## Test the Example
89-
90-
### Modify the Pre-loaded Layout and Save to a New File
91-
92-
The example application loads a predefined layout at startup: `TableReport.repx`.
93-
You can modify this preloaded report layout and then save changes to a REPX file.
94-
95-
1. Build and run the sample application.
96-
Note the preloaded layout's name in the application's caption.
97-
2. Click **Open Designer** to edit the loaded layout in the DevExpress
98-
[Report Designer](https://docs.devexpress.com/XtraReports/119176/web-reporting/web-end-user-report-designer).
99-
Modify the layout as you see fit.
100-
3. Once you have made changes in the **Report Designer** dialog, click the hamburger button, select **Save**, and close the dialog.
101-
4. Click **Save to File** to save the report layout to a REPX file.
102-
You can overwrite an existing file or create a new file.
103-
5. Restart the application and click **Import from File** to import a report layout from the previously saved REPX file.
104-
6. Click **Open Viewer** to display the imported layout in the DevExpress
105-
[Report Viewer](https://docs.devexpress.com/XtraReports/401850/web-reporting/web-document-viewer).
106-
107-
108-
### Create, Design, and Save a New Layout
109-
110-
You can design a new layout from scratch and then save it to a REPX file:
111-
112-
1. Build and run the sample application.
113-
2. Click **Create New** to open a new blank report layout in the DevExpress
114-
[Report Designer](https://docs.devexpress.com/XtraReports/119176/web-reporting/web-end-user-report-designer).
115-
3. Design the report layout (template) using tools available in the **Report Designer**.
116-
Follow the tutorial: [Create a table report using the Report Wizard](https://docs.devexpress.com/VCL/405760/ExpressReports/getting-started/create-table-report-using-report-wizard).
117-
4. Once you have made all necessary changes in the **Report Designer** dialog, click the hamburger button, select **Save**, and enter a report layout name.
118-
Click **Save** and close the dialog.
119-
5. Click **Save to File** to save the report layout to a REPX file.
120-
6. Restart the application and click **Import from File** to import a report layout from the previously saved REPX file.
121-
7. Click **Open Viewer** to display the imported layout in the DevExpress
122-
[Report Viewer](https://docs.devexpress.com/XtraReports/401850/web-reporting/web-document-viewer).
123-
124-
125-
## Documentation and Examples
126-
127-
- [Introduction to VCL Reports](https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports)
128-
- [Tutorial: Create a table report using the Report Wizard](https://docs.devexpress.com/VCL/405760/ExpressReports/getting-started/create-table-report-using-report-wizard)
129-
- [How to store report layouts in REPX files at design-time](https://docs.devexpress.com/VCL/dxReport.TdxReport.Layout#string-list-editor)
130-
- [How to store report layouts in a database (example application)](https://github.com/DevExpress-Examples/vcl-reports-store-layout-template-database)
131-
- [How to 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)
132-
- [API reference: `TdxReport.Layout` Property](https://docs.devexpress.com/VCL/dxReport.TdxReport.Layout)
133-
- [API reference: `TdxBackendDatabaseSQLConnection` Component](https://docs.devexpress.com/VCL/dxBackend.ConnectionString.SQL.TdxBackendDatabaseSQLConnection)
134-
135-
136-
<!-- feedback -->
137-
## Does This Example Address Your Development Requirements/Objectives?
138-
139-
[<img src="https://www.devexpress.com/support/examples/i/yes-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=vcl-reports-store-layout-template-file&~~~was_helpful=yes) [<img src="https://www.devexpress.com/support/examples/i/no-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=vcl-reports-store-layout-template-file&~~~was_helpful=no)
140-
141-
(you will be redirected to DevExpress.com to submit your response)
142-
<!-- feedback end -->
1+
<!-- default badges list -->
2+
![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/1051124732/25.2.3%2B)
3+
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/T1306454)
4+
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
5+
[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives)
6+
<!-- default badges end -->
7+
8+
# DevExpress&nbsp;VCL&nbsp;Reports&nbsp;– Import&nbsp;and&nbsp;Save Report&nbsp;Layouts to XML&nbsp;Files
9+
10+
This example uses XML-based REPX files as [report layout](https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports) storage.
11+
12+
Run the app and execute the following actions:
13+
14+
- Customize our predefined layout and save it to a new file.
15+
- Create a new report layout and save it to a file.
16+
- Import a report layout you created earlier from a file.
17+
18+
<img width="450" src="./images/app.png" alt="An application with buttons to create a new report, import and save reports, open a report designer and report viewer" />
19+
20+
21+
## Prerequisites
22+
23+
[DevExpress Reports Prerequisites](https://docs.devexpress.com/VCL/405773/ExpressCrossPlatformLibrary/vcl-backend/reports-dashboards-app-deployment#vcl-reportsdashboards-prerequisites)
24+
25+
26+
## Implementation Details
27+
28+
### Import a Report Layout from a File
29+
30+
To import (load) a report layout from a file, call the
31+
[`Layout.LoadFromFile`](https://docwiki.embarcadero.com/Libraries/Athens/en/System.Classes.TStrings.LoadFromFile)
32+
method and assign a name to the
33+
[`ReportName`](https://docs.devexpress.com/VCL/dxReport.TdxReport.ReportName) property:
34+
35+
<!-- start-code-block -->
36+
#### Delphi
37+
```delphi
38+
procedure TMainForm.ImportReport(const AFileName: string);
39+
begin
40+
// Import a report layout from a file
41+
dxReport1.Layout.LoadFromFile(AFileName);
42+
// Assign the file's name as an internal report name
43+
dxReport1.ReportName := ChangeFileExt(ExtractFileName(AFileName), '');
44+
end;
45+
```
46+
47+
#### C++Builder
48+
```cpp
49+
void __fastcall TMainForm::ImportReport(const String &FileName)
50+
{
51+
// Import a report layout from a file
52+
dxReport1->Layout->LoadFromFile(FileName);
53+
// Assign the file's name as an internal report name
54+
dxReport1->ReportName = ChangeFileExt(ExtractFileName(FileName), "");
55+
}
56+
```
57+
<!-- end-code-block -->
58+
59+
> [!Note]
60+
> An internal report name may differ from the source REPX file name.
61+
62+
63+
### Save a Report Layout to a File
64+
65+
To save the current report layout to a file, call the
66+
[`Layout.SaveToFile`](https://docwiki.embarcadero.com/Libraries/Athens/en/System.Classes.TStrings.SaveToFile) method:
67+
68+
<!-- start-code-block -->
69+
#### Delphi
70+
```delphi
71+
procedure TMainForm.SaveReport(const AFileName: string);
72+
begin
73+
// Save the report layout to a file
74+
dxReport1.Layout.SaveToFile(AFileName);
75+
end;
76+
```
77+
78+
#### C++Builder
79+
```cpp
80+
void __fastcall TMainForm::SaveReport(const String &FileName)
81+
{
82+
// Save the report layout to a file
83+
dxReport1->Layout->SaveToFile(FileName);
84+
}
85+
```
86+
<!-- end-code-block -->
87+
88+
> [!Note]
89+
> Internal report names are not stored in REPX files.
90+
91+
92+
## Test the Example
93+
94+
### Modify the Pre-loaded Layout and Save to a New File
95+
96+
The example application loads a predefined layout at startup: `TableReport.repx`.
97+
You can modify this preloaded report layout and then save changes to a REPX file.
98+
99+
1. Build and run the sample application.
100+
Note the preloaded layout's name in the application's caption.
101+
2. Click **Open Designer** to edit the loaded layout in the DevExpress
102+
[Report Designer](https://docs.devexpress.com/XtraReports/119176/web-reporting/web-end-user-report-designer).
103+
Modify the layout as you see fit.
104+
3. Once you have made changes in the **Report Designer** dialog, click the hamburger button, select **Save**, and close the dialog.
105+
4. Click **Save to File** to save the report layout to a REPX file.
106+
You can overwrite an existing file or create a new file.
107+
5. Restart the application and click **Import from File** to import a report layout from the previously saved REPX file.
108+
6. Click **Open Viewer** to display the imported layout in the DevExpress
109+
[Report Viewer](https://docs.devexpress.com/XtraReports/401850/web-reporting/web-document-viewer).
110+
111+
112+
### Create, Design, and Save a New Layout
113+
114+
You can design a new layout from scratch and then save it to a REPX file:
115+
116+
1. Build and run the sample application.
117+
2. Click **Create New** to open a new blank report layout in the DevExpress
118+
[Report Designer](https://docs.devexpress.com/XtraReports/119176/web-reporting/web-end-user-report-designer).
119+
3. Design the report layout (template) using tools available in the **Report Designer**.
120+
Follow the tutorial: [Create a table report using the Report Wizard](https://docs.devexpress.com/VCL/405760/ExpressReports/getting-started/create-table-report-using-report-wizard).
121+
4. Once you have made all necessary changes in the **Report Designer** dialog, click the hamburger button, select **Save**, and enter a report layout name.
122+
Click **Save** and close the dialog.
123+
5. Click **Save to File** to save the report layout to a REPX file.
124+
6. Restart the application and click **Import from File** to import a report layout from the previously saved REPX file.
125+
7. Click **Open Viewer** to display the imported layout in the DevExpress
126+
[Report Viewer](https://docs.devexpress.com/XtraReports/401850/web-reporting/web-document-viewer).
127+
128+
129+
## Documentation and Examples
130+
131+
- [Introduction to VCL Reports](https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports)
132+
- [Tutorial: Create a table report using the Report Wizard](https://docs.devexpress.com/VCL/405760/ExpressReports/getting-started/create-table-report-using-report-wizard)
133+
- [How to store report layouts in REPX files at design-time](https://docs.devexpress.com/VCL/dxReport.TdxReport.Layout#string-list-editor)
134+
- [How to store report layouts in a database (example application)](https://github.com/DevExpress-Examples/vcl-reports-store-layout-template-database)
135+
- [How to 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)
136+
- [API reference: `TdxReport.Layout` Property](https://docs.devexpress.com/VCL/dxReport.TdxReport.Layout)
137+
- [API reference: `TdxBackendDatabaseSQLConnection` Component](https://docs.devexpress.com/VCL/dxBackend.ConnectionString.SQL.TdxBackendDatabaseSQLConnection)
138+
139+
140+
<!-- feedback -->
141+
## Does This Example Address Your Development Requirements/Objectives?
142+
143+
[<img src="https://www.devexpress.com/support/examples/i/yes-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=vcl-reports-store-layout-template-file&~~~was_helpful=yes) [<img src="https://www.devexpress.com/support/examples/i/no-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=vcl-reports-store-layout-template-file&~~~was_helpful=no)
144+
145+
(you will be redirected to DevExpress.com to submit your response)
146+
<!-- feedback end -->

0 commit comments

Comments
 (0)