开发者

How can I mimic CTRL+A, CTRL+C in WebBrowser Control through COM or JavaScript?

How can I mimic CTRL+A, CTRL+V in WebBrowser Control automatically via COM?

Alternatively, is there a way o开发者_如何学运维f simulating this behaviour using JavaScript?

I looked all over and it seems that the only way to put data into the clipboard is to use the setData() method of the clipboardData object, but I end up with HTML being interpreted as text. What I need is to put an entire webpage into the clipboard so it can be pasted into MS Word.


This answer was discovered by the OP and posted as an update to the question. Just moving it here for semantics.

Here's the solution in JavaScript (can be used through COM as well):

window.document.execCommand('SelectAll',true);
window.document.execCommand('Copy',true);
window.document.execCommand('UnSelect',true);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜