和word交互(20分)

  • 主题发起人 calmworld
  • 开始时间
C

calmworld

Unregistered / Unconfirmed
GUEST, unregistred user!
我想从数据库中去数据放到word里,修改后再存回去。
思路我也有了,我想要具体的代码。

procedure TForm1.Button1Click(Sender: TObject);
begin
CreateOleObject('Word.Application')
end;

上面为什么报错Undeclared identifier:"CreateOleObject"

我很臭,门还没入,但工作需要,我必须写这样的一个控件出来!
 
uses ComObj;
 
谢谢啊,可以:)
我后面又加了句
Doc_Handle:=Word_Ole.Documents.Add(Template:='',NewTemplate:=False);
又报
Undeclared identifier:"Doc_Handle";
Undeclared identifier:"Word_Ole";
missing operator or semiconon

Why?
谢谢!!
 
//在interface 下的 uses 里加上 ComObj 单元文件.
procedure TForm1.Button1Click(Sender: TObject);
var
V:Variant;
begin
try
V:=GetActiveOleObject('Word.Basic');//与当前打开的word文档建立连接
except
V:=CreateOleObject('Word.Basic'); //如果当前没有word文档则新建一个word文档
v.filenew;
end;
v.AppShow;
V.Insert('向word里写数据');
end;
 
好,可行:)
谢谢!
我现在想把这个打开的word文件中的数据保存到数据库中应该怎么写啊
是不是要保存到image字段,这个image字段定义的长度应该为多少?
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
431
import
I
S
回复
0
查看
600
swish
S
I
回复
0
查看
606
import
I
顶部