Hi,
I'm trying to copy the contents of an HTML table to the clipboard in such a manner that it can be pasted into Excel, preserving rows and columns. At the moment, it's just one big lump of text.
I've had a good search of this site and google (where I got the copy to clipboard from) but have not turned up anything table related.
Here's my code to date (working except not in table format):
I can guarantee that the browsers using my page will be IE6 or above.
Any help much appreciated!
Thanks,
Graeme
"Just beacuse you're paranoid, don't mean they're not after you
I'm trying to copy the contents of an HTML table to the clipboard in such a manner that it can be pasted into Excel, preserving rows and columns. At the moment, it's just one big lump of text.
I've had a good search of this site and google (where I got the copy to clipboard from) but have not turned up anything table related.
Here's my code to date (working except not in table format):
Code:
function ClipBoard()
{
var rowcount = document.getElementById('grdResults').rows.length;
var copy = '';
for(var i = 0; i< rowcount; i++){
copy += document.getElementById('grdResults').rows[i].innerHtml;
}
window.clipboardData.setData('Text', copy);
}
I can guarantee that the browsers using my page will be IE6 or above.
Any help much appreciated!
Thanks,
Graeme
"Just beacuse you're paranoid, don't mean they're not after you