title: Outlook and Windows Live Mail show the html table differently (Outlook shows the undesired one, WLM shows the desired)
body: <p>I'm new to this field.  </p>
  
  <p>I have a table in an Excel file (xlsx). Using C#, I save it as html:   </p>
  
  <pre><code>`worksheet.SaveToHtml("the html file path destination");`  
  </code></pre>
  
  <p>Then I read the html file:  </p>
  
  <pre><code>`String htmlCode = File.ReadAllText("the html file path", Encoding.Default);`  
  </code></pre>
  
  <p>Then I just put it to the email body like this:  </p>
  
  <pre><code>mail.Body = "&lt;BR/&gt;&lt;font size=2 ...." + htmlCode + ".... &lt;/body&gt;";
  </code></pre>
  
  <p>The table is supposed to look this way:  </p>
  
  <p><img src="https://i.stack.imgur.com/LiPMg.jpg" alt="the desired (how it looks in Excel and WLM)"></p>
  
  <p>But when the email is opened in Outlook, it looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/u2CKY.jpg" alt="how it looks in Outlook"></p>
  
  <p>The columns are significantly smaller in width.<br>
  How to fix this? I don't want to directly code the html in the C#.</p>
  
  <p>UPDATE<br>
  This is how the html using WorkSheet.SaveToHtml looks like. I need to find what to change/add to make this table look right in Outlook.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
    &lt;head&gt;
      &lt;style type="text/css"&gt;table{border-collapse:collapse;table-layout:fixed;border-spacing:0;empty-cells:show}
  .X0{color:rgb(0,32,96);font-family:Calibri;font-size:11pt;background-color:rgb(218,238,243);border-top-color:000000;border-top-style:solid;border-top-width:2;border-bottom-color:000000;border-bottom-style:solid;border-bottom-width:2;border-left-color:000000;border-left-style:solid;border-left-width:2;border-right-color:000000;border-right-style:solid;border-right-width:2;font-weight:bold;vertical-align:center;text-align:center;word-wrap:break-word;height:21;}
  .X1{color:rgb(0,32,96);font-family:Calibri;font-size:11pt;background-color:rgb(218,238,243);border-right-style:solid;border-right-width:2;border-right-color:000000;border-top-color:000000;border-top-style:solid;border-top-width:2;border-bottom-color:000000;border-bottom-style:solid;border-bottom-width:2;border-left-color:000000;border-left-style:solid;border-left-width:2;font-weight:bold;vertical-align:center;text-align:center;word-wrap:break-word;height:21;}
  .X2{color:rgb(0,32,96);font-family:Calibri;font-size:11pt;background-color:rgb(218,238,243);border-top-color:000000;border-top-style:solid;border-top-width:2;border-bottom-color:000000;border-bottom-style:solid;border-bottom-width:2;border-right-color:000000;border-right-style:solid;border-right-width:2;font-weight:bold;vertical-align:center;text-align:center;word-wrap:break-word;height:21;}
  .X3{color:rgb(0,32,96);font-family:Calibri;font-size:11pt;background-color:rgb(218,238,243);border-bottom-style:solid;border-bottom-width:2;border-bottom-color:000000;border-top-color:000000;border-top-style:solid;border-top-width:2;border-left-color:000000;border-left-style:solid;border-left-width:2;border-right-color:000000;border-right-style:solid;border-right-width:2;font-weight:bold;vertical-align:center;text-align:center;word-wrap:break-word;height:21;}
  .X4{color:rgb(0,32,96);font-family:Calibri;font-size:11pt;background-color:rgb(218,238,243);border-bottom-color:000000;border-bottom-style:solid;border-bottom-width:2;border-left-color:000000;border-left-style:solid;border-left-width:2;border-right-color:000000;border-right-style:solid;border-right-width:2;font-weight:bold;vertical-align:center;text-align:center;word-wrap:break-word;height:21;}
  .X5{color:rgb(0,32,96);font-family:Calibri;font-size:11pt;background-color:rgb(218,238,243);border-bottom-color:000000;border-bottom-style:solid;border-bottom-width:2;border-right-color:000000;border-right-style:solid;border-right-width:2;font-weight:bold;vertical-align:center;text-align:center;word-wrap:break-word;height:21;}
  .X6{color:rgb(0,32,96);font-family:Calibri;font-size:11pt;background-color:rgb(255,255,255);border-bottom-color:000000;border-bottom-style:solid;border-bottom-width:2;border-left-color:000000;border-left-style:solid;border-left-width:2;border-right-color:000000;border-right-style:solid;border-right-width:2;vertical-align:center;text-align:general;word-wrap:break-word;height:21;}
  .X7{color:rgb(0,32,96);font-family:Calibri;font-size:11pt;background-color:rgb(255,255,255);border-bottom-color:000000;border-bottom-style:solid;border-bottom-width:2;border-right-color:000000;border-right-style:solid;border-right-width:2;vertical-align:center;text-align:right;word-wrap:break-word;height:21;}&lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;table cellspacing="0"&gt;
        &lt;Col width="167" /&gt;
        &lt;Col width="109" /&gt;
        &lt;Col width="104" /&gt;
        &lt;Col width="91" /&gt;
        &lt;Col width="85" /&gt;
        &lt;Col width="65" /&gt;
        &lt;tr&gt;
          &lt;td class="X0"&gt;
            &lt;div style="width:163px !Important;width:167px;" /&gt;
          &lt;/td&gt;
          &lt;td COLSPAN="2" class="X1"&gt;11&amp;nbsp;11&amp;nbsp;11&lt;/td&gt;
          &lt;td ROWSPAN="2" class="X3"&gt;11&amp;nbsp;&amp;nbsp;11&lt;/td&gt;
          &lt;td COLSPAN="2" class="X1"&gt;11&amp;nbsp;11&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td class="X4"&gt;
            &lt;div style="width:163px !Important;width:167px;" /&gt;
          &lt;/td&gt;
          &lt;td class="X5"&gt;11&lt;/td&gt;
          &lt;td class="X5"&gt;11&lt;/td&gt;
          &lt;td class="X5"&gt;11&lt;/td&gt;
          &lt;td class="X5"&gt;11&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td class="X6"&gt;a&amp;nbsp;aa&lt;/td&gt;
          &lt;td class="X7"&gt;b&lt;/td&gt;
          &lt;td class="X7"&gt;b&lt;/td&gt;
          &lt;td class="X7"&gt;b&lt;/td&gt;
          &lt;td class="X7"&gt;b&lt;/td&gt;
          &lt;td class="X7"&gt;b&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td class="X6"&gt;c&amp;nbsp;cc&amp;nbsp;ccc&lt;/td&gt;
          &lt;td class="X7"&gt;d&lt;/td&gt;
          &lt;td class="X7"&gt;d&lt;/td&gt;
          &lt;td class="X7"&gt;d&lt;/td&gt;
          &lt;td class="X7"&gt;d&lt;/td&gt;
          &lt;td class="X7"&gt;d&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td class="X6"&gt;e&amp;nbsp;ee&amp;nbsp;eee&lt;/td&gt;
          &lt;td class="X7"&gt;f&lt;/td&gt;
          &lt;td class="X7"&gt;f&lt;/td&gt;
          &lt;td class="X7"&gt;f&lt;/td&gt;
          &lt;td class="X7"&gt;1f&lt;/td&gt;
          &lt;td class="X7"&gt;f&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>