Saving column headers in clipboard

I use this code to save the grid selection area to the clipboard:
function onKeyPressed(code,ctrl,shift){
if(code==67&&ctrl){
if (!_mygrid._selectionArea)
return alert(“You need to select a block area in grid first”);
_mygrid.enableCSVHeader(true);
_mygrid.setCSVDelimiter("\t");
_mygrid.copyBlockToClipboard();
}
if(code==86&&ctrl){
_mygrid.pasteBlockFromClipboard();
}
return true;
}

How can I get it to save the column headers to the clipboard also? _mygrid.enableCSVHeader(true); doesn’t do it.

Thanks!

enableCSVHeader controls header during CSV serialization, but copyBlockToClipboard copies only selected data, so it doesn’t affected by enableCSVHeader option.

You can access column labels directly ( through getColumnLabel ) and use

var val = grid.fromClipboard(); val = some + val grid.toClipboard(val);