.NETGURU
Using VB.Net or C#, utilizing the clipboard object, how to copy an MS Excel graphic from the clipboard to an image control and obtain its source reference
Messages   Related Types
This message was discovered on microsoft.public.dotnet.general.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

TC
Hello,

Here is what I'm trying to do:

-- Make sure both MS Excel and MS Word are running
-- Create an Excel chart
-- Save the Excel file
-- Copy the Excel chart onto the clipboard using Ctrl + C
-- Go to Word and look under Edit > Paste Special
-- Note there is a source reference and an option to paste the chart as a
metafile, etc.
-- I would like to take this same information and make it available in a C#
or VB.Net app

For example, create a simple Windows application with a userform, an image
control, a label and a single command button.

Let's say that after the Excel chart is on the clipboard, one clicks the
Windows application command button and Voila!, the imate control now
contains a copy of the Excel chart and the label contains the reference
information.

I can make this work utilizing older technologies (i.e. WIN API to access
the clipboard, etc.).

Currently, when I try to set the image control in C#, I get a "cannot
implicitly convert ..." blah blah error. Don't even know where to begin to
obtain the source reference.

Either I do not understand the currently available clipboard functionality
under .Net or this is still only possible via the WIN API.

Any assistance would be appreciated.

Best Regards,

Todd

Reply to this message...
 
    
BrianDH (VIP)
This may help some:
http://www.wizkil-webs.net/NET/DotNeT_Office_Samples.htm
B
"TC" wrote:

[Original message clipped]

Reply to this message...
 
    
Cor Ligthert
Hi TC,

Keep in mind that it is not important for dotNet how it is set on the
clipboard the only thing that is important what object is on the clipboard.

Here some links that should answer all your questions.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconDragDropClipboardSupport.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchimpdragdrop.asp

I hope this helps a little bit?

Cor

Reply to this message...
 
    
TC
Hey Cor & Other Folks,

OK, let me clarify a bit here.

Using the WIN32 API, there is a clipboard format called "OwnerLink".
Similarly to the .Net clipboard, one would register this format, check for
it on the clipboard and then retrieve using several API calls.

There are also clipboard formats called "Link Descriptor" and "Object
Descriptor" under WIN32.

I guess it fair to say that, under .Net, there are currently no methods or
properties available to extract a source reference when a user places an
Office object / graphic on the clipboard.

If there is a workaround, by all means, please share.

Best Regards,

Todd

"Cor Ligthert" <Click here to reveal e-mail address> wrote in message
news:eByIfJ%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
GirishKumar (VIP)
Hi Todd,

A class named ClipBoard is present in the namespace System.Windows.Forms. This class has only 2 methods - to set and get the content to and from ClipBoard. The Get method returns an IDataObject interface that has methods to identify the format of the clip board content, but not the reference information you needed.

Regards,--
Girish Kumar
ICICI Infotech

"TC" wrote:

[Original message clipped]

Reply to this message...
 
    
TC
Hey Girish,

Sorry for the delayed response.

I just wanted to thank you for the first very clear and direct answer to
this question.

Best Regards,

Todd

"GirishKumar" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

ClipBoard. The Get method returns an IDataObject interface that has methods
to identify the format of the clip board content, but not the reference
information you needed.
[Original message clipped]

Reply to this message...
 
    
GirishKumar (VIP)
Hi Todd,

It's nice to hear from you.

Regards,
Girish Kumar

"TC" wrote:

[Original message clipped]

Reply to this message...
 
    
Inbar (VIP)
You cannot do it this way, but you can do it in another manner.
What you need to do is create a new OLE object in your Word document and
link it to the chart you selected in Excel. This is done by manpulating the
Shape.LinkFormat object.

Inbar.

"TC" wrote:

[Original message clipped]

Reply to this message...
 
 
System.Windows.Forms.IDataObject




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification