title: How can I modify the foreground and background color of an OpenXML TableCell?
body: <p>I'm creating the table cell as follows:</p>
  
  <pre><code>private static TableCell GetHeaderCell(string cellText)
  {
      var tc = new TableCell(new Paragraph(new Run(new Text(cellText))));
      return tc;
  }
  </code></pre>
  
  <p>I want it to be blue with white text.</p>
  
  <p>I've tried the following, but it doesn't work; when I try to open the document I get an error that there is a problem with the contents:</p>
  
  <pre><code>private static TableCell GetHeaderCell(string cellText)
  {
      var props = new TableCellProperties();
      var solidFill = new SolidFill();
      var rgbColorHex = new RgbColorModelHex() { Val = "FF0000" };//Red Background for Single TableCell.
  
      solidFill.Append(rgbColorHex);        
      props.Append(solidFill);
  
      var paragraph = new Paragraph(new Run(new Text(cellText)));
  
      var tc = new TableCell(paragraph, props);
  
      return tc;
  }
  </code></pre>
  
  <p>The full error is as follows:</p>
  
  <p><img src="https://i.stack.imgur.com/O2Yy7.png" alt="enter image description here"></p>