简体   繁体   中英

How to display word 2007 document in web browser control using asp.net web application?

I am using VS -2010 for my asp.net web application.Now i want to display word 2007 document on browser.So, i decided to use webbrowser control for displaying word 2007 document. But i did not find the component in tool box. So, could you guide me to get the add the web browser control and how to show a word 2007 document in the web browser control.

Otherwise, please suggest some other better approach for displaying word 2007 document in browser(Read Only Mode)?

Try To Refer Following Code:

object oDocument;

private void button1_Click(object sender, EventArgs e)
 {
 string sFileName;
 openFileDialog1.FileName = "";
 openFileDialog1.ShowDialog();
 sFileName = openFileDialog1.FileName;

 if (sFileName.Length!=0)
 {
 oDocument = null;
 webBrowser1.Navigate(sFileName);
 }
 }

 private void Form1_Load(object sender, EventArgs e)
 {
 openFileDialog1.Filter = "Office Documents " + " " + "(*.doc, *.xls, *.ppt)|*.doc;*.xls;*.ppt";
 openFileDialog1.FilterIndex = 1;

 }

 private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
 {
 oDocument = webBrowser1.Document;

 }

Referance Link:

http://www.c-sharpcorner.com/forums/thread/153951/opening-worddoc2007-inside-webbrowserc-sharp-net.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM