HTML rendering in Outlook not the same as in web browsers
When sending HTML-reports via e-mail, the HTML is not rendered the same way in Outlook as a web browser.
Here is an example: $html = Get-Content '~\Desktop\PScribo Demo 1.html' Send-MailMessage -To [email protected] -From [email protected] -SmtpServer smtp.domain.com -Subject Test-report -BodyAsHtml -Body ($html | Out-String)
In the below image, e-mail content from Outlook is on the left while the same HTML-file viewed in a web browser is on the right side:

Outlook use Word for viewing. blame Microsoft :)
Just circling back around to this. I'm thinking of modifying the plugin architecture to make it easier to support different export options for each plugin. However, this should be (fairly) easy to implement. I'll just need to remove the outer <div> tag that provides the "page" look..
@janegilring @McAndersDK Apologies for the delay :blush:. There is now a Export-Document -Path ~\Desktop -Format Html -Options @{ NoPageLayoutStyle = $true } supported for HTML output that should fix this. Version 0.7.8 has been pushed to the PowerShell Gallery! Enjoy :smiley:. Any problems let me know.
not sure how this fix anything? :O) but the styling is just bad in outlook. and alwayse will as word is a bad HTML render. I would if I needed this to work in outlook, and have the same styling:
- open word with the docx export (COM.object)
- have word save it as HTML.
- email the bloated html result.
- profit
@McAndersDK If you have Word installed then that's certainly an option!
The problem with the HTML outputting was the 'page look-and-feel' CSS causing Outlook issues. The -Options @{ NoPageLayoutStyle = $true } export option turns this functionality off CSS styling off when generating the HTML.
I tried to add -Options @{ NoPageLayoutStyle = $true } to Export-Document when using the builtin Demo 2 for testing, but the issue seem to remain (Outlook 2016).
@janegilring I'll need to check that out. Presumably there's something more fundamental in the styles (not) being rendered incorrectly by Outlook (grrr)
OK - looks like I need to digest this to determine what's not being supported by Outlook. My gut feel is that this is probably due to lack of <div> and CSS support. There is a chance that this can't be easily fixed without breaking the existing HTML5 implementation..
I just noticed that the rendering in the Outlook.com mobile app also is broken. I`m generating a table with 10 lines for a daily report, and only 3 of them is visible in the app. The same mails looks fine in Outlook on a PC. The whole e-mail content also looks very small in the app. Tested on 2 different Android phones.
Any Update to support Save to HTML feature in Microsoft Word?