.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Open word document on button click

Posted By:Venkat       Posted Date: April 18, 2010    Points: 10    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

This code is used to open MS word file in a browser when user click on a button.

To open work file dynamically in a button click you can refer this code example.
protected void Button3_Click(object sender, EventArgs e)
    string attachment = "attachment; filename=myWordFile.doc";


    Response.AddHeader("content-disposition", attachment);

    Response.ContentType = "application/ms-word";

    StringWriter stw = new StringWriter();

    HtmlTextWriter htextw = new HtmlTextWriter(stw);




public override void VerifyRenderingInServerForm(Control control)



Further Readings:

Author: jason         Company URL: http://www.dotnetspark.com
Posted Date: August 03, 2010

nice articles, did you used spire.Doc ? I feel it other easy way to read and write word. maybe a better word component to .net.

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend