操作WORD文件的問題(100分)

  • 主题发起人 主题发起人 DINGHELLO
  • 开始时间 开始时间
D

DINGHELLO

Unregistered / Unconfirmed
GUEST, unregistred user!
各位大俠:<br> 小弟遇到几個問題:<br>  1、怎樣把SQL的IMAGE類型字段內容存為WORD文件。<br>  2、怎樣用DELPHI控制WORD打開一個已存在文件?我用下面語句,但報錯[Not enough actual parameters]<br><br>var<br>FileName, ConfirmConversions, ReadOnly, AddToRecentFiles,<br>PasswordDocument, PasswordTemplate, Revert,WritePasswordDocument,<br>WritePasswordTemplate, Format,MatchCase, MatchWholeWord, find1, rep1,<br>MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward,<br>Wrap, Replace: OleVariant;<br>begin<br>Myword.Connect;<br>Myword.Visible :=false;<br>FileName := MyFile; <br>confirmConversions := False;<br>ReadOnly := False;<br>AddToRecentFiles := False;<br>PasswordDocument := '';<br>PasswordTemplate := '';<br>Revert := True;<br>WritePasswordDocument := '';<br>WritePasswordTemplate := '';<br>Format := wdOpenFormatDocument;<br>myWord.Documents.Open(FileName, ConfirmConversions,<br>readOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate,<br>Revert, WritePasswordDocument, WritePasswordTemplate, Format);<br>Myword.Visible :=True;<br><br><br>3、怎樣用DELPHI語句在WORD文檔里面的某行某列寫入字符串?<br><br>4、怎樣將在WORD更改后當關閉時即刻更新到SQL字段中?<br><br>萬分感謝!<br><br>
 
2、<br>procedure TForm1.Button1Click(Sender: TObject);<br>var Encoding,Format,ConfirmConversions,WritePasswordDocument:olevariant;<br>&nbsp; &nbsp; WritePasswordTemplate,Revert,PasswordTemplate,PasswordDocument:olevariant;<br>&nbsp; &nbsp; AddToRecentFiles,ReadOnly,tmp,filename:OleVariant;<br>begin<br>Screen.Cursor:=crHourGlass;<br>try<br>&nbsp; Application.ProcessMessages;<br>&nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp; Wordapp.Connect;<br>&nbsp; &nbsp; except<br>&nbsp; &nbsp; &nbsp; &nbsp; MessageDlg('连接失败,重试一次', mtError, [mbOk], 0);<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; EmptyParam:='';<br>&nbsp; &nbsp; Encoding:=msoEncodingAutoDetect;<br>&nbsp; &nbsp; WordApp.Caption := 'MyDocz';<br>&nbsp; &nbsp; Format:=wdOpenFormatAuto;<br>&nbsp; &nbsp; tmp:=true;<br>&nbsp; &nbsp; filename:='C:/1.dot';<br>&nbsp; &nbsp; ConfirmConversions:=False;<br>&nbsp; &nbsp; AddToRecentFiles:=False;<br>&nbsp; &nbsp; ReadOnly:=False;<br>&nbsp; &nbsp; PasswordDocument:='';<br>&nbsp; &nbsp; PasswordTemplate:='';<br>&nbsp; &nbsp; Revert:=False;<br>&nbsp; &nbsp; WritePasswordDocument:='';<br>&nbsp; &nbsp; WritePasswordTemplate:='';<br>&nbsp; &nbsp; WordApp.Documents.Open(filename,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ConfirmConversions,ReadOnly<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ,AddToRecentFiles,PasswordDocument,PasswordTemplate,Revert,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WritePasswordDocument,WritePasswordTemplate,format,Encoding ,tmp);<br>&nbsp; &nbsp; {Turn Spell checking of because it takes a long time if enabled and slows down Winword}<br>&nbsp; &nbsp; Wordapp.Visible := True;<br>&nbsp; // &nbsp;SendToWord;<br>&nbsp; &nbsp; Wordapp.Activate;<br>finally<br>&nbsp; Screen.Cursor:=crDefault;<br>end;<br>end;<br>
 
TO:wfzha <br>我試了一下,但顯示信息:Undeclared identifier: 'msoEncodingAutoDetect'。這代碼頁是不是一個常量來的?它的取值有哪些?<br><br>
 
uses Office2000
 
1、保存的代码dfw上有<br>3、word文本是流方式的,好像没有行和烈的概念<br>4、在normal.dot中写自己的宏,在文档保存后通知自己的程序更新数据库。<br>这些天空闲不多,代码自己想办法吧!
 
接受答案了.
 
后退
顶部