问题: 请问如何在delphi 中直接打开word 文档? ( 积分: 100 )
分类: 非技术问题
来自: laih, 时间: 2000-08-16 14:36:22, ID: 310416
请问如何在delphi 中直接打开word 文档?
来自: weck, 时间: 2000-08-16 14:59:23, ID: 310438
可以用word dde server啊?delphi5.0有
来自: xinyt, 时间: 2000-08-16 15:05:48, ID: 310449
使用Createoleobject('word.basic')函数
或olecontainer控件
或word dde server
来自: CathyEagle, 时间: 2000-08-16 16:53:08, ID: 310542
D5中用TWebBrowser,D4中用下面的方法引入WebBrowser,
choose from the menu Component->Import ActiveX Control and install:
Microsoft HTML Object Library
Microsoft Internet Controls
this will install:
Webbrowser_V1
Webbrowser
Scriptlet
然后Webbrowser1.navigate('c:/test.doc'),则Word会无缝嵌入到webbrowser中打开稳当。
来自: sungw, 时间: 2000-08-16 23:40:04, ID: 310894
建议你阅读"DELPHI 4编程技术内幕 " 第16章
里面详细的例子.
若需要,请告诉我.
来自: mantousoft, 时间: 2000-08-17 2:55:25, ID: 310994
d5带有例子,默认在C:/Program Files/Borland/Delphi5/Demos/Activex/Oleauto下
来自: slicker, 时间: 2000-08-17 6:58:12, ID: 311018
HINSTANCE ShellExecute(
HWND hwnd, // handle to parent window
LPCTSTR lpOperation, // pointer to string that specifies operation to perform
LPCTSTR lpFile, // pointer to filename or folder name string
LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters
LPCTSTR lpDirectory, // pointer to string that specifies default directory
INT nShowCmd // whether file is shown when opened
);
Delphi define the API in shellAPI.pas as the follow
function ShellExecuteA(hWnd: HWND; Operation, FileName, Parameters,
Directory: PAnsiChar; ShowCmd: Integer): HINST; stdcall;
来自: 小刚, 时间: 2000-08-17 7:16:20, ID: 311024
我认为 CathyEagle 的方法最好
来自: terry_lzs, 时间: 2000-08-17 8:28:23, ID: 311075
winexec(路径 /宏,sw_normal);
来自: player88, 时间: 2000-08-17 9:59:51, ID: 311201
关注此题
来自: 一剑封喉, 时间: 2000-08-17 10:08:23, ID: 311217
//给你一个例子
procedure Tf_mag.N13Click(Sender: TObject);
var s:string;
type_id:integer;
i,j:integer;
begin
fdm_z.select_print_sql.close;
fdm_z.select_print_sql.open;
fdm_z.ak_answer_print.open;
WordApp := createoleobject('Word.Application');
WordApp.Visible := True;
WordApp.Documents.Add;
Range := WordApp.Documents.Item(1).Range;
WordApp.Documents.Item(1).Paragraphs.Add;
range:=WordApp.Documents.Item(1).Range(WordApp.Documents.Item(1).
Paragraphs.item(2).range.start);
for i := 1 to 2 do WordApp.Documents.Item(1).Paragraphs.Add;
i:=1;
j:=1;
fdm_z.select_print_sql.first;
range:=WordApp.Documents.Item(1).Range(WordApp.Documents.Item(1).
Paragraphs.item(i+2).range.start);
Range.Text :=fdm_z.select_print_sqltype_name.value;
WordApp.Documents.Item(1).Paragraphs.Add;
i:=i+1;
while not fdm_z.select_print_sql.eof do
begin
range:=WordApp.Documents.Item(1).Range(WordApp.Documents.Item(1).
Paragraphs.item(i+2).range.start);
Range.Text :=inttostr(j)+'. '+dbrichedit1.text;//tcaption(fdm_z.select_print_sqlquestion_name.value);
WordApp.Documents.Item(1).Paragraphs.Add;
i:=i+1;
if not fdm_z.ak_answer_print.isempty then
begin
fdm_z.ak_answer_print.First;
while not fdm_z.ak_answer_print.eof do
begin
range1:=WordApp.Documents.Item(1).Range(WordApp.Documents.Item(1).
Paragraphs.item(i+2).range.start);
Range1.Text :=fdm_z.ak_answer_printnumber_id.value+'. '+dbrichedit2.text;//tcaption(fdm_z.ak_answer_printanswer_name.text);
WordApp.Documents.Item(1).Paragraphs.Add;
fdm_z.ak_answer_print.next;
i:=i+1
end;
end;
type_id:=fdm_z.select_print_sqltype_id.value;
fdm_z.select_print_sql.next;
WordApp.Documents.Item(1).Paragraphs.Add;
i:=i+1;
j:=j+1;
if type_id<>fdm_z.select_print_sqltype_id.value then
begin
range:=WordApp.Documents.Item(1).Range(WordApp.Documents.Item(1).
Paragraphs.item(i+2).range.start);
Range.Text :=fdm_z.select_print_sqltype_name.value;
WordApp.Documents.Item(1).Paragraphs.Add;
j:=1;
i:=i+1;
end;
end;
end;
来自: terry_lzs, 时间: 2000-08-17 17:19:23, ID: 311626
shellexecute(handle,'open','f:/aa.doc',nil,nil,0);别忘了加上shellapi这个unit
来自: laih, 时间: 2000-08-25 14:43:05, ID: 318249
接受答案了.
得分大富翁: xinyt