BLOB ---> RichviewEdit

General TRichView support forum. Please post your questions here
Post Reply
mbailey
Posts: 14
Joined: Tue Oct 11, 2005 5:55 am
Location: Perth, Western Australia

BLOB ---> RichviewEdit

Post by mbailey »

Hi,

This may be a really dumb question but I am curious.

I have a database with RTF files stored as BLOBS.

I have an ActiveX control of RichviewEdit in the database application.

Currently, to get the RTf file into Richview I need to copy the Blob to a physical file on a harddisk and then use LoadRTF in Richview.

Is it possible to somehow pass the Blob directly to Richview?

TIA
Mark
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Code: Select all

var Stream: TStream;
begin
  Stream := Table.CreateBlobStream(Table.FieldByName(FieldName), bmRead);
  try
    rv.Clear;
    rv.DeleteUnusedStyles(True,True,True);
    Result := rv.LoadRTFFromStream(Stream);
  finally
    Stream.Free;
  end;
  rv.Format;
end;
mbailey
Posts: 14
Joined: Tue Oct 11, 2005 5:55 am
Location: Perth, Western Australia

Post by mbailey »

Hi Sergey,

Thanx for that. I cannot point directly to a table column though.

I will be passing a Blob variable itself.

Ta.
Mark
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If you only have Field: TBlobField, you can get table as Field.DataSet, then use the code above.
Post Reply