procedure SaveAs(sPath: String);//先保存为文件
var
FileName, FileFormat,
LockComments, Password, saveChanges,Originalformat,routidocument,
AddToRecentFiles, WritePassword,
ReadOnlyRecommended, EmbedTrueTypeFonts,
SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter : OleVariant;
begin
if FileExists(sPath) then DeleteFile(sPath);
if sPath<>'' then
begin
try
Screen.Cursor:=62;
FileName:=sPath;
FileFormat := wdNormalTemplate;// 101;
LockComments := False;
Password := '';
AddToRecentFiles := True;
WritePassword := '';
ReadOnlyRecommended := False;
EmbedTrueTypeFonts := False;
SaveNativePictureFormat := False;
SaveFormsData := False;
SaveAsAOCELetter := False;
SaveChanges := false;
RoutiDocument := 0;
OriginalFormat := 0;
wordApp.ActiveDocument.SaveAs(FileName,FileFormat,LockComments,Password,AddToRecentFiles,
WritePassword,ReadOnlyRecommended,EmbedTrueTypeFonts,SaveNativePictureFormat,
SaveFormsData,SaveAsAOCELetter);
finally
Screen.Cursor:=crDefault;
end;
end;
SaveTo(sPath);
end;
procedure SaveTo(tmpFileName: oleVariant);
var
fileStream: TFileStream;
filename: oleVariant;
TempPath:String;
begin
fileStream:=TFileStream.Create(tmpFileName, fmOpenRead or fmShareDenyNone);
try
Screen.Cursor:=62;
//ReturnTemplet;
try
pic := VarArrayCreate ([0,FileStream.Size - 1], varByte);
P := VarArrayLock (Pic);
FileStream.Position := 0;
FileStream.Read (P^, FileStream.Size); //保存为 OleVariant
VarArrayUnlock (Pic);
try
(dmPub.HTTPRIO1 as IPwSoapDm).UpdateImage(pic,ssql,outpara);//我的webservices中的服务端保存方法
except
raise exception.Create('保存失败');
end;
//bSave:=True;
finally
Screen.Cursor:=crDefault;
end;
finally
fileStream.Free;
end;
end;