Printing a file

Top  Previous  Next

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

 

For printing, the report should contain a “MasterData” band that will be printed just once (to do this connect the band to a data source that contains just one record; select the source named "Single row" from the list). Stretching (“Stretch”) and splitting (“Allow Split”) are enabled for the band, which means that the band is stretched to make room for all the objects located on it and if the page has insufficient room for the band then the band is split over two or more pages.

 

File contents are displayed using a “Text” object containing the expression “[<file>]” variable. This variable, as in previous examples, is filled using the “TfrxReport.OnGetValue” event. Stretching is also enabled for the object (“Stretch” from the contextual menu or “StretchMode” property = smActualHeight).