Read RTF from Database Blobfield

I store RTF files in MSSQL using code below to read back into a RTF editor in VCL. I want to use the stored RTF as content for a FastReport, can't seem to work this one out....

var

DocStream : TStream;

 content: TBlobField;

begin

 // Get the field that contains the document content

 content := TBlobField(qryDoc.FieldByName('Content'));

 // Create the document content stream

 DocStream := qryDoc.CreateBlobStream(content,bmRead);

 try

  // Load the contents of the Editor window from the stream

  DocEditor.LoadDocument(DocStream,TdxRichEditDocumentFormat.OpenXml);

 finally

  // Tidy up

  DocStream.Free;

 end;

Leave a Comment