讓Word打開一個指定的文件
var
ItemIndex :OleVariant;
FileName
PasswordDocument
WritePasswordDocument
begin
if not dlgOpen
Exit;
{Open document}
FileName := dlgOpen
ConfirmConversions := False;
ReadOnly := False;
AddToRecentFiles := False;
PasswordDocument :=
PasswordTemplate :=
Revert := True;
WritePasswordDocument :=
WritePasswordTemplate :=
Format := wdOpenFormatDocument;
WordApplication
ReadOnly
Revert
{Assign WordDocument component}
ItemIndex :=
WordDocument
{Turn Spell checking of because it takes a long time if enabled and slows down Winword}
WordApplication
WordApplication
end;
讓Word替換標記字符串要使用WordDocument
var
FindText
begin
FindText :=
MatchCase := False;
MatchWholeWord := True;
MatchWildcards := False;
MatchSoundsLike := False;
MatchAllWordForms := False;
Forward := True;
Wrap := wdFindContinue;
Format := False;
ReplaceWith :=
Replace := True;
WordDocument
end;
上面這
[
From:http://tw.wingwit.com/Article/program/Delphi/201311/24790.html