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

MARGINS: Changing dynamically?

edited July 2001 in General
Hi Everyone,

I have the request to print document with pages from 2 on with different
margin settings, eq. page 1 has top margin 1.5mm, 2nd and others have margin
3mm (also some other margins can be modified, the problem remains). How can
that be achieved?

I tried all events changing margin values, but nothing worked. I made
following code:

procedure TForm_DocumentRB.ReportDocumentPPageRequest(Sender,
aPageRequest: TObject);
begin
if ReportDocumentP.CurrentPage > 1 then begin
ReportDocumentP.PrinterSetup.MarginLeft :=
qryFormat.FieldByName('margin_left2').AsInteger;
ReportDocumentP.PrinterSetup.MarginTop :=
qryFormat.FieldByName('margin_top2').AsInteger;
ReportDocumentP.PrinterSetup.MarginBottom :=
qryFormat.FieldByName('margin_bottom2').AsInteger;
end;
end;

No matter of event used, it never works, margins do not change on other
pages. Is there any solution?
I am using Delphi 5 and RB Pro version 6.

TIA,

--
Davor Pleskina
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
davor@pleskina.com www.pleskina.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
davor.pleskina@vip.hr; davor.pleskina@ri.tel.hr
ICQ#: 38632789

Programmers don't die;
they just GOSUB without RETURN...

Comments

  • edited July 2001
    Hi,

    you could use two subreports with the different margins.

    enjoy,
    Ron.

  • edited December 2013
    Hi,

    I have the same request as Davor Pleskina. I would like to use a wider
    top margin on pages 2 to end than on page 1.

    I do not understand, how I could use subreports in order to change the
    top margin dynamically.
    Maybe there is also a better solution in the current ReportBuilder version.

    Best regards,
    David


    Am 10.07.2001 20:32, schrieb Ronald Eckersberger (TeamDM):
  • edited December 2013
    Hi David,

    Try simply adjusting the margin values in the OnStartPage event of the
    report. The following code worked for me in a simple test.

    procedure TForm1.ppReport1StartPage(Sender: TObject);
    begin
    if ppReport1.AbsolutePageNo > 1 then
    ppReport1.PrinterSetup.MarginTop := 3
    else
    ppReport1.PrinterSetup.MarginTop := 1;

    end;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.