Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML rendering in Outlook not the same as in web browsers #3

Open
janegilring opened this issue Oct 2, 2015 · 10 comments
Open

HTML rendering in Outlook not the same as in web browsers #3

janegilring opened this issue Oct 2, 2015 · 10 comments

Comments

@janegilring
Copy link

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 jan@domain.com -From ps@domain.com -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:

example

@McAndersDK
Copy link

Outlook use Word for viewing. blame Microsoft :)

@iainbrighton
Copy link
Owner

iainbrighton commented Apr 18, 2016

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..

@iainbrighton
Copy link
Owner

@janegilring @McAndersDK Apologies for the delay 😊. 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 😃. Any problems let me know.

@McAndersDK
Copy link

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

@iainbrighton
Copy link
Owner

@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.

@janegilring
Copy link
Author

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).

@iainbrighton
Copy link
Owner

@janegilring I'll need to check that out. Presumably there's something more fundamental in the styles (not) being rendered incorrectly by Outlook (grrr)

@iainbrighton iainbrighton reopened this May 27, 2016
@iainbrighton
Copy link
Owner

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..

@janegilring
Copy link
Author

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.

@itadder
Copy link

itadder commented Nov 6, 2019

Any Update to support Save to HTML feature in Microsoft Word?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants