unit Unit1;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls,
Vcl.ExtCtrls,
Vcl.OleCtnrs;
type
TForm1 = class(TForm)
Button1: TButton;
OleContainer1: TOleContainer;
Panel1: TPanel;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses ComObj, shellapi;
procedure TForm1.Button1Click(Sender: TObject);
var
FDocument, FWord:Variant;
FContainer: TOleContainer;
begin
FContainer := TOleContainer.Create(olecontainer1);
FContainer.Modified := false;
FContainer.Parent := olecontainer1;
FContainer.Align := alClient;
FContainer.CreateObject('Word.Document', true);
FDocument := IDispatch(FContainer.OleObject);
FWord := FDocument.Application;
FContainer.DoVerb(ovShow);
end;
end.