線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1217
推到 Plurk!
推到 Facebook!

請問如何用 Delphi 開啟有設定密碼的 Word 檔?

缺席
azurecloud
中階會員


發表:52
回覆:108
積分:92
註冊:2003-09-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-02-21 21:38:41 IP:163.13.xxx.xxx 未訂閱
大家好:     我搜尋過站內文章,另外找到一個教學的網站,知道開啟 word 的語法像 這樣:http://www.djpate.freeserve.co.uk/AutoWord.htm In word 97:     var   FileName: OleVariant; begin   FileName := 'C:\My Documents\The file I want to open.doc';   Word.Documents.Open(FileName, EmptyParam, EmptyParam, EmptyParam,                         EmptyParam, EmptyParam, EmptyParam, EmptyParam,                       EmptyParam, EmptyParam);     The optional parameters here include ReadOnly (the third parameter, default False), PasswordDocument (the fifth parameter, pass the password string for the document), and Format (the last parameter, lets you specify the file converter to be used). In Word 2000, the Documents.Open method has two extra parameters, for encoding, and for specifying whether the document should be visible on screen. But using this method on a Word 97 machine will cause an exception, so if you need your code to be compatible with Word 97, use Word 2000's Documents.OpenOld method. This takes the same parameters as the Word 97 Open method. 由說明中看來,傳送密碼的參數是第五個,我就把程式改成這樣 var FileName: OleVariant; pwd : OleVariant; begin FileName := 'C:\My Documents\The file I want to open.doc'; Word.Documents.Open(FileName, EmptyParam, EmptyParam, EmptyParam, pwd, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam); 但實際執行時,word 還是要我輸入密碼,請問各位我是那裡寫錯了呢?謝謝大家。 PS.能請教大家Open中的另外九個參數是代表什麼意義嗎? ========================
我要努力向上
========================
azurecloud
中階會員


發表:52
回覆:108
積分:92
註冊:2003-09-04

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-02-21 21:42:50 IP:163.13.xxx.xxx 未訂閱
啊,更正一下,我是寫這樣 var FileName: OleVariant; pwd : OleVariant; begin FileName := 'C:\My Documents\The file I want to open.doc'; pwd := '1234'; Word.Documents.Open(FileName, EmptyParam, EmptyParam, EmptyParam, pwd,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam); ========================
我要努力向上
========================
系統時間:2024-05-19 7:12:00
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!