我使用oleContainer嵌入Word文档。 到目前为止,结果已经解决了。但是,菜单在oleContainer之外。 如您在这张图片中看到的。
如何将菜单放入容器?
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.