S
sunlp
Unregistered / Unconfirmed
GUEST, unregistred user!
为什么在打开word文档时报文档转换的错误
我的代码如下:
if fileexists('c:/temp.tmp') then deletefile('c:/temp.tmp');
Myfile:=TfileStream.Create('c:/temp.tmp',fmCreate);
Stream:=TClientBlobStream.Create(CDS_yaxx.fieldbyname('ya') as TBlobfield,bmRead);
MemSize:=stream.Size ;
inc(memsize);
Buffer:=AllocMem(memsize);
try
stream.Read(buffer^,Memsize) ;
myfile.Write(buffer^,Memsize);
finally
myfile.free;
stream.Free ;
end;
if fileexists('c:/temp.doc') then deletefile('c:/temp.doc');
if fileexists('c:/temp.tmp') then
begin
renamefile('c:/temp.tmp','c:/temp.doc');
filename:='c:/temp.doc';
end;
//创建容器控件,存放文件
Doc_ole.CreateObjectFromFile(filename,false);
Doc_ole.Run ;
我的代码如下:
if fileexists('c:/temp.tmp') then deletefile('c:/temp.tmp');
Myfile:=TfileStream.Create('c:/temp.tmp',fmCreate);
Stream:=TClientBlobStream.Create(CDS_yaxx.fieldbyname('ya') as TBlobfield,bmRead);
MemSize:=stream.Size ;
inc(memsize);
Buffer:=AllocMem(memsize);
try
stream.Read(buffer^,Memsize) ;
myfile.Write(buffer^,Memsize);
finally
myfile.free;
stream.Free ;
end;
if fileexists('c:/temp.doc') then deletefile('c:/temp.doc');
if fileexists('c:/temp.tmp') then
begin
renamefile('c:/temp.tmp','c:/temp.doc');
filename:='c:/temp.doc';
end;
//创建容器控件,存放文件
Doc_ole.CreateObjectFromFile(filename,false);
Doc_ole.Run ;