title: How to set cell color programmatically epplus?
body: <p>I was wondering if it is possible to set cell color programmatically using epplus?</p>
  
  <p>I load my data from a sql stored procedure and it works well, but my users want
  cells that contain the words 'Annual Leave' to have a background color of light yellow instead of the default white. Is there a way to do this? perhaps by iterating through a datatable perhaps? Below is where</p>
  
  <pre><code>public void ExportTableData(DataTable dtdata)
  {
      //Using EPPLUS to export Spreadsheets
      ExcelPackage pck = new ExcelPackage();
      var ws = pck.Workbook.Worksheets.Add("Availability list");
  
      ws.Cells["A1"].LoadFromDataTable(dtdata, true);
  
      ws.Cells["A1:G1"].Style.Font.Bold = true;
      ws.Cells["A1:G1"].Style.Font.UnderLine = true;
  
      //change cell color depending on the text input from stored proc?
      if (dtdata.Rows[4].ToString() == "Annual Leave")
      {
          ws.Cells["E1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
          ws.Cells["E1"].Style.Fill.BackgroundColor.SetColor(Color.LightYellow);
      }
  
      pck.SaveAs(Response.OutputStream);
      Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
      Response.AddHeader("content-disposition", "attachment;  filename=Availability.xlsx");
      Response.End();
  }
  </code></pre>