S
surfer
Unregistered / Unconfirmed
GUEST, unregistred user!
......
var
Form1: TMainForm1;
MyWord:Variant; //定义Variant类型的全局变量MyWord
implementation
uses
ComObj; //声明将调用CreateOleObject函数
......
//急需采用OLE接口的Word.Basic语句替换下列8个语句
procedure TMainForm1.WordTableMergeBitBtn1Click(Sender: TObject);
var
I: Integer ;
DocFileName: String ;
DocFile:OleVariant ;
begin
......
1 WordApplication1.Connect ; //连接Word程序
2 WordApplication1.Visible := True; //Word程序可用
3 WordDocument1.ConnectTo(WordApplication1.Documents.Add
(EmptyParam,EmptyParam,EmptyParam,EmptyParam) );
......
//调用Insert插入所选文档
4 WordApplication1.Selection.InsertFile
(DocFileName,EmptyParam,EmptyParam,EmptyParam,EmptyParam) ;
......
5 WordDocument1.SaveAs(DocFile); //打开“另存为”窗口
......
6 WordDocument1.PrintPreview; //开始文档预览
......
7 WordApplication1.Quit ; //退出Word程序
8 WordApplication1.Disconnect ; //与Word程序断开连接
......
end;
var
Form1: TMainForm1;
MyWord:Variant; //定义Variant类型的全局变量MyWord
implementation
uses
ComObj; //声明将调用CreateOleObject函数
......
//急需采用OLE接口的Word.Basic语句替换下列8个语句
procedure TMainForm1.WordTableMergeBitBtn1Click(Sender: TObject);
var
I: Integer ;
DocFileName: String ;
DocFile:OleVariant ;
begin
......
1 WordApplication1.Connect ; //连接Word程序
2 WordApplication1.Visible := True; //Word程序可用
3 WordDocument1.ConnectTo(WordApplication1.Documents.Add
(EmptyParam,EmptyParam,EmptyParam,EmptyParam) );
......
//调用Insert插入所选文档
4 WordApplication1.Selection.InsertFile
(DocFileName,EmptyParam,EmptyParam,EmptyParam,EmptyParam) ;
......
5 WordDocument1.SaveAs(DocFile); //打开“另存为”窗口
......
6 WordDocument1.PrintPreview; //开始文档预览
......
7 WordApplication1.Quit ; //退出Word程序
8 WordApplication1.Disconnect ; //与Word程序断开连接
......
end;