Re: RTF Conversion Error
- From: "Dmitry Streblechenko" <dmitry@xxxxxxxxxxx>
- Date: Sun, 16 Mar 2008 00:40:19 -0700
What do you see for PR_BODY and PR_RTF_COMPRESSED in OutlookSpy or MFCMAPI?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"BenM" <nospam@xxxxxxxxxx> wrote in message
news:%23yNVSBZhIHA.4376@xxxxxxxxxxxxxxxxxxxxxxx
Hi Dmitry, and thanks for having a look.
Yes. To the best of my knowledge, PR_BODY is set correctly. That is, it is
set to the plain text version of the message, and it appears as such when
querying the message content later.
The general sequence of events is
1) Set PR_BODY to the text message.
2) Set PR_MSG_EDITOR_FORMAT to 2
3) Set PR_BODY_HTML to the html encoded version of the message, which
consists of the html signature, with the html version of the text message
inserted, surrounded by <p> and </p>, after the opening <body..> tag.
4) Set PR_RTF_COMPRESSED to the rtf version of the message, which is
effectively PR_BODY_HTML, converted to RTF using the technique described
earlier. Also note that RTF is written using a stream and
WrapCompressedRTFStream as described in the documentation.
The process above seems to work well apart from this oddball \par <P>
appearing in the translated html.
Regards,
Ben
"Dmitry Streblechenko" <dmitry@xxxxxxxxxxx> wrote in message
news:OOvtwNYhIHA.3940@xxxxxxxxxxxxxxxxxxxxxxx
Are you sure PR_BODY is correctly set?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"BenM" <nospam@xxxxxxxxxx> wrote in message
news:eNF$Q0XhIHA.6136@xxxxxxxxxxxxxxxxxxxxxxx
Hi all,
I have come across a problem with an html message sent by my program to
an Outlook 2003 client. The client displays the message correctly, but
when the message is received, the small 'preview' tooltip (screenshot
attached) displays part of the raw message code.
The relevant section of the signature's html (which we are reading from
C:\Documents and Settings\UserName\Application
Data\Microsoft\signatures) is in the <head></head> section and looks
like:
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
As Outlook seems to use PR_RTF_COMPRESSED to generate PR_HTML rather
than use the html version I have supplied, my code (also attached)
converts the html message, including the signature, to RTF, and this
code block is converted to
{\\*\\htmltag0 <!--[if !mso]>}
{\\*\\htmltag0 \\par }
{\\*\\htmltag0 <style>}
{\\*\\htmltag0 \\par }v\\\\:* \\{behavior:url(#default#VML);\\}
{\\*\\htmltag0 \\par }o\\\\:* \\{behavior:url(#default#VML);\\}
But, when Outlook then converts this RTF to HTML it adds what appears to
be a spurious \par <P> in the middle.
{\*\htmltag241 <!--[if !mso]>\par <style>\par \par <P>v\\:*
\{behavior:url(#default#VML);\}\par o\\:*
\{behavior:url(#default#VML);\}\par (.)
If, however, I generate the same message within Outlook itself, the same
rtf line appears fine:
{\*\htmltag241 <!--[if !mso]>\par <style>\par v\\:*
\{behavior:url(#default#VML);\}\par o\\:*
\{behavior:url(#default#VML);\}\par (.)
The assumption being that the preview tooltip is encountering the <P>
and displaying the "message" that follows. The question is: How can we
get rid of the <P>? Is there a way adequately generate RTF from an HTML
message so that this sort of thing does not happen?
The HTML to RTF routine is attached and is derived from various examples
I found on the internet that attempted to achieve this same goal.
Any advice would be much appreciated.
Best Regards,
Ben
.
- References:
- Re: RTF Conversion Error
- From: Dmitry Streblechenko
- Re: RTF Conversion Error
- From: BenM
- Re: RTF Conversion Error
- Prev by Date: Re: Cant see images within attachment
- Next by Date: Re: Cant see images within attachment
- Previous by thread: Re: RTF Conversion Error
- Next by thread: Failed to connect to PST file using MAPI
- Index(es):
Relevant Pages
|