title: Export WebGrid data to Excel in MVC4
body: <p>I want to export WebGrid data to excel with formatting.</p>
  
  <p>I have written below code which export WebGrid data to Excel.</p>
  
  <pre><code> WebGrid grid = new WebGrid(source: listReport, canPage: false, canSort: false);
  
          string gridData = grid.GetHtml(
              columns: grid.Columns(
                      grid.Column("ID", "ID"),
                      grid.Column("Name", "Name"),
                      grid.Column("Summary", "Summary"),
                      grid.Column("Detail", "Detail"),
                      grid.Column("ProjectName", "Project Name")
                      )
                  ).ToString();
  
  
          Response.ClearContent();
          Response.AddHeader("content-disposition", "attachment; filename=CustomerInfo.xls");
          Response.ContentType = "application/excel";
          Response.Write(gridData);
          Response.End();
  </code></pre>
  
  <p>I want to do formatting in excel.
  Is it possible to export data with formatting?</p>
  
  <p>Also it gives me below error when i open the generated excel</p>
  
  <p><img src="https://i.stack.imgur.com/vW8Gl.png" alt="enter image description here"></p>