469,945 Members | 2,068 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

Reading metafile or gif from clipboard to picturebox

Hi,

I need to write a conversion routine to split pictures out of about 10000
word documents. (Actually the text is converted to RTF, the pictures should
be converted to jpg).

I thought I could simply save the word doc as rtf and strip the picture.
That works. The problem is getting the picture to save correctly. I can use
word to determine which pictures are in the original document and can get
them to the clipboard. I can't seem to be able to paste this into a
picturebox for further processing (selecting the correct picture etc.).

Code like
If Clipboard.GetDataObject.GetDataPresent(DataFormats .Bitmap, True)
Then
Dim i As Image
i = CType(Clipboard.GetDataObject.GetData(DataFormats. Bitmap,
True), Bitmap)
PictureBox1.Image = i
End If
won't work because the framework can't identify any of the formats as a
bitmap.

The formats I am seeing are
Office Drawing Shape Format
MetaFilePict
EnhancedMetafile
PNG+Office Art
JFIF+Office Art
GIF+Office Art
PNG
JFIF
GIF
(On a different computer I also saw DIB but that was at home :-)

Has anyone managed to do something like this? Or could someone give me a
nudge in the correct direction or group?

Thanks
Ben
Nov 20 '05 #1
1 2885
Cor
Hi Ben,

I never used in this way,
But for bringing a picture to an image it need to be readed as stream.

Something as (This is from a dataset)
Dim arrPicture() As Byte = CType(dspictabel.Tables(0).Rows(x)("pic"),
Byte())
Dim ms As New MemoryStream(arrPicture)
originalImage = Image.FromStream(ms)

I think you would do something in the same way,

Cor
I need to write a conversion routine to split pictures out of about 10000
word documents. (Actually the text is converted to RTF, the pictures should be converted to jpg).

I thought I could simply save the word doc as rtf and strip the picture.
That works. The problem is getting the picture to save correctly. I can use word to determine which pictures are in the original document and can get
them to the clipboard. I can't seem to be able to paste this into a
picturebox for further processing (selecting the correct picture etc.).

Code like
If Clipboard.GetDataObject.GetDataPresent(DataFormats .Bitmap, True)
Then
Dim i As Image
i = CType(Clipboard.GetDataObject.GetData(DataFormats. Bitmap,
True), Bitmap)
PictureBox1.Image = i
End If
won't work because the framework can't identify any of the formats as a
bitmap.

The formats I am seeing are
Office Drawing Shape Format
MetaFilePict
EnhancedMetafile
PNG+Office Art
JFIF+Office Art
GIF+Office Art
PNG
JFIF
GIF
(On a different computer I also saw DIB but that was at home :-)

Has anyone managed to do something like this? Or could someone give me a
nudge in the correct direction or group?

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by sendhil | last post: by
2 posts views Thread by George Yefchak | last post: by
7 posts views Thread by lgbjr | last post: by
2 posts views Thread by NickP | last post: by
1 post views Thread by bern11 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.