type TMargin = record
  Left: Single;
  Right: Single;
  Top: Single;
  Bottom: Single;
  WordApplication: TWordApplication;
end;

Function ....
var
  oMargin: TMargin;
begin

  oMargin.Left := -1;
  oMargin.Right := -1;
  oMargin.Top := -1;
  oMargin.Bottom := 1.5;
  oMargin.WordApplication := WordApplication;

  SetMargin(oMargin);

end;

Procedure SetMargin(oMargin: TMargin );
var
  oWord: TWordApplication;
begin

  oWord := oMargin.WordApplication;

  with oWord.ActiveDocument.PageSetup do begin
    if oMargin.Top <> -1 then
      TopMargin := oMargin.Top;
    if oMargin.Left <> -1 then
      LeftMargin := oMargin.Left;
    if oMargin.Bottom <> -1 then
      BottomMargin := oMargin.Bottom;
    if oMargin.Right <> -1 then
      RightMargin := oMargin.Right;
    SectionStart := wdSectionContinuous;
    SectionDirection := wdSectionDirectionLtr;
  end;

end;

In the above code, only the bottom margin will be set to 1.5cm
The problem is, that sometimes, Word 2003 sets the bottom margin to
0,05cm and not to 1,5cm. That is also the problem here. 
Sometimes! Not always.
If i do not set the bottom margin at all, everything works fine.
Maybe i am doing something wrong, but i do not see it.
I would be really grateful if someone could help me with this.

TIA 
Marco

Reply via email to