title: how to Design the exported excel in asp.net?
body: <p>I am exporting gridview data to excel but that excel file add the some lable text and textbox values and format also taken , pls give how to design the excel code in asp.net. I am writing like this </p>
  
  <ul>
  <li><p>All gridview data taken dataset ds
  -pls give me  textbox values and some label or normal text designed code in excel</p>
  
  <p>GridView GridView1 = new GridView();
          GridView1.AllowPaging = false;
          GridView1.DataSource = ds;
          GridView1.DataBind();</p>
  
  <pre><code>    Response.Clear();
      Response.Buffer = true;
      Response.AddHeader("content-disposition",
      "attachment;filename=DataTable.xls");
      Response.Charset = string.Empty;
      Response.ContentType = "application/vnd.ms-excel";
      StringWriter sw = new StringWriter();
      HtmlTextWriter hw = new HtmlTextWriter(sw);
  
      for (int i = 0; i &lt; GridView1.Rows.Count; i++)
      {
      ////Apply text style to each Row
              GridView1.Rows[i].Cells[4].Attributes.Add("class", "textmode");
      }
      GridView1.RenderControl(hw);
  
      //style to format numbers to string
      string style = @"&lt;style&gt; .textmode { mso-number-format:'\#,\#\#0\.00';}
      .textmode1(mso-number-format:'\@';}
      .SSNmode{mso-number-format:'000-00-000';} &lt;/style&gt;";
  
  
      Response.Write(style);
      Response.Output.Write(sw.ToString());
      Response.Flush();
      Response.End(); 
  </code></pre></li>
  </ul>