Page 1 of 1

Loading files together

Posted: Tue Dec 07, 2010 10:20 am
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.

Posted: Tue Dec 07, 2010 1:30 pm
by Sergey Tkachenko
See http://www.trichview.com/forums/viewtopic.php?t=272
Use SRichViewEdit1.RichViewEdit as rv parameter.

Posted: Tue Dec 07, 2010 3:08 pm
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?

Posted: Tue Dec 07, 2010 3:17 pm
by Sergey Tkachenko
Did you add "RichView" in "uses"?

Posted: Tue Dec 07, 2010 3:30 pm
by Ceprotec
Ok :)

Posted: Tue Dec 07, 2010 3:41 pm
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?

Posted: Tue Dec 07, 2010 9:14 pm
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; 

Posted: Thu Dec 09, 2010 10:01 am
by Ceprotec
Thank you! :D

Posted: Sat Dec 11, 2010 11:35 am
by Ceprotec
I wonder what component brings up the page number at the bottom, because I need to remove it??

Posted: Sat Dec 11, 2010 1:36 pm
by Sergey Tkachenko
SRichViewEdit1.PageProperty.PageNoVisible := False.

Posted: Sat Dec 11, 2010 1:46 pm
by Ceprotec
Thanks