zidane
zidane

Reputation: 632

How to copy image of a chart from Silverlight application to clipboard?

I have a Silverlight 3.0 applications with some custom graphics and some charts. I need to find the best way to transfer these graphics to a PowerPoint presentation.

I've read that Silverlight 4.0 offers a Clipboard API, but there is only support for Unicode-text, not images.

Is there a way to achieve this task without forcing users to manually PrtSc and than paste to other applicatons?

Upvotes: 3

Views: 2926

Answers (2)

mangokun
mangokun

Reputation: 5623

If True = HtmlPage.IsPopupWindowAllowed Then
HtmlPage.PopupWindow(New Uri("http://www.yourdomain.com/chartgenerator.ashx?param1=value1&param2=value2"), "new", options)
End If

chartgenerator.aspx can either display an image:

' tell the browser to display inline

context.Response.AddHeader("Content-Disposition", "inline; filename=" & FilenameWithExt)

or display an Open, Save, Cancel dialog:

' tell the browser to save rather than display inline

context.Response.AddHeader("Content-Disposition", "attachment; filename=" & FilenameWithExt)

quoted from http://vbcity.com/blogs/mike-mcintyre/archive/2010/02/28/silverlight-3-pop-up-new-browser-window.aspx

Upvotes: 1

Todd Main
Todd Main

Reputation: 29153

There's no simple way to do this in SL3. My recommendation would be to use a WriteableBitmap and save that to IsolatedStorage and then prompt the user with a FileSave Dialog to save to their box (and then they would have to put it in PowerPoint). The only problem with that Dialog in SL3 is that it doesn't allow you to set the extention type so they would need to type in the PNG or JPG extention. Both this and the PrtSc, Ctrl+P require multi-step user action and that is always a point of failure.

In SL4 there are more choices - you don't even need the Clipboard in an SLOOB. You can just use AutomationFactory to automate PowerPoint.

Upvotes: 2

Related Questions