I am trying to add column headers when the user copies data from a ng2-handsontable. The before copy event fires and I am able to change the data in the event but it doesn't change what is copied to the clip board.
https://docs.handsontable.com/pro/1.14.2/Hooks.html#event:beforeCopy
This is the simplified version I am trying to get working first. I am always selecting all 4 columns.
private beforeCopy(e: any) {
// e[0] is an array of the data
// e[1] is an array of the coords
var headers = ["Step 1", "Step 2", "Step 3", "Step 4"];
e[0] = [headers, ...e[0]];
e[1][0] = { endCol: headers.length-1, endRow: e[0].length-1, startCol: 0, startRow: 0};
}
Super simple version to test if can change the data at all:
private beforeCopy(e: any) {
// e[0] is an array of the data
// e[1] is an array of the coords
e[0][0][0] = "test";
}
Both functions execute but in the end the data on the clipboard is still unedited data.