473,796 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetDa taObject.GetDat aPresent(DataFo rmats.Bitmap, True)
Then
Dim i As Image
i = CType(Clipboard .GetDataObject. GetData(DataFor mats.Bitmap,
True), Bitmap)
PictureBox1.Ima ge = 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
EnhancedMetafil e
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 3097
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(dspictabe l.Tables(0).Row s(x)("pic"),
Byte())
Dim ms As New MemoryStream(ar rPicture)
originalImage = Image.FromStrea m(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.GetDa taObject.GetDat aPresent(DataFo rmats.Bitmap, True)
Then
Dim i As Image
i = CType(Clipboard .GetDataObject. GetData(DataFor mats.Bitmap,
True), Bitmap)
PictureBox1.Ima ge = 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
EnhancedMetafil e
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3929
by: sendhil | last post by:
hi, Iam doing some graphics programming with C#. I have to create a Windows MetaFile from a base64 encoded string. How do i create the file. I want to Overlay this Windows MetaFile on a image which is present in a Picture box. Any ideas to do this? Thanks senthil
0
1622
by: Ben Leino | last post by:
Hi out there, I have a quite huge problem that I can't solve after huge "googeling and msdnning". Ich have a litte VB.NET class that opens a PowerPoint Presentation (COM) and wants to extract an image of one of its shapes. But i am not able to convert this Ehanced Metafile from Clipboard to real file on harddisk. For example jpg or bmp. Who can help? Code looks like this:
2
8019
by: George Yefchak | last post by:
Hi I need to retrieve a metafile image from the clipboard and render it as a bitmap in my application. In particular, an image will be placed on the clipboard by pasting from PowerPoint (I really do need to do this!). The original image is a bitmap, but PowerPoint doesn't place it on the clipboard as such. A call to GetFormats() indicates that MetafilePict and EnhancedMetaFile are available formats. The following does NOT work:
7
11641
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
1
2500
by: ray well | last post by:
hi, i need to give the user the ability to extract a rectangular area of their choice from a graphic displayed in a picture box to the clipboard, so they can use it elsewhere. say the graphic has an image of a house with a door in it and the user is interested in the door. the rectangle is selected by placing the mouse on the upper left corner of the door, pressing down on the left mouse button, and draging it to the lower right...
2
1733
by: NickP | last post by:
Hi there, I am obtaining a meta file from the clipboard via the following code Dim CF_ENHMETAFILE As Integer = 14 Dim cMFeImage As Imaging.Metafile Dim pIPrClipboard As IntPtr = OpenClipboard(Me.Handle)
2
2551
by: Alexander Gorbylev | last post by:
Hi! Let the size of vector is e.g. 3.5". I render the same vector on a printer & a screen on the same procedure: printDoc_BeginPrint(object sender, PrintEventArgs e) { .... vector.Width * g.DpiX ....
1
3637
by: bern11 | last post by:
I can get bitmaps from the clipboard, but how do I get Metafiles? The specific instance I am testing is copying a piece of Word clip-art into the clipboard and trying to read it in an application. It appears as a metafile type but isn't recognized as an image. Given: DataObject copyObject; copyObject = (DataObject)Clipboard.GetDataObject(); string types = copyObject.GetFormats();
20
7017
by: Joe Duchtel | last post by:
Hello - I have the following code to get a bitmap from the clipboard and to save it to a *.png file ... Dim lData As IDataObject = Clipboard.GetDataObject() If lData.GetDataPresent(DataFormats.Bitmap) Then Dim lPictureBox As New PictureBox
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10190
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.