Page 1 of 1

BLOB ---> RichviewEdit

Posted: Sat Dec 03, 2005 10:04 pm
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

Posted: Sat Dec 03, 2005 10:13 pm
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;

Posted: Sat Dec 03, 2005 11:21 pm
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

Posted: Sun Dec 04, 2005 10:58 am
by Sergey Tkachenko
If you only have Field: TBlobField, you can get table as Field.DataSet, then use the code above.