title: export gridview to excel without the gridview formatting VB
body: <p>I am able to export a gridview to excel, my problem is that I cannot figure out how to remove the formatting from coming over from the girdview.  Here is the code I am using to export the gridview:</p>
  
  <pre><code>Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  
      Response.Clear()
      Response.Charset = ""
      'Response.ContentType = "application/vnd.ms-excel"
      Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  
      Dim stringWrite = New System.IO.StringWriter()
      Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)
  
      GridView1.GridLines = GridLines.None
  
      GridView1.HeaderStyle.Font.Bold = True
      GridView1.DataSourceID = SqlDataSource1.ID
      GridView1.DataBind()
  
      GridView1.RenderControl(htmlWrite)
  
      Response.Write(stringWrite.ToString)
      Response.End()
  
  End Sub
  </code></pre>