title: Color a particular row in excel C#
body: <p>I am creating an excel work book of my daily report. I want the header part to coloured to yellow. All links that are posted either requires a link of the workbook to be opened or are not specific to probelm. I am posting my code here, please suggest how to make Row 6 in yellow color.</p>
  
  <pre><code>    string workBookName;
  
          // creating Excel Application
          Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application();
  
  
          // creating new WorkBook within Excel application
          Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing);
  
  
          // creating new Excelsheet in workbook
          Microsoft.Office.Interop.Excel._Worksheet worksheet = null;
  
          // see the excel sheet behind the program
          app.Visible = true;
  
          // get the reference of first sheet. By default its name is Sheet1.
          // store its reference to worksheet
          worksheet = workbook.Sheets["Sheet1"];
          worksheet = workbook.ActiveSheet;
  
          // changing the name of active sheet
          workBookName = DateTime.Now.ToString("ddMMMyyyy-HHmmss");
          worksheet.Name = workBookName;
  
          worksheet.Cells[1, 1] = "Logistics";
          worksheet.Cells[2, 1] = "Tracking Number";
  
          worksheet.Cells[4, 2] = "Date - ";
          worksheet.Cells[4, 3] = dateTimePicker1.Value.ToString("dd/MMM/yyyy");
  
  
          // storing header part in Excel
          for (int i = 1; i &lt; dataGridView1.Columns.Count + 1; i++)
          {
              worksheet.Cells[6, i] = dataGridView1.Columns[i - 1].HeaderText;
             // worksheet.get_Range(worksheet.Cells[6, i]).Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Green);
          }
  
  
  
          // storing Each row and column value to excel sheet
          for (int i = 0; i &lt; dataGridView1.Rows.Count - 1; i++)
          {
              for (int j = 0; j &lt; dataGridView1.Columns.Count; j++)
              {
                  //if (!string.IsNullOrWhiteSpace(dataGridView1.Rows[i].Cells[j].Value))
                  {
                      worksheet.Cells[i + 8, j + 1] = dataGridView1.Rows[i].Cells[j].Value;
  
  
                  }
              }
          }
  
  
          // save the application
          workbook.SaveAs("Tracking Number Report " + workBookName + ".xls", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
  
          // Exit from the application
          app.Quit();
  </code></pre>
  
  <p>I want row 6, which is the header part in my case to be colored.</p>