Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I need to be able to open, edit, add files to, and save a word document from within my WinForm program. I've 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 can't see what object to use here.

 

Any answers?

 

Thanks

Posted

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

  • 2 years later...
Posted
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 OP's issue can be solved in VB .NET 2005 Exp Edition.
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...