|
-
Jun 10th, 2003, 05:26 PM
#1
Thread Starter
New Member
Copy contents of Browser Control to Microsoft Word
Hello,
In a VB.NET windows application, I am attempting to copy the contents of an AxBrowswer window to a word.application document. Does anyone know how to do this?
I have the following, but it doesn't work:
wrdApp2 = CreateObject("Word.Application")
wrdApp2.Documents.Open("C:\Test1.doc")
AxWebBrowser1.Select()
Clipboard.SetDataObject(AxWebBrowser1)
wrdApp2.Documents.paste(Clipboard.GetDataObject)
wrdApp2.Documents.Save()
Overall
I am able to copy one word document to another and open a word document in a WebBrowser for editing. Know I need to know how to copy the contents of a browser to a word document. My ultimate goal is to put xml data tables into MS Word (not supported in Office 2000 without building some sort of parser).
Scenario is:
1. User enters data into Dataset. (Complete)
2. Program Saves as xml. (Complete)
3. Opening in web browser using html + xsl style. (Complete)
4. copy to microsoft word document. (I'm stuck)
Thanks for all your help.
-
Jun 10th, 2003, 07:05 PM
#2
Sleep mode
You should ask VB.NET questions , in VB.NET Forum not VB6 Forum .
-
Jun 10th, 2003, 10:16 PM
#3
Addicted Member
VB Code:
'Try something like this?
wrdApp2.Selection.Paste
Other than that I don't know
Lee Saunders
Win XP Professional : VB6 Enterprise / VB 2005 Express
History admires the wise, but it elevates the brave.
-
Jun 11th, 2003, 12:36 PM
#4
Thread Starter
New Member
Select and Copy contents of axbrowser control (Ctrl+A, then Ctrl+C)
Thanks Lee. I think you got me one step closer. I was able to paste the contents of the clipboard using your command.
Now all I need to know is how to Copy the contents from the web browser control such that it is in a format that can be pasted into word. Currently the format I copy from the WebBrowser is not valid for wrdapp.selection.paste. (Either that, or I am not copying the value at all).
Essentially, now I just need to perform a select all (CTRL+A) and then copy (CTRL+C).
Anyone that can help would be greatly appreciated!
-
Jun 11th, 2003, 05:24 PM
#5
Addicted Member
Try playing around with this, see if it does what you need. It should copy everything to the clipboard ready for pasting into word.
VB Code:
' select all from webbrowser
WebBrowser1.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DONTPROMPTUSER
' copy the text to Clipboard
WebBrowser1.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DONTPROMPTUSER
' clear the selection
WebBrowser1.ExecWB OLECMDID_CLEARSELECTION, OLECMDEXECOPT_DONTPROMPTUSER
Lee Saunders
Win XP Professional : VB6 Enterprise / VB 2005 Express
History admires the wise, but it elevates the brave.
-
Jun 25th, 2003, 04:11 PM
#6
Thread Starter
New Member
That worked great!
Thanks for all your help!
-
May 27th, 2004, 08:16 AM
#7
Fanatic Member
Do you want to take a screen shot of the entire web document ? Is this what your trying to do....?
I am curretly building a defect management system for software and web developers,
If you wana try it out (beta test) and keep it for free just send me a message
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|