Frnd's.., I had try below showing code to convert data from gridview to msword..but the end data is saved in notepad i need to save in msword..can any1 help..
protected void btn_export_Click(object sender, EventArgs e)
{
GridView1.AllowPaging = false;
GridView1.DataBind();
Response.ClearContent();
Response.AddHeader("content-disposition", string.Format("attachment;filename{0}", "customer.doc"));
Response.Charset = "";
Response.ContentType = "application/ms-word";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView1.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
lab_msg.Text = "data saved";
lab_msg.ForeColor = Color.Green;
}
thank you..
Riddhi ValechaRank #794 · 2.9K reputationPosted Jul 31, 2014, 12:49 AM EDT
Alex SmithRank #4,089 · 366 reputationPosted Dec 10, 2014, 7:42 PM EST
http://www.aspnettutorials.com/tutorials/file/gv-word-aspnet2-csharp/
Samuel Summers12 reputationPosted Jul 10, 2015, 12:07 AM EDT