none
Intermittent bug encountered using Outlook's Inspector WordEditor for High-Fidelity RTF to HTML conversion RRS feed

  • Question

  • Hi All,

    The below VBA script code (transcribed from our .NET Outlook addin code) iterates through the currently selected items in the active Outlook Explorer window and employs the Inspector's WordEditor to save the content in filtered HTML.

    It effectively converts Rich Text Format (RTF) email body into its equivalent WYSIWYG web browser compatible HTML format - e.g. table layouts and OLE attachment icons embedded into table cells are faithfully rendered in HTML (except that the icons are not clickable).

    Unfortunately, it occasionally fails quietly and simply saves out the HTML of the most recently processed/viewed email.

    It sometimes takes lots of attempts before this issue surfaces, but we noticed that testing with large RTF emails with embedded images and attachments can increase the probability of occurrence.

    We suspect that this intermittent bug may be due to a race condition issue whereby the WordEditor is not yet ready to execute the SaveAs method, possibly because the content is still being loaded or processing?

    

    Regards,
    Jarrod

    Wednesday, July 11, 2018 3:29 PM

All replies

  • Just realized that I should have inserted a code block instead of an image:

    Public Sub RTF2HTML()
        Set Selection = Application.ActiveExplorer.Selection
        For i = 1 To Selection.Count
            Set Mail = Selection.Item(i)
            Set Inspector = Mail.GetInspector
            Set WordEditor = Inspector.WordEditor
            WordEditor.WebOptions.AllowPNG = True
            WordEditor.WebOptions.Encoding = 65001  ' Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8
    
            ' Remove illegal characters from filename (just colon and question mark for adhoc testing)
            FileName = Replace(Mail.Subject, ":", "")
            FileName = Replace(FileName, "?", "")
            
            ' FileFormat:=10 ~ Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatFilteredHTML
            Call WordEditor.SaveAs(FileName:="E:\RTF2HTML\" & i & "-" & FileName & ".HTM", FileFormat:=10)
        Next
    End Sub

    Wednesday, July 11, 2018 3:33 PM
  • Hi Jarrodwee,

    Thanks for reporting this issue. Since the issue is complex, I suggest you contacting Microsoft support to raise an incident so that our engineer could work closely with him to identify the root cause and resolve this issue as soon as possible.

    If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged.

    Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Regards & Fei

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 18, 2018 7:07 AM
    Moderator