Search code examples
htmloutlookms-word

Outlook conditional html formatting (if mso)


It isn't clear to me if code such as the following is unique to Outlook only:

<p><!--[if mso]><br><![endif]--></p>

Looking up info re "mso" I find that it means "MS Office", however all the examples on the web refer to Outlook being the target for this conditional html code.

Q: Does MS Word or OneNote also generate conditional html as above? Or is it unique to MS Outlook?

Update (again): I tried copying from MS Word and Outlook programs and it does make use of the conditional formatting, however it looks different to the conditional formatting I gave earlier. We are trying to figure out what actually generated the above example which was submitted by a student and it looks like they copied from MS Word or an email.

By copying text into Drupal I've found both MS Word and Outlook programs produce this code:

<p class="MsoNormal">1<br> 2</p>
<p>&nbsp;</p>
<p class="MsoNormal">3</p>
<p>&nbsp;</p>
<p><!-- [if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:AllowPNG />
 </o:OfficeDocumentSettings>
</xml><![endif]--><!-- [if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:TrackMoves />
  <w:TrackFormatting />
  <w:PunctuationKerning />
... and it just keeps going with 600+ lines of Word generated code..

Meanwhile Outlook Webmail (outlook.office365.com) generated html like this:

<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: #000000;">1</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: #000000;">&nbsp;</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: #000000;">2</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: #000000;">&nbsp;</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: #000000;">3<br><br>4</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: #000000;">&nbsp;</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: #000000;"><br>

Source Found: We eventually found the source of the code - Matlab Online. Strange for a non MS product to produce the "mso" tags, but it clearly does when using Firefox and Chrome browsers (but not in Safari).


Solution

  • HTML in Outlook is rendered and edited by Word (there is a Word-light dll used by Outlook), so yes, both Outlook and Word use it.