function link2(s1,s2:string):string;var p:integer;begin p:=LastDelimiter('}',s1); if p>0 then s1:=copy(s1,1,p-1) else s1:='{'+s1; p:=Pos('{',s2); if p>0 then Delete(s2,1,p) else s2:=s2+'}'; result:=s1+s2;end;//保存var strs1, strs2, strs3:tstringlist;begin //假设文件放到D盘 RichEdit1.Lines.LoadFromFile('d:/temp.rtf'); //存个临时文件 strs1:=TStringList.Create; strs2:=TStringList.Create; strs3:=tstringlist.Create; try strs1.LoadFromFile('d:/lx.rtf'); strs2.LoadFromFile('d:/'temp.rtf'); strs3.Text:=link2(strs1.Text, strs2.Text); strs3.SaveToFile('d:/lx.rtf'); finally deletefile('d:/temp.rtf'); strs1.Free; strs2.Free; strs3.Free; end;end;