Displaying and editing Word documents in WinForms

rengeek33

New member
Joined
Apr 14, 2004
Messages
1
Location
Denver, CO
I need to be able to open, edit, add files to, and save a word document from within my WinForm program. Ive read a number of threads about the Word object, but none of them talk about displaying the document in some control.

In VB6 I would use the object container and open the word object inside of it. It would display the object. I cant see what object to use here.

Any answers?

Thanks
 
There is currently no windows forms control to display ActiveX (ole) documents. In the next release of .NET and Visual Studio, this will be addressed with the ActiveDocumentContainer control.
 
Using Web Browser Object To Display OFFICE DOCUMENTS

To display an office file in Windows, you can do this using the web browser object in the toolbox. See sample code below I created to view a Bill of Lading document created in the shipping department. This application is used to view and/or manipulate these files. Once file is loaded-(NavigateComplete)
Then I set the current document and hide the toolbars, which is optional. You can control which toolbars are available to the users.

Private Sub frmViewBOL_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strMyBOL As String = strBOL_FileDIR & strBillOfLading & ".doc"
If File.Exists(strMyBOL) Then
oDoc = Nothing
webViewBOL.Navigate(strMyBOL)
Me.Text = "View Bill of Lading " & strBillOfLading
Else
MsgBox("Bill of Lading Not On File", MsgBoxStyle.Critical, msgTimken)
Me.Close()
End If
End Sub

Private Sub webViewBOL_NavigateComplete2(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) Handles webViewBOL.NavigateComplete2
oDoc = e.pDisp.document

webViewBOL.ExecWB(SHDocVw.OLECMDID.OLECMDID_HIDETOOLBARS, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT)
End Sub
 
There is currently no windows forms control to display ActiveX (ole) documents. In the next release of .NET and Visual Studio, this will be addressed with the ActiveDocumentContainer control.
Is .NET 2005 the next release you were talking abt ? Since the post was made in 2004, I was wondering if the OPs issue can be solved in VB .NET 2005 Exp Edition.
 
Back
Top