Skip to content

Commit 6579df5

Browse files
committed
readme: review comments
1 parent e425a69 commit 6579df5

1 file changed

Lines changed: 22 additions & 16 deletions

File tree

README.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ To modify parameters, load them using the `LoadParametersFromReport` method and
104104
```pas
105105
AReport.LoadParametersFromReport;
106106
// Set the "OrderIdParameter" value in the report layout
107-
// AReportParameter: TdxReportParameter;
108-
for AReportParameter in AReport.Parameters do
109-
if AReportParameter.Name = 'OrderIdParameter' then
110-
AReportParameter.Value := '11077';
107+
AReport.Parameters['OrderIdParameter'].Value := AOrderID;
111108
```
112109

113110

@@ -125,29 +122,38 @@ try
125122
// Export a report to a memory stream in the PDF format
126123
AReport.ExportToPDF(AStream);
127124
// Save memory stream content to a file
128-
AStream.SaveToFile('Order_11077.pdf');
125+
AStream.SaveToFile('..\Order_' + AOrderID + '.pdf');
129126
finally
130127
AStream.Free;
131128
end;
132129
```
133130

134131
### Export Multiple Reports
135132

136-
The technique demonstrated in this example allows you to generate and export different reports based on the same layout and data using different parameter combinations.
137-
Repeat steps 3 and 4 for each parameter combination.
133+
The technique demonstrated in this example allows you to generate and export multiple reports based on the same layout and data
134+
using a list of parameters.
135+
You need to initialize the report layout and data connection once (steps 1 and 2),
136+
and repeat steps 3 and 4 for each parameter.
138137

139138
**Delphi:**
140139

141140
```pas
142-
// Find each report parameter
143-
for AReportParameter in AReport.Parameters do
144-
if AReportParameter.Name = 'OrderIdParameter' then
145-
AOrderParameter := AReportParameter;
146-
147-
for OrderID in OrderIDList:
148-
// Assign values to report parameters
149-
AOrderParameter.Value = OrderID;
150-
// Proceed with step 4
141+
// ...
142+
AReport.LoadParametersFromReport;
143+
144+
for AOrderID in AOrderIDList:
145+
AReport.Parameters['OrderIdParameter'].Value := AOrderID;
146+
147+
AStream := TMemoryStream.Create; // AStream: TMemoryStream;
148+
try
149+
// Export a report to a memory stream in the PDF format
150+
AReport.ExportToPDF(AStream);
151+
// Save memory stream content to a file
152+
AStream.SaveToFile('..\Order_' + AOrderID + '.pdf');
153+
finally
154+
AStream.Free;
155+
end;
156+
end;
151157
```
152158

153159

0 commit comments

Comments
 (0)