TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ib bellad
NA
376
35.5k
export data from gridview to msword
Jul 31 2014 4:29 AM
HI
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..
Reply
Answers (
3
)
Post model data containg file type using Ajax call in mvc4
sql injection all tables, How to Prevent?