none
Why does Outlook 2007 sometimes ignore css font-family, and only heed <font> tag? RRS feed

  • Question

  • I'm using Exchange Web Services (via Java, not a managed API) to create a calender appointment. I set the HTML body using the element as documented here:

    http://msdn.microsoft.com/en-us/library/exchange/aa581015(v=exchg.140).aspx

    This works fine for most email clients, but in some installations of Outlook 2007 it just ignores the font-family. For example a body like this:

      <html><head></head><body>
         <span style='font-family:serif'>Times</span>
      </body></html>

    renders correctly as serif font in one copy of Outlook 2007, but in another installation in renders as Arial 12pt. I've tried all kinds of combinations of styles, inline, in the header. Nothing convinces Outlook to render the font-family, unless I use a font tag from the 1990s.

      <font face='Times New Roman' size='3' />

    This would "work" well enough for me, but I need 11pt font.  Size 3 is becoming 12pt, and size 2 is becoming 10pt.  Putting a size on the font also fails:

      <font face='...' style='font-size:11pt' > ...

    How can I specify the font correctly for Outlook? Why is it being so difficult and ignoring basic HTML and CSS?

    Wednesday, May 22, 2013 1:13 AM

Answers

  • The body of an appointment item does not support HTML, it uses Rich Text format. In the Outlook object model there is no AppointmentItem.HTMLBody, there's only a Body (plain text) or RTFBody (Rich text).
     
    I rarely use EWS, but I'd imagine that there's some sort of compatibility problem between how EWS is handling the bodies of appointments and how Outlook is handling them.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Robert Ni" <=?utf-8?B?Um9iZXJ0IE5p?=> wrote in message news:64b046b1-1674-49b4-9876-3bb7d60e57a0...
    Unfortunately, those sites don't help.  They claim that font-family and font-size are supported, but in my case, they are being ignored. They offer no guidance as to why this might happen and how to change it. I know I'm not the only one seeing this problem -- I've found other similar questions around the web while researching this problem. Perhaps it's triggered because I'm creating through Exchange a CalendarItem, as opposed to a Message. I'll be looking into that today.


    Ken Slovak MVP - Outlook
    Wednesday, May 22, 2013 1:53 PM
    Moderator

All replies

    • Edited by Ole K Wednesday, May 22, 2013 10:46 AM
    Wednesday, May 22, 2013 10:45 AM
  • Unfortunately, those sites don't help.  They claim that font-family and font-size are supported, but in my case, they are being ignored. They offer no guidance as to why this might happen and how to change it. I know I'm not the only one seeing this problem -- I've found other similar questions around the web while researching this problem. Perhaps it's triggered because I'm creating through Exchange a CalendarItem, as opposed to a Message. I'll be looking into that today.

    • Edited by Robert Ni Wednesday, May 22, 2013 12:50 PM grammar
    Wednesday, May 22, 2013 12:49 PM
  • The body of an appointment item does not support HTML, it uses Rich Text format. In the Outlook object model there is no AppointmentItem.HTMLBody, there's only a Body (plain text) or RTFBody (Rich text).
     
    I rarely use EWS, but I'd imagine that there's some sort of compatibility problem between how EWS is handling the bodies of appointments and how Outlook is handling them.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Robert Ni" <=?utf-8?B?Um9iZXJ0IE5p?=> wrote in message news:64b046b1-1674-49b4-9876-3bb7d60e57a0...
    Unfortunately, those sites don't help.  They claim that font-family and font-size are supported, but in my case, they are being ignored. They offer no guidance as to why this might happen and how to change it. I know I'm not the only one seeing this problem -- I've found other similar questions around the web while researching this problem. Perhaps it's triggered because I'm creating through Exchange a CalendarItem, as opposed to a Message. I'll be looking into that today.


    Ken Slovak MVP - Outlook
    Wednesday, May 22, 2013 1:53 PM
    Moderator
  • Okay, I'll try to find a different way to send the meeting requests and cancellations via web services. Instead just calling UpdateItem, maybe I can manually create an email Message and somehow attach the CalendarItem to it, giving me more control over the email body. I don't know how to do that yet. I will post back if I find a work around this way.
    Wednesday, May 22, 2013 7:05 PM