关于WordApplication.Documents.Open 编译出错的问题(20)

  • 主题发起人 主题发起人 royhgf
  • 开始时间 开始时间
R

royhgf

Unregistered / Unconfirmed
GUEST, unregistred user!
我用的是WordApplication.Documents.Open方法调用的,以便控制编辑word文档。代码如下:var ItemIndex :OleVariant; FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format: OleVariant; {Open document} FileName := 'c:/aa.doc'; ConfirmConversions := False; ReadOnly := False; AddToRecentFiles := False; PasswordDocument := ''; PasswordTemplate := ''; Revert := True; WritePasswordDocument :='' ; WritePasswordTemplate :='' ; Format := wdOpenFormatDocument; WordApplication.Documents.Open( FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format ); 编译时出现如下错误:[Error] Unit1.pas(77): Not enough actual parameters请各位高手指教。
 
WordApplication 是什么? 变量? 我这边显示WordApplication 是Word2000.pas中的一个接口类型。
 
USES Word2000,ComObj;VAR eclApp:OleVariant; sError:String;try eclApp := CreateOleObject('Word.Application'); eclApp.Documents.Open('C:/aa.doc'); eclApp.Visible := TRUE; except On E:exception do begin sError:=E.Message; showmessage(sError); exit; end; end;
 
此外,Word2000.pas中定义的一个Open(5485行)可能对应于你的Open. function Open(var FileName: OleVariant; var ConfirmConversions: OleVariant; var ReadOnly: OleVariant; var AddToRecentFiles: OleVariant; var PasswordDocument: OleVariant; var PasswordTemplate: OleVariant; var Revert: OleVariant; var WritePasswordDocument: OleVariant; var WritePasswordTemplate: OleVariant; var Format: OleVariant; var Encoding: OleVariant; var Visible: OleVariant): WordDocument; safecall;但你缺少了最后2个参数 Encoding和Visible,
 
后退
顶部