Modifying report page’s properties
Sometimes it is necessary to modify report page settings (for example, to modify paper alignment or size) from a code. The TfrxReportPage
class contains the following properties, defining the size of the page:
property Orientation: TPrinterOrientation default poPortrait;
property PaperWidth: Extended;
property PaperHeight: Extended;
property PaperSize: Integer;
The PaperSize
property sets paper format. This is one of the standard values, defined in the Windows.pas (for example, DMPAPER_A4). If a value to this property is assigned, FastReport fills the PaperWidth
and PaperHeight
properties automatically (paper size in millimeters). Setting the DMPAPER_USER (or 256) value as a format, would mean that custom paper size is set. In this case, the PaperWidth
and PaperHeight
properties should be filled manually.
The following example shows, how to modify parameters of the first page (it is assumed that we already have a report):
Pascal:
var
Page: TfrxReportPage;
{ the first report’s page has [1] index. [0] is the Data page. }
Page := TfrxReportPage(frxReport1.Pages[1]);
{ modify the size }
Page.PaperSize := DMPAPER_A2;
{ modify the paper orientation }
Page.Orientation := poLandscape;
C++:
TfrxReportPage * Page;
// the first report’s page has [1] index. [0] is the Data page.
Page = (TfrxReportPage *)frxReport1.Pages[1];
// modify the size
Page->PaperSize = DMPAPER_A2;
// modify the paper orientation
Page->Orientation = poLandscape;