我也遇到過一個顯示word的
在網上找的資料 但出錯啊
    public Form1()
        {
            InitializeComponent();
            this.axWebBrowser1.NavigateComplete2 += new AxSHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(this.axWebBrowser1_NavigateComplete2);
        }
        private object oDocument;
        private void button1_Click(object sender, EventArgs e)
        {
            String strFileName;            //Find the Office document.
            openFileDialog1.FileName = "";
            openFileDialog1.ShowDialog();
            strFileName = openFileDialog1.FileName;            if (strFileName.Length != 0)
            {
                Object refmissing = System.Reflection.Missing.Value;
                oDocument = null;
                axWebBrowser1.Navigate(strFileName, ref refmissing, ref refmissing, ref refmissing, ref refmissing);
            }
        }        private void Form1_Load(object sender, EventArgs e)
        {
            button1.Text = "Browse";
            openFileDialog1.Filter = "Office Documents(*.doc, *.xls, *.ppt)|*.doc;*.xls;*.ppt";
            openFileDialog1.FilterIndex = 1;
        }
        public void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
        {            //Note: You can use the reference to the document object to 
            //      automate the document server.            Object o = e.pDisp;            oDocument = o.GetType().InvokeMember("Document", BindingFlags.GetProperty, null, o, null);            Object oApplication = o.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, oDocument, null);            Object oName = o.GetType().InvokeMember("Name", BindingFlags.GetProperty, null, oApplication, null);            MessageBox.Show("File opened by: " + oName.ToString());
        }
    }

解决方案 »

  1.   

    Wb.Navigate("www.google.cn");
     HtmlDocument doc = Wb.Document;
    txtHtml.Text = doc.Body.InnerHtml;
      

  2.   

    System.Net.WebRequest wrq = System.Net.WebRequest.Create( fileUrl );   System.Net.WebResponse wrs = wrq.GetResponse();   Stream strm = wrs.GetResponseStream(); StreamReader sr = new StreamReader( strm );  MessageBox.Show(sr.ReadToEnd());
      

  3.   

    各位大虾
    还是不行呢
    我要的是在WebBrowser控件中显示所指URI的的HTM代码呢
      

  4.   

    using System;
    using System.IO;
    using System.Net;class Test
    {
      // 获取网页的HTML内容
      static string GetPage(string url)
      {
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
        try
        {
          using (HttpWebResponse res = (HttpWebResponse)req.GetResponse())
          {
            using (StreamReader sr = new StreamReader(res.GetResponseStream()))
            {
              return sr.ReadToEnd();
            }
          }
        }
        catch (System.Exception e)
        {
          return e.Message;
        }
        finally
        {
          req.Abort();
        }
      }  static void Main()
      {
        string url = "www.google.cn";
        Console.WriteLine(GetPage(url));
      }
    }