R
rlz
Unregistered / Unconfirmed
GUEST, unregistred user!
我用如下方法嵌入:
OleContainer1.Enabled:=true;
OleContainer1.CreateObjectFromFile(OpenFile.FileName,false);
OleContainer1.DoVerb(ovShow); //运行此句,才可以启动Word进程,才能让WordApp连上
WordApp.Connect;
WordApp.Tag:=9595; //作一个标记
WordDoc.ConnectTo(WordApp.ActiveDocument);
WordApp.CommandBars['Standard'].Set_Enabled(false); //将工具栏设为不可见
wordApp.CommandBars['Formatting'].Set_Enabled(false);
OleContainer1.DoVerb(ovShow); //运行此句让工具栏不再出现
//btnOpen.Enabled:=false;
//Form1.OnResize:=FormRizeDo;
for iLoop:=1 to Worddoc.Bookmarks.Count do //将标签加到ComboBox1中
begin
vLoop:=iLoop;
ComboBox1.Items.Add(Worddoc.Bookmarks.item(vLoop).name);
end;
用如下方法关闭:
OleContainer1.Close ;
wordapp.Quit ;
wordapp.Disconnect ;
但总是报错。请大侠帮忙。
OleContainer1.Enabled:=true;
OleContainer1.CreateObjectFromFile(OpenFile.FileName,false);
OleContainer1.DoVerb(ovShow); //运行此句,才可以启动Word进程,才能让WordApp连上
WordApp.Connect;
WordApp.Tag:=9595; //作一个标记
WordDoc.ConnectTo(WordApp.ActiveDocument);
WordApp.CommandBars['Standard'].Set_Enabled(false); //将工具栏设为不可见
wordApp.CommandBars['Formatting'].Set_Enabled(false);
OleContainer1.DoVerb(ovShow); //运行此句让工具栏不再出现
//btnOpen.Enabled:=false;
//Form1.OnResize:=FormRizeDo;
for iLoop:=1 to Worddoc.Bookmarks.Count do //将标签加到ComboBox1中
begin
vLoop:=iLoop;
ComboBox1.Items.Add(Worddoc.Bookmarks.item(vLoop).name);
end;
用如下方法关闭:
OleContainer1.Close ;
wordapp.Quit ;
wordapp.Disconnect ;
但总是报错。请大侠帮忙。