感谢jsxjd,、qianwt的参与![
]
页面需要刷新才能将下载的word文件打开!而且如果打开也非常的慢!有没好的办法解决呢!
我调试的机器运行的时候没有问题!但是如果那一台安装了金山词霸或者快译就会打不开!
另:正在看Word文档!
代码如下!
procedure TLx_Word.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
var
buffer : pointer ;
fs : Tfilestream ;
mess :integer ;
f_size:longword ;
const buffersize = 4096 ;
begin
IF LOG then
begin
socket.receivebuf(nRetr,sizeof(longword));
nRetr :=ntohl(nRetr) ;
LOG :=FALSE ;
END
else
begin
getmem(buffer,buffersize);
mess :=socket.receivebuf(buffer^,buffersize);
if not Fileexists(temppath+Word_id+'.doc') then
begin
fs :=Tfilestream.create(temppath+Word_id+'.doc',fmCreate or fmShareDenyNone);
fs.seek(0,soFrombegin
ning);
end else
begin
fs :=Tfilestream.create(temppath+Word_id+'.doc',fmopenwrite or fmShareDenyNone);
fs.seek(0,soFromEnd)
end ;
fs.writebuffer(buffer^,mess);
f_size := fs.Size ;
fs.destroy;
freemem(buffer);
if f_size >= nRetr then
begin
// showmessage('3');
case strtoint(Oper_id) of
1 : //新建
begin
OleContainer1.Enabled := true ;
OleContainer1.CreateObjectFromFile (temppath+Word_id+'.doc' ,false) ;
OleContainer1.DoVerb (-1) ;
panel1.Visible := false ;
OleContainer1.OleObject.application.UserName := p_name ;
end ;
2 : //审批
begin
// showmessage('3');
OleContainer1.Enabled := true ;
OleContainer1.CreateObjectFromFile (temppath+Word_id+'.doc' ,false) ;
OleContainer1.DoVerb (-1) ;
panel1.Visible := false ;
// showmessage('开始审批');
OleContainer1.OleObject.PrintRevisions :=true ;
OleContainer1.OleObject.ShowRevisions :=true ;
OleContainer1.OleObject.TrackRevisions := true ;
OleContainer1.OleObject.application.UserName := p_name ;
LOG :=TRUE ;
end ;
3 : //查阅
begin
OleContainer1.Enabled := true ;
OleContainer1.CreateObjectFromFile (temppath+Word_id+'.doc' ,false) ;
OleContainer1.DoVerb (ovShow) ;
panel1.Visible := false ;
LOG :=TRUE ;
end;
4 : //待设
begin
end;
End
end
end;
end;