Hi everyone,
Lazarus gives a "EOleException" (Screenshot attached) when trying to set the Page Layout (Left Margin) of a newly created Word (2013) Document. Error is only present in 3.x Versions - program runs fine in 2.0.12. Error message would be translated "LeftMargin is not a reference property".
unit OleError;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComObj;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
WdApp,Dokument:OleVariant;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var oleVar:OleVariant;
begin
WdApp := CreateOleObject('Word.Application');
WdApp.Visible := True;
Dokument := WdApp.Documents.Add;
Dokument.Activate;
oleVar := 36;Dokument.PageSetup.LeftMargin := oleVar;
end;
end.
Anyone know how to solve that ? Thanks !