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:
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.