string strFileName = @"file:///C:/Documents and Settings\aa.xlsx";

解决方案 »

  1.   


    我测试了的,还是一样的,单独打开一个excel,而webbrowser中仍然显示的是“已取消到该网页的导航”
      

  2.   

    http://support.microsoft.com/kb/927009/zh-cn
      

  3.   


    这个问题,是在web中浏览office文件时,在外部打开;而我是在winform中的问题,而且,我只需要显示excel,不需要可以编辑它。。再者,这个是需要在客户端运行的,不可能让每个系统的用户,都去修改注册表的值
      

  4.   

    找到个控件dsoframer目前是可以显示excel的别的功能还在研究中网上很多关于这个的使用
      

  5.   

    我跟lz 一样的问题 坑啊 不过我是用的word 显示在wb上面 lz解决么啊 
      

  6.   

    修改注册表以后就会在Webbrowser窗口中打开Excel了,详见以下链接
    http://blog.sina.com.cn/s/blog_bfb812c00101hq82.html
      

  7.   

    可以通过  [DllImport("user32.dll", EntryPoint = "FindWindow")]
            public static extern int FindWindow(string lpClassName, string lpWindowName);
            bool bfirst = false;
            private void timer1_Tick(object sender, EventArgs e)
            {
                int hwnd = FindWindow(null, "文件下载");
                if (hwnd > 0 && !bfirst)
                {
                    SendKeys.Send("{TAB}{TAB}");
                    bfirst = true;
                }
                if (hwnd > 0)
                {
                    SendKeys.Send("{ENTER}");
                    hwnd = FindWindow(null, "文件下载");
                    if (hwnd == 0)
                    {
                        timer1.Stop();
                        bfirst = false;
                    }
                }
                       }
    来解决这个文件下载 我是发两个tab键定位到打开按钮 然后 发送回车键  启动一个定时器
      

  8.   

     [DllImport("user32.dll", EntryPoint = "FindWindow")]
            public static extern int FindWindow(string lpClassName, string lpWindowName);
            bool bfirst = false;
            private void timer1_Tick(object sender, EventArgs e)
            {
                int hwnd = FindWindow(null, "文件下载");
                if (hwnd > 0 && !bfirst)
                {               
                    SendKeys.Send("{TAB}{TAB}");
                    bfirst = true;
                }
                else if (bfirst)
                {
                    SendKeys.Send("{ENTER}");
                    hwnd = FindWindow(null, "文件下载");
                    if (hwnd == 0)
                    {
                        timer1.Stop();
                       bfirst = false;
                       
                    }
                }
                
                       }