title: GridView to Excel using EPPlus
body: <p>I'm trying to create an excel sheet using the EPPlus's library.
  However, the output excel file does not relate well to cells of representing numbers.</p>
  
  <p><img src="https://i.stack.imgur.com/nAaM3.png" alt="enter image description here"></p>
  
  <p>The code I'm using is:</p>
  
  <pre><code>using (var pck = new ExcelPackage())
  {
      ExcelWorksheet ws = pck.Workbook.Worksheets.Add(string.IsNullOrEmpty(SpreadsheetName) ? "Report" : SpreadsheetName);
      ws.Cells["B2"].LoadFromDataTable(gridViewTable, true, OfficeOpenXml.Table.TableStyles.Light1);
  
      for (int i = 1; i &lt;= gridViewTable.Columns.Count; i++)
      {
          ws.Column(i).AutoFit();
      }
  
      // **************
      //     HEADER
      // **************
  
      //prepare the range for the column headers
      string cellRange = "B2:" + Convert.ToChar('B' + gridViewTable.Columns.Count - 1) + 2;
  
      //Format the header for columns
      using (ExcelRange rng = ws.Cells[cellRange])
      {
          rng.Style.WrapText = false;
          rng.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
          rng.Style.Font.Bold = true;
          rng.Style.Fill.PatternType = ExcelFillStyle.Solid; //Set Pattern for the background to Solid
          rng.Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#007A99"));
          rng.Style.Font.Color.SetColor(Color.White);
      }
  
      // ************
      //     DATA
      // ************
  
      //prepare the range for the rows
      string rowsCellRange = "B3:" + Convert.ToChar('B' + gridViewTable.Columns.Count - 1) + (gridViewTable.Rows.Count + 1);
  
      //Format the rows
      using (ExcelRange rng = ws.Cells[rowsCellRange])
      {
          rng.Style.WrapText = false;
          rng.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
          rng.Style.Fill.PatternType = ExcelFillStyle.Solid; //Set Pattern for the background to Solid
          rng.Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#B2D1F0"));
          rng.Style.Font.Color.SetColor(Color.Black);
      }
  
      Response.ClearHeaders();
      Response.ClearContent();
      Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
      Response.AddHeader("content-disposition", "attachment; filename=" + (string.IsNullOrEmpty(FileName) ? "Report" : FileName) + ".xlsx");
      Response.BinaryWrite(pck.GetAsByteArray());
  }
  </code></pre>
  
  <p>Does anyone might know why is this happening ?</p>