Problem with SaveRVFToStream and LoadRVFFromStream Functions
Problem with SaveRVFToStream and LoadRVFFromStream Functions
Forgive my English; I start with the LoadRVFFromStream function, I try to load the information stored in database (Firebird 2.5) from a blob field of sub_type 0, using the following form:
st: = TMemoryStream.Create;
FDQuery1.Close;
FDQuery1.SQL.Clear;
FDQuery1.Open ('Select * from tests');
// TSQLBlobStream (FDQuery1.FieldByName ('text')). SaveToStream (st);
// TBlobField (FDQuery1.FieldByName ('text').) SaveToStream (st);
st: = FDQuery1.CreateBlobStream (FDQuery1.FieldByName ('text'), bmRead);
St.Position: = 0;
// st.Seek (0,0);
RichViewEdit1.LoadRVFFromStream (st);
St.Free;
Which does not happen, that is, it does not load anything.
Or this way
st := TStream.Create;
FDQuery1.Close;
FDQuery1.SQL.Clear;
FDQuery1.Open('Select * from pruebas');
// TSQLBlobStream(FDQuery1.FieldByName('texto')).SaveToStream(st);
// TBlobField(FDQuery1.FieldByName('texto')).SaveToStream(st);
st := FDQuery1.CreateBlobStream(FDQuery1.FieldByName('texto'),bmRead);
st.Position := 0;
// st.Seek(0,0);
RichViewEdit1.LoadRVFFromStream(st);
st.Free;
I throw the following error. Raised exception class EStreamError with message 'TStream.Seek not implemented'
I have reviewed the examples they recommend from this forum and it does not work. What am I doing wrong?
As for the function SaveRVFToStream, it does not generate error in fact in the database stores the information but I do not know how to check this, I simply store it in bold but when trying to load it I do not know if it stores well.
The control I'm using the RichViewEdit
st: = TMemoryStream.Create;
FDQuery1.Close;
FDQuery1.SQL.Clear;
FDQuery1.Open ('Select * from tests');
// TSQLBlobStream (FDQuery1.FieldByName ('text')). SaveToStream (st);
// TBlobField (FDQuery1.FieldByName ('text').) SaveToStream (st);
st: = FDQuery1.CreateBlobStream (FDQuery1.FieldByName ('text'), bmRead);
St.Position: = 0;
// st.Seek (0,0);
RichViewEdit1.LoadRVFFromStream (st);
St.Free;
Which does not happen, that is, it does not load anything.
Or this way
st := TStream.Create;
FDQuery1.Close;
FDQuery1.SQL.Clear;
FDQuery1.Open('Select * from pruebas');
// TSQLBlobStream(FDQuery1.FieldByName('texto')).SaveToStream(st);
// TBlobField(FDQuery1.FieldByName('texto')).SaveToStream(st);
st := FDQuery1.CreateBlobStream(FDQuery1.FieldByName('texto'),bmRead);
st.Position := 0;
// st.Seek(0,0);
RichViewEdit1.LoadRVFFromStream(st);
st.Free;
I throw the following error. Raised exception class EStreamError with message 'TStream.Seek not implemented'
I have reviewed the examples they recommend from this forum and it does not work. What am I doing wrong?
As for the function SaveRVFToStream, it does not generate error in fact in the database stores the information but I do not know how to check this, I simply store it in bold but when trying to load it I do not know if it stores well.
The control I'm using the RichViewEdit
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
May be RVF was saved without information about text and paragraph styles, or they are ignored on reading.
Make sure that rvfoSaveTextStyles and rvfoSaveParaStyles are included in RVFOptions of the editor that saves data, and RVFParaStylesReadMode = RVFTextStylesReadMode = rvf_sInsertMerge for the editor that loads data.
The simplest way to set the proper property values is right clicking on the editor at designtime, choosing "Settings" in the context menu, then setting "Allow adding styles dynamically" in the dialog.
Also, make sure that each editor is linked to its own TRVStyle component.
If your RVF was saved without text and paragraph styles, it's not possible to restore them, you need to recreate the document with the proper property settings.
Make sure that rvfoSaveTextStyles and rvfoSaveParaStyles are included in RVFOptions of the editor that saves data, and RVFParaStylesReadMode = RVFTextStylesReadMode = rvf_sInsertMerge for the editor that loads data.
The simplest way to set the proper property values is right clicking on the editor at designtime, choosing "Settings" in the context menu, then setting "Allow adding styles dynamically" in the dialog.
Also, make sure that each editor is linked to its own TRVStyle component.
If your RVF was saved without text and paragraph styles, it's not possible to restore them, you need to recreate the document with the proper property settings.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Can you create a simple project reproducing the problem and send it to me to richviewgmailcom?
If not, please save the content of this database field as send to me
If not, please save the content of this database field as send to me
Code: Select all
var Stream: TMemoryStream;
FileStream: TFileStream;
Stream := TMemoryStream.Create;
(Table.FiedByName(FieldName) as TBlobField).SaveToStream(Stream);
Stream.Position := 0;
FileStream := TFileStream.Create(FileName, fmCreate);
FileStream.CopyFrom(Stream, 0);
FileStream.Free;
Stream.Free;
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: