This is a migrated thread and some comments may be shown as answers.

Copy to clipboard

3 Answers 201 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Artemis
Top achievements
Rank 1
Artemis asked on 09 Oct 2016, 07:42 PM

Hi.

I want to put a button on the form that would copy the chart to the clipboard, so that I can paste it to MS Office apps.

I know there is an export function, but is there a way to do a copy to clipboard?

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Oct 2016, 09:02 AM
Hello Artemis,

Thank you for writing.  

The possible solution that I can suggest is to export RadChartView to an image and set this image to Clipboard. The following help article is quite useful about the export functionality: http://docs.telerik.com/devtools/winforms/chartview/features/export

You can refer to the following stackOverflow thread where it is discussed how to set an image to Clipboard: http://stackoverflow.com/questions/16964152/how-do-i-put-an-image-on-the-clipboard

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Artemis
Top achievements
Rank 1
answered on 11 Oct 2016, 02:29 PM

Hi Dess.

I have been able to export the image to a stream using the following code:

 Dim ms As New System.IO.MemoryStream
 Me.RadChartView1.ExportToImage(ms, Me.RadChartView1.Size, System.Drawing.Imaging.ImageFormat.Jpeg)

However, the code does not work for emf image format.

If I use the code:

 Dim ms As New System.IO.MemoryStream
Me.RadChartView1.ExportToImage(ms, Me.RadChartView1.Size, System.Drawing.Imaging.ImageFormat.Emf)

I get the following error:

System.ArgumentNullException: Value cannot be null.

Parameter name: encoder 

I get the same error when I try to export to file in emf format:

 Me.RadChartView1.ExportToImage(dialog.FileName, Me.RadChartView1.Size, System.Drawing.Imaging.ImageFormat.Emf)

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Oct 2016, 10:20 AM
Hello Artemis, 

Thank you for writing back. 

The ExportToImage method tries to save a Bitmap to the specified format. However, it seems that saving emf files should be handled in a different way. Please refer to the following stackOverflow threads: 

http://stackoverflow.com/questions/152729/gdi-c-how-to-save-an-image-as-emf
http://stackoverflow.com/questions/5270763/convert-an-image-into-wmf-with-net

I have logged it in our feedback portal and I have added a vote for it on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to use one of the other ImageFormats.

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
ChartView
Asked by
Artemis
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Artemis
Top achievements
Rank 1
Share this question
or