Reputation: 6582
I am using zeroclipboard to copy content from a div to my clipboard. This code
var zc_client = new ZeroClipboard( $('#copyButton'));
zc_client.on( 'ready', function(event) {
zc_client.on( 'copy', function(event) {
zc_client.setData("text/html",$("#result_div").html());
});
});
zc_client.on( 'error', function(event) {
ZeroClipboard.destroy();
} );
This is working well, except the copy process doesn't copy the styles associated with the stylesheet when I paste the results into word. On my screen, I see something like this
But when I click the copy button and paste in word, I see this
Is there a way to keep the formatting like I would if I manually selected the text and pressed CTRL C on my keyboard?
I've also tried
zc_client.setHTML($("#result_div").html());
zc_client.setRichText($("#result_div").html());
But these methods paste the text in a way that the tags appear.
Upvotes: 2
Views: 301