WPCubed Product Support

Different page margins for first and following pages

1.7k Views 2 users 1 ♥ read 1 min
wpsupport

See the definition:

TWPMeasurePageParam = class(TObject)
public
_InternalChanged: Boolean; // do not use
changed: Boolean;
pagenr: Integer;
WidthTW, HeightTW, marginleft, margintop, marginright, marginbottom,
ColCount: Integer;
RTFpage: TWPVirtPage;
colmargin: Integer; // In twips
colmode: Integer; // Bit 1: No balancing
colflags: Integer; // Bit 1: Lines
end;

changed must be set to true if you change anything

#2 ♥ 1

How can I set different page margins for first and other pages?

For instance for the first page I want 2220 top margin and 1800 bottom margin. For the following pages 800 top and bottom margins.

I tried OnMeasureTextPage but it has no effect:

procedure TForm1.WPMeasureTextPage(Sender: TObject;
  PageInfo: TWPMeasurePageParam);
begin
  if PageInfo.pagenr = 1 then
    begin
      PageInfo.margintop := 2220;
      PageInfo.marginbottom := 1800;
    end
  else
    begin
      PageInfo.margintop := 800;
      PageInfo.marginbottom := 800;
    end;
end;
#1 ♥ 0