-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
Table Styling and Formatting should work for non-js use cases #300
Comments
Short answer: Long answer: This brings several limitations. If you would run the code above without Send-MailMessage and simply use -ShowHTML switch for New-HTML you may see that it actually does what it should, but once you push it to email things get side ways for two reasons. No JS in Email Clients, and CSS support in emails is some crippled version that needs 50 workarounds to be usable. We should get those commands such as style, column options to be applicable to all 3 options - but it requires lots of testing and different approaches. New-HTMLTableContent should work but it's pretty heavy to be honest. |
I ended up using this:
You still have to define the font/formatting twice. Once per table and once per the Span but I can live with that. |
You can use FontSize 12px or 12pt depending what you want. If you provide int it forces it to px hence the behavior. There is translation process below it. Also it's possible to use other values 1em, or percentages. Basically whatever CSS provides. But email is special so your output may vary. Email CSS is really bad, so test test test. |
I think you could use EmailBody {
New-HTMLTable
} -FontSize 16 To get what you need without the new-htmltablecontent. EmailBody uses a bit different code and gets rid of any JS code which is useless anyways. |
Thanks a lot. Ended up using EmailBody. |
Not at the moment, but lets leave this open and I'll keep thinking about it. TableStyling should work for non-js use cases |
I have issues related to formatting:
I tried to use New-HTMLTableStyle with hopes that I could set my fonts for whole table in one place but it does not work and I have to set the fonts by using New-HTMLTableHeader and New-HTMLTableContent. That way I can actually set the font type but custom font size never works.
The text was updated successfully, but these errors were encountered: