0

I need to send data to users in the form of table in a presentable format. I have the code which does it but unable to find why it doesnt show up on outlook desktop app. How can I work on it to ensure it works on outlook app as well?

I have already tried using hex code and colors like black grey red nothing worked.

table1.get_html_string(attributes={”border-top”:”2px solid #000000"})
print(table1)
<table frame="box" rules="all" border-top="2px solid #000000">
    <tr>

This table when sent over mail prints in table format but skips borders, only over Outlook Desktop App.Works fine over gmail and outlook when opened through browser

Louis Saglio
  • 1,120
  • 10
  • 20
mithraj
  • 3
  • 1
  • 2

1 Answers1

1

border-top works just fine in Outlook. You're css is not valid. Try this instead:

<table style="border-top: 2px solid #000000;">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>

Good luck.

gwally
  • 3,349
  • 2
  • 14
  • 28
  • This worked thanks much. I am not getting borders for table rows and columns. I am fetching the table from my excel sheet into a prettytable object and used table1.get_html_string(attributes={”style”:”border:2px solid #000000"}) method here how to specify the style for row tag as the attribute is appending to tag
    – mithraj Apr 16 '19 at 12:17
  • You didn't ask for a border around each cell, you asked for a border around a table. If you want borders for all cells, try ``. For the top of specific `td` cells, apply `style="border-top: 2px solid #000000;"` to each cell.
    – gwally Apr 16 '19 at 14:37
  • Yes I understand I have to apply to each cell but I am not creating a html page manually. table1.get_html_string(attributes={”style”:”border:2px solid #000000"}) this method is fetching the data from table1 and printing in table format but the attributes are applying to the table, how can I apply it to cells throught this method? – mithraj Apr 23 '19 at 07:14
  • @mithraj You haven't shared your html code of a full table, so how in the world do you expect us to help you? To get Outlook to work, you either need to make every table cell have a border `` or apply a border to each `td` where you want a border - `td style="mso-border-top-alt: solid #000000 2pt;"`. It's the only thing I have found that works consistently.
    – gwally Apr 23 '19 at 17:52
  • style="border-top: 2px solid #000000;" this helped me to solve one of the issue i.e., HTML rendering was working and same HMTL not working in while rendering in outlook. – Venkataramana Madugula Nov 05 '20 at 10:20