Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Change Margins at runtime

edited June 2003 in General
I'm using RB7(Ent) on Delphi 5.
I have the report files saved in RTM. I'm trying to change the margins at
runtime by assigning the following code

procedure TForm1.btnDesignClick(Sender: TObject);
begin
ppReport1.Engine.Page.PrinterSetup.MarginTop := Single(Edit1.Text);
ppReport1.Engine.Page.PrinterSetup.MarginLeft := Single(Edit2.Text);
ppReport1.Engine.Page.PrinterSetup.MarginBottom := Single(Edit3.Text);
ppReport1.Engine.Page.PrinterSetup.MarginRight := Single(Edit4.Text);}
ppDesigner1.Show;
end;

but when i go to Page Setup & point to Margins tabpage it seems the margins
are always the same which 0.25

How should i overcome this?

Comments

  • edited June 2003
    Try setting Report.PrinterSetup before showing the designer. If you are
    loading a report template, use the Report.Template.OnLoadEnd event in order
    to set the Report.PrinterSetup.

    Use the Report.Engine.Page.PrinterSetup when you want to change each page
    after the report has generated it, but before it has sent it to the devices.
    You'll want to use the Report.OnEndPage event to set the engine's page
    object in other certain scenarios.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.