如何開啟有帶密碼的 xls 檔案

有關Delphi 的語法, 程式, 等
回覆文章
頭像
tim
文章: 1380
註冊時間: 2008年 11月 26日, 00:49

如何開啟有帶密碼的 xls 檔案

文章 tim »

參考資料, http://www.scalabium.com/faq/dct0153.htm
http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=68463

代碼: 選擇全部

var
 xls, xlw: Variant;
begin
 {load MS Excel}
 xls := CreateOLEObject('Excel.Application');

 {open your xls-file}
 xlw := xls.WorkBooks.Open(FileName := 'd:book1.xls', Password := 'qq',
ReadOnly := True);
 {save with other file name}
 xlw.SaveAs(FileName := 'd:book2.xls', Password := '');

 {unload MS Excel}
 xlw := UnAssigned;
 xls := UnAssigned;
end;
多多留言, 整理文章, 把經驗累積下來.....
回覆文章