![]() |
Click here to advertise with us
|
|
|||||||
| Third Party Products Discussion on third party components for VB.NET |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
You can use the WebBrowser control to host Office documents (when Office is installed).
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
Quote:
How can I do that ? Can I gain full access to a word document ? for example Printing, Opening files & capturing Events ? |
|
||||
|
Use the Navigate method.
Quote:
Btw, printing you should be able to do by calling the Print method of the browser.
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
||||
|
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)
Code:
Imports Word = Microsoft.Office.Interop.Word
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
||||
|
Yes, use the Office automation object model. The Word.Document has a Save method for example.
Quote:
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
Quote:
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
Is there any Web Browser Component for VS 2003 ? Where is th e problem ? Thanks a lot Last edited by rostamiani; 10-27-2009 at 4:13 AM. |
|
||||
|
Quote:
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:
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
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. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|