Hi, Sergey. Her is the problem. I use Access to save the RVF files. I`ve a field of type MEMO. But when I load a data from this fiel nothing is going on. Her is the code:
To Save:
main.bufer.SQL.Text := 'update documents set content="" where id_doc=1' ;
main.bufer.ExecSQL ;
ADOTable1.TableName := 'documents' ;
ADOTable1.Open ;
ADOTable1.First ;
ADOTable1.Edit ;
Stream := ADOTable1.CreateBlobStream(ADOTable1.FieldByName('content'), bmWrite);
try
RichViewEdit1.SaveRVFToStream(Stream, false);
finally
Stream.Free;
end;
ADOTable1.Post;
To Load:
ADOTable1.TableName := 'documents' ;
ADOTable1.Open ;
ADOTable1.First ;
Stream := ADOTable1.CreateBlobStream(ADOTable1.FieldByName('content'), bmRead);
try
RichView1.LoadRTFFromStream(Stream);
RichView1.Format;
finally
Stream.Free;
end;
DB Access + TRichView
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Copy content of the field to file and send to me
Code: Select all
ADOTable1.TableName := 'documents' ;
ADOTable1.Open ;
ADOTable1.First ;
Stream := ADOTable1.CreateBlobStream(ADOTable1.FieldByName('content'), bmRead);
try
FileStream := TFileStream.Create('c:\problem.rvf', fmCreate);
FileStream.CopyFrom(Stream, 0);
FileStream.Free;
finally
Stream.Free;
end;
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Possible reasons:
1) Memo field cannot contain binary data (the document is corrupted)
Solution: select another field type, or exclude rvfoSaveBinary from RichViewEdit1.RVFOptions
2) Styles are not saved with documents (document can be loaded only of RichViewEdit1.Style has the same collections of styles as they were on saving)
Solution: right click RichViewEdit1 in Delphi, choose "Settings", select "Allow adding styles dynamically". Make sure that no other RichView uses the same RVStyle component as RichViewEdit1.
1) Memo field cannot contain binary data (the document is corrupted)
Solution: select another field type, or exclude rvfoSaveBinary from RichViewEdit1.RVFOptions
2) Styles are not saved with documents (document can be loaded only of RichViewEdit1.Style has the same collections of styles as they were on saving)
Solution: right click RichViewEdit1 in Delphi, choose "Settings", select "Allow adding styles dynamically". Make sure that no other RichView uses the same RVStyle component as RichViewEdit1.
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: