Demos, code samples. Only questions related to the existing topics are allowed here.
Sergey Tkachenko
Site Admin
Posts: 17559 Joined: Sat Aug 27, 2005 10:28 am
Contact:
Post
by Sergey Tkachenko » Tue Oct 25, 2005 9:20 pm
Code: Select all
procedure AddDoc(const FileName: String; rv: TCustomRichView);
var Stream: TFileStream;
begin
Stream := TFileStream.Create(FileName, fmOpenRead);
rv.InsertRVFFromStream(Stream, rv.ItemCount);
Stream.Free;
end;
...
RichView1.Clear;
RichView1.DeleteUnusedStyles(True, True, True);
AddDoc('c:\file1.rvf', RichView1);
AddDoc('c:\file2.rvf', RichView1);
AddDoc('c:\file3.rvf', RichView1);
RichView1.Format;
If you want to add page breaks between documents, use the following code
Code: Select all
procedure AddDoc(const FileName: String; rv: TCustomRichView);
var Stream: TFileStream;
ItemCount: Integer;
begin
ItemCount := rv.ItemCount;
Stream := TFileStream.Create(FileName, fmOpenRead);
rv.InsertRVFFromStream(Stream, rv.ItemCount);
Stream.Free;
if (ItemCount>0) and (ItemCount<rv.ItemCount) then
rv.PageBreaksBeforeItems[ItemCount] := True;
end;
Last edited by
Sergey Tkachenko on Fri Aug 24, 2007 5:12 pm, edited 1 time in total.
Guest
Post
by Guest » Thu Nov 24, 2005 10:49 am
Hello Sergey,
How can I combine several RTFs into a single file - the example is only for RVFs & I cannot see any procedure like InsertRTFFromStream...
Thanks,
Fiachra
Guest
Post
by Guest » Thu Nov 24, 2005 3:10 pm
Don't worry about that question Sergey,
I've gotten around it by loading my RTFs (one at a time) into a RichView and saving them as RVFs which I then load as per your original example. It's a bit convoluted but it works!
Thanks anyway,
Fiachra
Sergey Tkachenko
Site Admin
Posts: 17559 Joined: Sat Aug 27, 2005 10:28 am
Contact:
Post
by Sergey Tkachenko » Thu Nov 24, 2005 8:59 pm
It's not necessary. You can use LoadRTF/LoadRTFFromStream.
Unlike LoadRVF/LoadRVFFromStream they
- do not clear trichview,
- cannot replace collection of styles, they can only add new styles.
So you can use them to load several documents.