Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2005

Tip: Looking for answers? Try searching our database.

Paste a bitmap from VB.NET2005 to Word2000

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jiao - 21 Sep 2005 05:11 GMT
I am trying to paste an image in a pictureBox in vb.NET to a Word document.
When using the paste method, the image quality in Word is bad. If using
pasteSpecial method, all the dataType, like wdPasteBitmap or
wdPasteEnhancedMetafile, etc. are not available.

The code is as follows:
       wdApp = CreateObject("Word.Application")
       wordD = wdApp.Documents.Add
       My.Computer.Clipboard.Clear()
       My.Computer.Clipboard.SetImage(bm)
       wordD.Sections.Item(1).Range.PasteSpecial(Link:=False,
DataType:=Word.WdPasteDataType.wdPasteShape)

Does Anyone know how?

I also find that when using pasteSpecial to paste a picture to Word, the
foramt of JPeg, Png, etc are not available until you cut the pasted picture
and do the pastSpecial again.

Thanks.

Signature

I like Vb.

Jezebel - 21 Sep 2005 06:09 GMT
The DataType can be any of the wdPasteSpecial values supported by the
graphic you've copied. If JPG, PNG, etc aren't available, it's because those
formats aren't present in the clipboard at the time. Word has no control
over what happens when you do the SetImage from another source. When you
copy FROM Word, Word puts the image into the clipboard in a lot of different
formats -- hence the range of options if you then paste back.

In general, a better way to put images into a document is via a separate
file: then you have complete control over the format, and Word doesn't get
an opportunity to screw around with the image either.

>I am trying to paste an image in a pictureBox in vb.NET to a Word document.
> When using the paste method, the image quality in Word is bad. If using
[quoted text clipped - 17 lines]
>
> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.