Quantcast
Channel: Aspose.Email Product Family
Viewing all articles
Browse latest Browse all 1367

RTF Conversion Problems when text starts with a number

$
0
0
I am attempting to build an email given an RTF body and will then save the message as an MSG file to be opened in Outlook. The problem I am having is that I convert the RTF body to html then set it as the email body. When I look at the html, it's fine and can be opened in any web browser. When I open the MSG file in Outlook, the body of the email is empty. It appears that when Aspose is converting html to compressed rtf, it is doing so incorrectly.Looking at the PR_RTF_COMPRESSED property tag in the MSG file you will see that the text is adjacent to the tag (below will be an example). I think this is what appears to be the problem.

I have attached a zip file with
  • the original rtf body (body.rtf)
  • the converted html body (body.html)
  • the resulting email message snapshot.msg

The conversion code snippet is this:

    public static String convertRTFBody2Html(String body) {
        MapiMessage mapi = new MapiMessage();
        mapi.setBodyRtf(body);
       
        MailMessageInterpretor mi = MailMessageInterpretorFactory.getInstance().getIntepretor(MapiMessage.class.getName());
        MailMessage mailMessage = mi.interpret(mapi);
       
        return mailMessage.getHtmlBody();
    }

Original RTF line:

{\*\htmltag64 <p class="MsoNormal">}\htmlrtf {\htmlrtf0 1.duplicate attachments

Converted RTF line:

{\*\htmltag64 <p class="MsoNormal">}\htmlrtf {\htmlrtf01.duplicate attachments

It appears that when the line of text starts with a number and there is no space between the start of the line and the end of the "\htmlrtf0" tag, the number will be mistaken as part of the tag. So the rendering engine seems to be looking for "\htmlrtf0" but is finding "\htmlrtf01" and is not correctly rendering the text properly.


Viewing all articles
Browse latest Browse all 1367

Trending Articles