Loading files together

General TRichView support forum. Please post your questions here
Post Reply
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Loading files together

Post by Ceprotec »

Hello Sergey.

I'm having the following problem: how do I open files saved SrichView bringing two separate? I say, I saved in the database with SQL Server binary format, and with property SaveRVFToStream. For example I record two separate models, and would like to these two models together, one below the other, on separate sheets within the same SrichView. How do I do that?

Thanks.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

See http://www.trichview.com/forums/viewtopic.php?t=272
Use SRichViewEdit1.RichViewEdit as rv parameter.
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

I used:

AddDoc procedure (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;

But he's TCustomRichView error? As stated?
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Did you add "RichView" in "uses"?
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

Ok :)
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

Yes it opens the files if they are saved in C: /.
But I have the files saved in the database SQL SERVER 2000. Normally I use the following code to load:

Stream: = Table1.CreateBlobStream (Table1MODELO, bmRead);
SRichViewEdit1.RVHeader.Clear;
SRichViewEdit1.RVFooter.Clear;
SRichViewEdit1.RichViewEdit.Clear;
SRichViewEdit1.RichViewEdit.LoadRVFFromStream (Stream);
Stream.Free;
SRichViewEdit1.RVHeader.Format;
SRichViewEdit1.RVFooter.Format;
SRichViewEdit1.SetRVMargins;

how I would combine the two functions: to charge and to unite them?
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Instead of creating/destroying TFileStream for a file, use this stream.

Code: Select all

procedure AddDoc(Stream: TStream; rv: TCustomRichView); 
var ItemCount: Integer; 
begin 
  ItemCount := rv.ItemCount; 
  Stream.Position := 0;
  rv.InsertRVFFromStream(Stream, rv.ItemCount); 
  if (ItemCount>0)  and (ItemCount<rv.ItemCount) then 
    rv.PageBreaksBeforeItems[ItemCount] := True; 
end;

SRichViewEdit1.Clear; 

Stream: = Table1.CreateBlobStream (Field1, bmRead); 
AddDoc(Stream, SRichViewEdit1.RichViewEdit);
Stream.Free; 

Stream: = Table1.CreateBlobStream (Field2, bmRead); 
AddDoc(Stream, SRichViewEdit1.RichViewEdit);
Stream.Free; 

SRichViewEdit1.Format; 
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

Thank you! :D
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

I wonder what component brings up the page number at the bottom, because I need to remove it??
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

SRichViewEdit1.PageProperty.PageNoVisible := False.
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

Thanks
Post Reply