title: How Can I Apply More than One Class per Element for HTML that Is to Be Read in Excel?
body: <p>In standard HTML, of course, an element can be associated with more than one class simply by putting a space between the class names.</p>
  
  <p>Microsoft Excel can read plain HTML (a function that is essential to a long-standing report I am trying to modify) -- but it appears that Excel ignores class information if more than one class is applied to an element.</p>
  
  <p>My actual situation is pretty complex -- but the following simplified example will illustrate the problem: If the following text is saved with a <code>.xls</code> extension, it will load in Excel.</p>
  
  <pre><code>&lt;style&gt;
      .bold { font-weight: bold; }
      .italic { font-style: italic; }
  &lt;/style&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;td class="bold"&gt;This will display in bold.&lt;/td&gt;
          &lt;td class="italic"&gt;This will display in italics.&lt;/td&gt;
          &lt;td class="bold italic"&gt;This should display bold italics, but it doesn't.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>But it looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/eRsXZ.jpg" alt="Screen shot of the above as displayed in Excel"></p>
  
  <p>(Saved as <code>.htm</code>, the same content loads in a web browser and displays as expected.)</p>
  
  <p>I haven't been able to find any mention of this behavior in web searches or searches for similar questions here, but I <em>have</em> experimented with a few non-standard ways of listing the classes just to see if Excel would interpret them both, including the following:</p>
  
  <ul>
  <li><code>&lt;td class="bold" class="italic"&gt;</code> (multiple <code>class</code> attributes)</li>
  <li><code>&lt;td class="bold,italic"&gt;</code> (comma-separated)</li>
  <li><code>&lt;td class="bold;italic"&gt;</code> (semicolon-separated)</li>
  <li><code>&lt;td class="bold|italic"&gt;</code> (pipe-separated)</li>
  </ul>
  
  <p>Unsurprisingly, none of these worked. Is there some way/trick/hack to make Excel recognize multiple classes when it loads a file in HTML format? Or is this just something that the program is inherently unable to handle?</p>