Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > VB.NET > Third Party Products

Third Party Products Discussion on third party components for VB.NET

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-26-2009, 5:22 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Oct 2009
Age: 23
Posts: 10
Reputation: 8
rostamiani is on a distinguished programming path ahead
Smile Microsoft Word Component

Hi

Can I integrate Microsoft Word into a form as a component ?
Can Microsoft Office PIA do this ?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-26-2009, 6:00 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,328
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

You can use the WebBrowser control to host Office documents (when Office is installed).
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-26-2009, 6:11 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Oct 2009
Age: 23
Posts: 10
Reputation: 8
rostamiani is on a distinguished programming path ahead
Default

Quote:
Originally Posted by JohnH View Post
You can use the WebBrowser control to host Office documents (when Office is installed).
Thanks a lot

How can I do that ?
Can I gain full access to a word document ? for example Printing, Opening files & capturing Events ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-26-2009, 6:35 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,328
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

Quote:
Originally Posted by rostamiani View Post
Thanks a lot

How can I do that ?
Use the Navigate method.
Quote:
Can I gain full access to a word document ? for example Printing, Opening files & capturing Events ?
The Rob Marsh answer seems to indicate you can get the Office application object from the browser and do regular Office automation from there. Problem with Excel inside WebBrowser control

Btw, printing you should be able to do by calling the Print method of the browser.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-26-2009, 7:42 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,328
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

I just tested this and can verify it works, here's the VB.Net sample I used, it also has the simplification that it don't require reference to MS Internet Controls (SHDocVw).
Code:
Dim ax As Object = Me.WebBrowser1.ActiveXInstance
Dim doc As Word.Document = CType(ax.GetType.InvokeMember("Document", Reflection.BindingFlags.GetProperty, Nothing, ax, Nothing), Word.Document)
As usual, requires reference to MS Word Object Library and this import:
Code:
Imports Word = Microsoft.Office.Interop.Word
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 10-26-2009, 7:59 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Oct 2009
Age: 23
Posts: 10
Reputation: 8
rostamiani is on a distinguished programming path ahead
Default

Thanks a lot
I'll test it

Can I print or save the documents ?
How can I access Word.Document events?

Last edited by rostamiani; 10-26-2009 at 9:11 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 10-26-2009, 10:58 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,328
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

Quote:
Originally Posted by rostamiani View Post
Can I print or save the documents ?
Yes, use the Office automation object model. The Word.Document has a Save method for example.
Quote:
How can I access Word.Document events?
You can declare WithEvent variables and point them to the objects, or use AddHandler/RemoveHandler.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 10-27-2009, 2:05 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Oct 2009
Age: 23
Posts: 10
Reputation: 8
rostamiani is on a distinguished programming path ahead
Default

Quote:
Originally Posted by JohnH View Post
I just tested this and can verify it works, here's the VB.Net sample I used, it also has the simplification that it don't require reference to MS Internet Controls (SHDocVw).
Code:
Dim ax As Object = Me.WebBrowser1.ActiveXInstance
Dim doc As Word.Document = CType(ax.GetType.InvokeMember("Document", Reflection.BindingFlags.GetProperty, Nothing, ax, Nothing), Word.Document)
As usual, requires reference to MS Word Object Library and this import:
Code:
Imports Word = Microsoft.Office.Interop.Word
Thanks
I wanted to test it with Visual Studio 2003, But could not find Web Browser Component

Then I used VS 2008 Express

But now the code does not do anything and without any errors

This is my code :

Code:
Imports Word = Microsoft.Office.Interop.Word

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ax As Object = Me.WebBrowser1.ActiveXInstance
        Dim doc As Word.Document = CType(ax.GetType.InvokeMember("Document", Reflection.BindingFlags.GetProperty, Nothing, ax, Nothing), Word.Document)

        WebBrowser1.Refresh()
    End Sub
End Class
I attached my project

Is there any Web Browser Component for VS 2003 ?
Where is th e problem ?

Thanks a lot
Attached Files
File Type: zip Word Test.zip (13.7 KB, 2 views)

Last edited by rostamiani; 10-27-2009 at 4:13 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 10-27-2009, 7:16 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,328
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

Quote:
But now the code does not do anything and without any errors
You haven't added any code to do anything The code sample was just to show you how to connect to the Word automation object from the browser. If you want to do Word automation I recommend you search "vb.net word automation" to get started.
Quote:
Is there any Web Browser Component for VS 2003 ?
With VS 2003 you have to use the ActiveX browser (which is the underlying control for the managed WebBrowser added in .Net 2.0). Choose items for Toolbox where you find the MS Web Browser control in COM page, add it from Toolbox to form.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 10-31-2009, 2:35 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Oct 2009
Age: 23
Posts: 10
Reputation: 8
rostamiani is on a distinguished programming path ahead
Default

Thanks a lot

I found this code

CodeProject: ByPass difficult Automation and add applications "as is" in your .NET application. Free source code and programming help

It shows how to move any application's window to a button,Label or any other controls by changing it's handle

But it seemed that we have cannot control that application, But it's wonderful

This is the code
Code:
Dim pinfo As New ProcessStartInfo("WINWORD")
Dim p As Process = System.Diagnostics.Process.Start(pinfo)
p.WaitForInputIdle()
SetParent(p.MainWindowHandle, Me.Label1.Handle)

Last edited by rostamiani; 10-31-2009 at 3:19 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 2:29 PM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.