S
SirCodesALot
hi all,
I am trying to copy the contents of a div to the clip board the same
way that Microsoft copies it when you select the contents with the
mouse and select copy. However, something is not the same.
here is the code simplified:
var s = document.getElementById("testDiv").innerHTML;
if( window.clipboardData && clipboardData.setData )
{
clipboardData.setData("text", s);
}
If I use this method to copy to clipboard, then to Word, i get:
<TABLE><TBODY><TR><TD>text</TD></TR></TBODY></TABLE>
however, if I select the table with the mouse, select copy, and paste
in to word, the actual table shows up like it did in the web page.
Any way to make the clipboard put the html in the correct format that
word wants?
Thanks,
-Scott
I am trying to copy the contents of a div to the clip board the same
way that Microsoft copies it when you select the contents with the
mouse and select copy. However, something is not the same.
here is the code simplified:
var s = document.getElementById("testDiv").innerHTML;
if( window.clipboardData && clipboardData.setData )
{
clipboardData.setData("text", s);
}
If I use this method to copy to clipboard, then to Word, i get:
<TABLE><TBODY><TR><TD>text</TD></TR></TBODY></TABLE>
however, if I select the table with the mouse, select copy, and paste
in to word, the actual table shows up like it did in the web page.
Any way to make the clipboard put the html in the correct format that
word wants?
Thanks,
-Scott