I can't save a RichView into a Field

General TRichView support forum. Please post your questions here
Post Reply
perellopis
Posts: 6
Joined: Thu Nov 13, 2008 2:07 pm

I can't save a RichView into a Field

Post 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:information@imc.tropical.com]
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
pere_llop@hotmail.com
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.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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".
perellopis
Posts: 6
Joined: Thu Nov 13, 2008 2:07 pm

Post by perellopis »

Thank you, now it works nicely.
StevieO
Posts: 6
Joined: Tue Oct 07, 2008 4:05 pm

Post 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...
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Make sure that DBSRichViewEdit.RVFOptions property includes rvfoSaveTextStyles and rvfoParaStyles, and
DBSRichViewEdit.RVFTextStylesReadMode = DBSRichViewEdit.RVFParaStylesReadMode = rvf_sInsertMerge.
StevieO
Posts: 6
Joined: Tue Oct 07, 2008 4:05 pm

Post 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!
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can use TSRichViewEdit.RichViewEdit.SaveRVFToStream to save to the field.
StevieO
Posts: 6
Joined: Tue Oct 07, 2008 4:05 pm

Post 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
¢

??? :-)
Post Reply