procedure TForm1.LunchWord;
var
temp, newtemp, index: olevariant;
FileName, ConfirmConversions, ReadOnly, AddToRecentFiles,
PasswordDocument, PasswordTemplate, Revert,encoding,visible,
WritePasswordDocument, WritePasswordTemplate, Format: olevariant;
begin
temp := '';
newtemp := false;
wordapplication1.disconnect;
wordapplication1.Connect;
wordapplication1.visible := true; FileName := extractfilepath(paramstr(0)) + 'field.doc'; ConfirmConversions := False;
ReadOnly := False; AddToRecentFiles := False; PasswordDocument := '';
PasswordTemplate := ''; Revert := False; WritePasswordDocument := '';
WritePasswordTemplate := ''; Format := 0;
encoding:=false; visible:=true;
//wordapplication1.Documents.Open(
wordapplication1.Documents.Open(FileName, ConfirmConversions, ReadOnly,
AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert,
WritePasswordDocument, WritePasswordTemplate, Format, encoding, visible); index := 1;
//worddocument1.connectto(wordapplication1.Documents.Item(index) as _document);
end;procedure TForm1.Button4Click(Sender: TObject);
begin
lunchword;
end;procedure TForm1.Button5Click(Sender: TObject);
begin
replace('hello', 'hey');
end;procedure tform1.Replace(afindtext, areplacewith: string);
var
FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, format,
MatchAllWordForms, Forward, Wrap, ReplaceWith, Replace, MatchByte: olevariant;
found: boolean;
matchkashida,matchdiacritics,matchalefhamza,matchcontrol:olevariant;
begin
FindText := afindtext;
Replacewith := areplacewith;
Forward := True;
Wrap := wdFindContinue;
Format := False;
MatchCase := False;
MatchWholeWord := False;
MatchWildcards := False;
MatchSoundsLike := False;
MatchAllWordForms := False;
MatchByte := True;
replace := true;
matchkashida:=false; matchdiacritics:=false;
matchalefhamza:=false; matchcontrol:=false; repeat
until wordapplication1.Selection.Find.Execute(FindText, MatchCase,
MatchWholeWord, MatchWildcards, MatchSoundsLike, MatchAllWordForms,
Forward, Wrap, Format, ReplaceWith, Replace,matchkashida,
matchdiacritics,matchalefhamza,matchcontrol) = false;
end;procedure TForm1.Button6Click(Sender: TObject);
begin
wordapplication1.Disconnect;
wordapplication1.Quit;
end;
var
temp, newtemp, index: olevariant;
FileName, ConfirmConversions, ReadOnly, AddToRecentFiles,
PasswordDocument, PasswordTemplate, Revert,encoding,visible,
WritePasswordDocument, WritePasswordTemplate, Format: olevariant;
begin
temp := '';
newtemp := false;
wordapplication1.disconnect;
wordapplication1.Connect;
wordapplication1.visible := true; FileName := extractfilepath(paramstr(0)) + 'field.doc'; ConfirmConversions := False;
ReadOnly := False; AddToRecentFiles := False; PasswordDocument := '';
PasswordTemplate := ''; Revert := False; WritePasswordDocument := '';
WritePasswordTemplate := ''; Format := 0;
encoding:=false; visible:=true;
//wordapplication1.Documents.Open(
wordapplication1.Documents.Open(FileName, ConfirmConversions, ReadOnly,
AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert,
WritePasswordDocument, WritePasswordTemplate, Format, encoding, visible); index := 1;
//worddocument1.connectto(wordapplication1.Documents.Item(index) as _document);
end;procedure TForm1.Button4Click(Sender: TObject);
begin
lunchword;
end;procedure TForm1.Button5Click(Sender: TObject);
begin
replace('hello', 'hey');
end;procedure tform1.Replace(afindtext, areplacewith: string);
var
FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, format,
MatchAllWordForms, Forward, Wrap, ReplaceWith, Replace, MatchByte: olevariant;
found: boolean;
matchkashida,matchdiacritics,matchalefhamza,matchcontrol:olevariant;
begin
FindText := afindtext;
Replacewith := areplacewith;
Forward := True;
Wrap := wdFindContinue;
Format := False;
MatchCase := False;
MatchWholeWord := False;
MatchWildcards := False;
MatchSoundsLike := False;
MatchAllWordForms := False;
MatchByte := True;
replace := true;
matchkashida:=false; matchdiacritics:=false;
matchalefhamza:=false; matchcontrol:=false; repeat
until wordapplication1.Selection.Find.Execute(FindText, MatchCase,
MatchWholeWord, MatchWildcards, MatchSoundsLike, MatchAllWordForms,
Forward, Wrap, Format, ReplaceWith, Replace,matchkashida,
matchdiacritics,matchalefhamza,matchcontrol) = false;
end;procedure TForm1.Button6Click(Sender: TObject);
begin
wordapplication1.Disconnect;
wordapplication1.Quit;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货