请勿将文档文件显示到Microsoft Web Browser控件的窗体中 [英] To do not shown the doc file into Microsoft Web Browser control to the Form

查看:92
本文介绍了请勿将文档文件显示到Microsoft Web Browser控件的窗体中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了代码,以将文档文件显示到Microsoft Web Browser控件的窗体中.
下面的代码如下:---

I download the code to do shown the doc file into Microsoft Web Browser control to the Form.
The following code is below:---

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Button1.Text = "Browse"

        With OpenFileDialog1
            .Filter = "Office Documents " & _
            "(*.doc, *.xls, *.xlsx,*.ppt)|*.doc;*.xls;*.xlsx;*.ppt"
            .FilterIndex = 1
        End With
End Sub
--------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strFileName As String

        'Find the Office document.
        With OpenFileDialog1
            .FileName = ""
            .ShowDialog()
            strFileName = .FileName
        End With

        'If the user does not cancel, open the document.
        If strFileName.Length Then
            oDocument = Nothing
            AxWebBrowser1.Navigate(strFileName)
        End If
End Sub
--------------------------------
Private Sub ReadOnlyWordFile_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        oDocument = Nothing
End Sub
--------------------------------
Private Sub AxWebBrowser1_NavigateComplete2(ByVal sender As System.Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) Handles AxWebBrowser1.NavigateComplete2
        On Error Resume Next

        oDocument = e.pDisp.Document

        'Note: You can use the reference to the document object to
        '      automate the document server.
        MsgBox("File opened by: " & oDocument.Application.Name)
End Sub


但是上面的代码没有正确地将doc文件显示为表格.
它已打开到doc文件的另一个窗口.

为什么??

请任何人帮帮我.....


But above code is not properly shown the doc file into the form.
It is open to another window of doc file.

Why????

please please help me anybody.....

推荐答案



您可以查看以下链接;

http://support.microsoft.com/kb/304662 [
Hi,

You can have a look at the below link;

http://support.microsoft.com/kb/304662[^]

Hope this helps :)

Jas


这篇关于请勿将文档文件显示到Microsoft Web Browser控件的窗体中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆