Select page in word copy it to clipboard and paste it in paint

I

Immi Immens

Hi,

I want to create a image out of a selected page in word.
Manually I do it with copy in word and paste in paint and save it.
This page contains different formats (IDataObject.GetFormats())

Now I like to have this done by a little program.
I have already done the page select in word and copy it to clipboard.
I don't know how to control paint in C#.

How can the clipboard be copied in paint?
How can I save the image with a file name I've chosen in my program?

I've also looked for a method which creates a image out of clipboard like paint.


Best regards

Immanuel
 
B

bradbury9

El martes, 11 de septiembre de 2012 11:07:29 UTC+2, Immi Immens escribió:
Hi,



I want to create a image out of a selected page in word.

Manually I do it with copy in word and paste in paint and save it.

This page contains different formats (IDataObject.GetFormats())



Now I like to have this done by a little program.

I have already done the page select in word and copy it to clipboard.

I don't know how to control paint in C#.



How can the clipboard be copied in paint?

How can I save the image with a file name I've chosen in my program?



I've also looked for a method which creates a image out of clipboard likepaint.





Best regards



Immanuel

I know I am not answering your question but...

Why do you bother opening paint?
Once you have the image in the cliboard you can call Clipboard.GetImage andthen save it with Image.Save.
MSDN:
http://msdn.microsoft.com/en-us/library/system.windows.forms.clipboard.getimage.aspx
http://msdn.microsoft.com/es-es/library/system.drawing.image.save(v=vs.80).aspx

Sample using those: http://www.csharphelp.com/2007/05/save-picture-from-clipboard-to-file-using-c/
 
I

Immi Immens

Hi bradbury9,

Thank you for the answer.

This will work also with text elements?
I thought that Clipboard.GetImage extracts the image files out of my clipboard.

And because of the other elements, I asked for a method like paint, to create images.


Kind regards

Immanuel
 
B

bradbury9

This will work also with text elements?

Just check the Clipboard class, It has methods to get different types o object, including text.
 
I

Immi Immens

Hi again,

I've spent some time to Clipboard class.
I can copy a single image or a single text. I can't handle it when I've copied images and text to clipboard.
I'll try to upload a sample-file.
 
B

bradbury9

El miércoles, 12 de septiembre de 2012 15:14:09 UTC+2, Immi Immens escribió:
Hi again,



I've spent some time to Clipboard class.

I can copy a single image or a single text. I can't handle it when I've copied images and text to clipboard.

I'll try to upload a sample-file.

yeah, that is Windows behaviour, windows can have only one item in clipboard. There are some solutions to workaround that issue that monitor the clipboard events using windows API. They subscribe to the Copy event and store in memory the element that is being inserted into the clipboard. Check this out: http://stackoverflow.com/questions/3229834/clipboard-monitor-c-sharp
 
I

Immi Immens

Hi bradbury,

I've made a workaround. I saved this page as xps and then used a tool to create jpg. Thank you for your hints and your time.


best regards

Immanuel
 
B

bradbury9

El jueves, 13 de septiembre de 2012 10:46:53 UTC+2, Immi Immens escribió:
Hi bradbury,



I've made a workaround. I saved this page as xps and then used a tool to create jpg. Thank you for your hints and your time.





best regards



Immanuel

Glad to help ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top