GoView (Web 2.2.1) CopyToClipboard


#1

Hi I am having real trouble copying a Goview to the clipboard.
Scenario:
We have a Subclassed GoView and three speciallialy subclassed goObject, 2 based of Iconic Node and 1 Based off link. I have added the attribute [Serializeable] to each of the classes (all four of them including the goview).
I have a button “Copy to Clipboard” which server side event is defined as
Viewer1.CopyToClipboard(Viewer1.Document);
From what I read in the documentaition this creates a copy of the data internally for re-pasting inside the goview, however I need to be able to paste the image generated by CreateBitmapFromCollection into a program something like MSpaint, MS Word etc.
Is Copy functionality as simple as I thought, or am I missing a major point and that is why it is not working?
Thanks,
Paul


#2

The clipboard used by GoWeb is just a session variable holding the document created by GoView.CopyToClipboard. This is state that is held on the server, so there’s no possible communication with any other application on the client.
If there were, that would be a serious security hole.
But you might be able to implement something on the client using JavaScript. I don’t know if clipboardData.setData would do what you want.


#3

[Quote From Docs]
To facilitate pasting into regular (not GoDiagram) documents, the collection is also drawn into a bitmap, using GetBitmapFromCollection, and that bitmap is inserted into the clipboard as an alternative data format.
[End Quote]
I am presuming this means that the clipboard data is held only on the server and can never reach the users browser? The way I understood (from the WebIntro) is that a user can paste through the browser and copy the image through the browser?
The issue that we have is that our clients would like to be able to paste our diagrams into something like MSWord.


#4

Ooops–that’s a documentation error; that part should have been #if’d to be WINFORMS only, not WEBFORMS. Same thing with the documentation for PasteFromClipboard.
[And on the .NET Compact Framework (for the PocketPC), it’s implemented in yet a third manner.]
Anyway, you might want to look into the clipboardData object in JScript.


#5

Solution:
You can use this functionality in IE
function CopyImgToClipboard(ID)
{
var e = document.getElementById(ID);
var r = document.body.createControlRange();
r.add(e);
r.select();
r.execCommand(“COPY”);
}