I am Using Fllowing method and Export Word File.I want to Add a AddHeader and Detlais top Of the Word file.how to do it?? protected void Button1_Click(object sender, EventArgs e) { ExportGridToword(); } private void ExportGridToword() { Response.Clear(); Response.Buffer = true; Response.ClearContent(); Response.ClearHeaders(); Response.Charset = ""; string FileName = "Vithal" + DateTime.Now +".doc"; StringWriter strwritter = new StringWriter(); HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType ="application/msword"; Response.AddHeader("Content-Disposition","attachment;filename=" + FileName); GridView1.GridLines = GridLines.Both; GridView1.HeaderStyle.Font.Bold = true; GridView1.RenderControl(htmltextwrtter); Response.Write(strwritter.ToString()); Response.End(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)