Copying table headers if selected does not work

Hello,
I’m having problems copying table headers (handsontable v15.3.0). I had a similar issue here, but I opened new thread because it’s a different issue.

I want to be able to highlight table header cells and copy them, the same way as table data cells. Drag-selecting some table cells and header cells does not highlight/copy header cells. I tried shortcut ctrl+shift+space (select all cells and headers), but when copy pasting, it does not copy headers.

I know there is an option to use

let copyPastePlugin = hot.getPlugin("CopyPaste");
copyPastePlugin.copyWithColumnHeaders();

But this will copy headers every time (at least it should - see linked thread above), even if they’re not selected/highlighted.

EDIT: to be precise, I want to be able to copy with ctrl+c / ctrl+v. Using “copy with headers” in context menu will sadly not do.

Hi @kragelj.valentin

I’m not sure if I understand your problem correctly. Can you please send a code demo and steps how to reproduce it?

Yes sure, let’s take boilerplate hot example: hot example - JSFiddle - Code Playground

By default no cells and headers are selected

If we use shortcut to select whole table with headers, we see all cells and headers highlighted (in blue color)

But if I use ctrl+c and paste with ctrl+v to e.g. Microsoft Excel, the headers are not copied, only cells

I would expect headers to be copied also, since they are highlighted (in blue color).

Since this is not the case, I’d have to write some code so that headers get copied also. The solution to use copyWithColumnHeaders() is not correct, since this will copy headers even if they are not highlighted.