trichview.com

trichview.support




Re: LoadFromStream


Return to index


Author

Message

Sergey Tkachenko

Posted: 01/25/2002 18:49:43


> Nice new WEB Page, congratulations :)


Thanks


>

> I have a TDBRichViewEdit for editing a "ResultLetter" Table. I need load

> a RVF document from another table: "ModelsLetters". I'm not capable of

> do it: I've try with this

>

Function LoadRVFromField(DB_rv : TCustomRichView ;

>                            Fld : TBlobField    ) : Boolean ;

> var

>   TempStream : TBlobStream ;

> begin

>   TempStream := TBlobStream.Create(Fld , bmRead ) ;

>   Try

>     TempStream.Position := 0;

>     Result := DB_rv.LoadRVFFromStream(TempStream) ;

>   Finally

>     TempStream.Free;

>   End ;

> end ;

>


There is a more efficient way for this - just copy data from the field of

"ModelsLetters" to the field "ResultLetter" (via streams).

DBRichViewEdit will be updated automatically.


But if you want to do it via DBRichViewEdit


1) Call table.Edit at the beginning of this function (for table linked with

this DB_rv, i.e. "ResultLetter")

2) Call Change method of TDBRichViewEdit (TCustomRichView does not have this

method, so you'll need to change a type of DB_rv parameter in this

procedure). Calling of this method is required if you modify the contents of

DBRichViewEdit with methods like LoadRVFFromStream (i.e. introduced in

viewer).

3) If you want to save these changes to the table immediately, call

table.Post (for table linked with this DB_rv, i.e. "ResultLetter") at the

end of this procedure.

If not, call DB_rv.Format instead.







Powered by ABC Amber Outlook Express Converter