Copy Selected Cells With Format

Posted by: hoang.nguyen on 21 November 2017, 8:38 am EST

  • Posted 21 November 2017, 8:38 am EST

    Is there a way to copy range of cells selected with format to windows clipboard for pasting onto Excel? Thank you very much.
  • Replied 21 November 2017, 3:29 pm EST

    Hi Hoang,
    As default, you can copy data from FlexGrid for selected cells with the applied format in cells. Please refer to the demo sample, select cells to copy data and paste to excel after copying.


  • Replied 22 November 2017, 2:16 am EST

    Good Morning Manish,

    I have browsed the url you provided but cannot find anything about copy & paste selected cells with data. I have also tried to select some cells on each grid, press Ctrl + C, open Excel and press Ctrl + V

    This will paste text only but not data and format. Am I missing anything here sir?
  • Replied 22 November 2017, 3:37 pm EST

    HI Hoang,
    We tried to copy data from FlexGrid and paste to the Excel file, it get pasted with format except date since date pasted in excel pick system format.

    Please refer to the screencast for the same:

  • Replied 27 November 2017, 2:46 am EST

    Thank you Manish for yur help. I have tried it but it does not work. For example, if your flexgrid has some cells with blue color, some with red, green .... icon, ... when you copy and paste, you can only pasting data but not the format such as background color or image/icon ... etc...
  • Replied 27 November 2017, 5:50 pm EST


    I see you meant 'style format'. Sorry, styles are not copied to clipboard. But you can always use flexgrid's clipboard events to add additional behaviours.


  • Replied 28 November 2017, 9:07 am EST

    Thank you Nilay very much. If you can, please give me an example of how to add additional info into copying method/event.
  • Marked as Answer

    Replied 3 December 2017, 8:24 pm EST


    Please refer this case:

  • Replied 27 March 2018, 7:53 am EST

    I tried it doesnot work. I have a copy button on UI and when I click I need to copy entire wijmo grid with styles so that user can do Ctrl+V and paste it into Outlook email or excel sheet or word document or text editor... How to do this...
  • Replied 1 April 2018, 8:13 pm EST

    Hi Gopala,

    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}', '');


    PS: setting custom clipboard strings are beyond scope of flexgrid.
  • Replied 2 April 2018, 3:56 am EST

    I will try and let you know...
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels