RichViewEdit追加到:lx.rtf(100)

H

hwsh

Unregistered / Unconfirmed
GUEST, unregistred user!
用RichViewEdit1.SaveRTF('lx.rtf',false)时是将lx.rtf文件清空后将RichViewEdit1中的数据添加进去,能否追加到原lx.rtf文件的尾部,即是追加而不是覆盖。例如我想保留lx.rtf文件中的页眉和页脚
 
H

hs-kill

Unregistered / Unconfirmed
GUEST, unregistred user!
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;
 
Z

zhengct

Unregistered / Unconfirmed
GUEST, unregistred user!
lx.rtf很大吗?先读进来合并了再写出不就行了
 

Similar threads

D
Replies
0
Views
63
DelphiTeacher的专栏
D
D
Replies
0
Views
65
DelphiTeacher的专栏
D
D
Replies
0
Views
72
DelphiTeacher的专栏
D
D
Replies
0
Views
51
DelphiTeacher的专栏
D
Top Bottom