Hi,
How can I save the whole text wich is written in a richViewEdit with it'a format into database.
Thanks in advance.
RichView 2 DB
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Code: Select all
function SaveRVFToField(rv: TCustomRichView; tbl: TDataSet;
const FieldName: String): Boolean;
var Stream: TStream;
begin
Stream := tbl.CreateBlobStream(tbl.FieldByName(FieldName), bmWrite);
try
Result := rv.SaveRVFToStream(Stream, False);
finally
Stream.Free;
end;
end;
Example:
table.Edit;
SaveRVFToField(RichView1, Table1, 'Document');
table.Post;
Demos\Delphi\DB Demo\2 RichViewEdit\
Last edited by Sergey Tkachenko on Tue Sep 05, 2006 5:05 pm, edited 1 time in total.
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Code: Select all
var Stream: TStream;
begin
Stream := tbl.CreateBlobStream(tbl.FieldByName(FieldName), bmRead);
try
Result := rv.LoadRVFFromStream(Stream);
rv.Format;
finally
Stream.Free;
end;
end;
If you are not sure about format, use LoadFromStream(Stream, rvynaNo) instead of LoadRVFFromStream
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
You can change to SaveRTFToStream and LoadRTFToStream.
TADOTable is derived from TDataSet, like TTable.
The only used method of table is CreateBlobStream, it is introduced in TDataSet (and, according to the help file, implemented in TCustomADODataSet, ancestor of TADOTable)
If this method does not work, the chosen field type is incorrect for TRichView. It must be of BLOB type.
TADOTable is derived from TDataSet, like TTable.
The only used method of table is CreateBlobStream, it is introduced in TDataSet (and, according to the help file, implemented in TCustomADODataSet, ancestor of TADOTable)
If this method does not work, the chosen field type is incorrect for TRichView. It must be of BLOB type.