Displaying word documet in Windows Application
How can i display word document in windows application?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Prabhu RajaRank #861 · 2.6K reputationPosted Sep 22, 2011, 1:54 AM EDT
1) Add a WebBrowser Control in Your Windows Form,
2) Make your Web Browser Control to point a Word file By,
webBrowser1.Url = new Uri(@"C:\doc\MyDoc.doc");
// add above code Where you want, for example , inside of form_Load() event or Button_CLick() event.
3) Make Sure You must have Internet Explorer and MS Word on Your System.
-----------------------------------------------------------------------
If this helps you, then mark as "Correct Answer"
Thank You
TulasiRank #2,544 · 549 reputationPosted Sep 22, 2011, 2:10 AM EDT
code, which you have sent me is working , if i want to dispaly .txt type files ?
Prabhu RajaRank #861 · 2.6K reputationPosted Sep 22, 2011, 3:12 AM EDT
webBrowser1.Url = new Uri(@"C:\doc\MyDoc.txt");
----------------------------------------------------------------------
If it helpful, then mark as "Correct Answer"
Thank You
TulasiRank #2,544 · 549 reputationPosted Sep 22, 2011, 3:19 AM EDT
Prabhu RajaRank #861 · 2.6K reputationPosted Sep 22, 2011, 4:17 AM EDT
//insert namespace
using System.IO;
StreamReader objstream = new StreamReader("D:\\1.txt"); //txt file Path
label2.Text = objstream.ReadToEnd();
Prabhu RajaRank #861 · 2.6K reputationPosted Sep 23, 2011, 9:19 PM EDT
TulasiRank #2,544 · 549 reputationPosted Sep 25, 2011, 9:12 PM EDT
sry for the late replay, i dont want to open ,read ,edit and close . just i want to display .txt file (without reading its content) . like word (above)
Prabhu RajaRank #861 · 2.6K reputationPosted Sep 25, 2011, 9:30 PM EDT
WebBrowser1.Navigate(@"C:\doc\MyDoc.txt")
------------------------------------------------------------
If this post helps you, then mark as "Correct Answer"
Thank You
TulasiRank #2,544 · 549 reputationPosted Sep 25, 2011, 10:30 PM EDT
Prabhu RajaRank #861 · 2.6K reputationPosted Sep 25, 2011, 10:55 PM EDT
---------------------------------------------------------------------
If this post helps you, than mark as "Correct Answer"
Thank you
Prabhu Raja
TulasiRank #2,544 · 549 reputationPosted Sep 26, 2011, 4:30 AM EDT
see i have listbox in that i display .txt files and doc files, when i double click on the listitem (xxx.txt file) it has to open the xxx.txt file so user can see the content of xxx.txt file(it should be readonly mode) , if he want he can download it , otherwise he click on cancel button