Hardik Patel

Hardik Patel

  • NA
  • 378
  • 469.4k

how to set image in header in MS WORD when export data?

Jan 21 2014 4:25 AM
how to set image in header in MS WORD when export data from gridview in asp.net?
 
i am using below code but i want to set image in header in MS WORD.
 
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition",
"attachment;filename=" + gdvReport.Caption + ".doc");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-word ";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
GridView1.AllowPaging = false;
GridView1.HeaderRow.BackColor = System.Drawing.Color.White;
gdvReport.HeaderRow.BackColor = System.Drawing.Color.White;
GridView1.HeaderStyle.ForeColor = System.Drawing.Color.Black;
gdvReport.HeaderStyle.ForeColor = System.Drawing.Color.Black;
//GridView1.DataBind();
gdvReport.AllowPaging = false;
// gdvReport.DataBind();
gdvReport.RenderControl(hw);
GridView1.RenderControl(hw);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();