Printing an array

Top  Previous  Next

The code for this example is located in the “FastReport Demos\PrintArray” ("FastReport Demos\BCB Demos\PrintArray") folder. Let's explain some details of this code.

 

To print an array we use a report having one “MasterData” band which will be displayed as many times as there are elements in the array. To do this place a “TfrxUserDataSet” component on the form and then set these properties (this can be done in code, as shown in the example):

 

 RangeEnd := reCount

 RangeEndCount := a number of elements in an array

 

After that connect the data band to the “TfrxUserDataSet” component. To represent an array element place a text object containing the expression “[<element>]” inside the “MasterData” band. The “element” variable is filled using the “TfrxReport.OnGetValue” event.