Posted 2 April 2018, 5:12 am EST
Hi Gopala,
The solution provided above works fine for the use case it was written for.
As for your use case, you need to copy the grid’s style with data which is much more complicated. Currently styles are not allowed to be copied with grid’s data. The workaround is to create your own clipboard string from the cell data.
const r1 = (this.flex.selection.row > this.flex.selection.row2) ? this.flex.selection.row2 : this.flex.selection.row ;
const r2 = (this.flex.selection.row > this.flex.selection.row2) ? this.flex.selection.row : this.flex.selection.row2 ;
const c1 = (this.flex.selection.col > this.flex.selection.col2) ? this.flex.selection.col2 : this.flex.selection.col;
const c2 = (this.flex.selection.col > this.flex.selection.col2) ? this.flex.selection.col : this.flex.selection.col2;
let clipString = '<table>{0}</table>';
for (let i = r1; i <= r2; i++) {
let clipRow = '<tr>{1}</tr>';
for (let j = c1; j <= c2; j++) {
clipRow = clipRow.replace('{1}', '<td>' + this.flex.getCellData(i, j, true) + '<td>{1}');
}
clipRow = clipRow.replace('{1}', '');
clipRow = clipRow + '{0}';
clipString = clipString.replace('{0}', clipRow);
}
clipString = clipString.replace('{0}', '');
~nilay
PS: setting custom clipboard strings are beyond scope of flexgrid.