Page 1 of 1

I can't save a RichView into a Field

Posted: Fri Nov 14, 2008 9:09 pm
by perellopis
Hi.

I have a batch importing from HTML mails, using a RVHtmlImporter and a RichView.

I save every imported file using a stored procedure :

Code: Select all

ImportMessageToRichView;
spEmail.Prepare;
spEmail.ParamByName('FROM').AsString := Msg.From.Address;
spEmail.ParamByName('FOR').AsString := Msg.Recipients.EMailAddresses;
spEmail.ParamByName('DATE').AsDateTime := Msg.Date;
spEmail.ParamByName('ABOUT').AsString := Msg.Subject;
Stream := TMemoryStream.create;
try
  RichView1.SaveRVFToStream(Stream, False);
  Stream.Seek(0, soFromBeginning);
  spEmail.ParamByName('MESSAGE').LoadFromStream(Stream);
finally
  Stream.Free;
end;
spEmail.ExecProc;
But when I try to view this html mails, in a TDBRichEdit, I don't get the message, I get his hexadecimal content. Someting like :
-8 1 3
-9 0 0 0 0 0 7
1 1 0 0 0 0
From:
0 1 -1 1 0 0
Tropical News [mailto:[email protected]]
1 1 0 0 0 0
Sended:
0 1 -1 1 0 0
lunes, 03 de noviembre de 2008 16:12
1 1 0 0 0 0
For:
0 1 -1 1 0 0
[email protected]
1 1 0 0 0 0
About:
0 1 -1 1 0 0
Specia Packl 5 + 1
-60 3 1 0 2 0

1
4
¿ What am I doing wrong ?

Thank you.

Posted: Sat Nov 15, 2008 8:46 am
by Sergey Tkachenko
It is saved, but loaded as a plain text, because reading in RVF format failed.
It happens because the document was saved without text, paragraph and list styles. In this mode, it can be loaded only to TRichView having exactly the same collections of styles.
To fix this problem, double click RichView1 in Delphi, choose "Settings" in the popup menu and select "allow adding styles dynamically".

Posted: Tue Nov 18, 2008 5:54 pm
by perellopis
Thank you, now it works nicely.

Posted: Mon Nov 24, 2008 12:40 pm
by StevieO
Sergey Tkachenko wrote:It is saved, but loaded as a plain text, because reading in RVF format failed.
It happens because the document was saved without text, paragraph and list styles. In this mode, it can be loaded only to TRichView having exactly the same collections of styles.
To fix this problem, double click RichView1 in Delphi, choose "Settings" in the popup menu and select "allow adding styles dynamically".
How to do this with SRichView ???
I've the same Problem...

Posted: Mon Nov 24, 2008 3:11 pm
by Sergey Tkachenko
Make sure that DBSRichViewEdit.RVFOptions property includes rvfoSaveTextStyles and rvfoParaStyles, and
DBSRichViewEdit.RVFTextStylesReadMode = DBSRichViewEdit.RVFParaStylesReadMode = rvf_sInsertMerge.

Posted: Mon Nov 24, 2008 3:43 pm
by StevieO
Sergey Tkachenko wrote:Make sure that DBSRichViewEdit.RVFOptions property includes rvfoSaveTextStyles and rvfoParaStyles, and
DBSRichViewEdit.RVFTextStylesReadMode = DBSRichViewEdit.RVFParaStylesReadMode = rvf_sInsertMerge.
Must I use the TDBSRichViewEdit ???
Could not use the TSRichViewEdit ???
I dont need the direkt datalink from TDBSRichViewEdit... ???

Thanks!

Posted: Mon Nov 24, 2008 4:02 pm
by Sergey Tkachenko
You can use TSRichViewEdit.RichViewEdit.SaveRVFToStream to save to the field.

Posted: Mon Nov 24, 2008 4:33 pm
by StevieO
Sergey Tkachenko wrote:You can use TSRichViewEdit.RichViewEdit.SaveRVFToStream to save to the field.
The Parameters are OK!

Yes of course but there is the problem with the data:

-8 1 3
-7 0 -1 0 0 0 0 -16777211
-9 2 0 0 2 0 1
Style
¢

??? :-)