Copy range (including format) from FlexSheet and generate a new FlexGrid

Posted by: javier.cintron on 30 May 2018, 7:55 am EST

    • Post Options:
    • Link

    Posted 30 May 2018, 7:55 am EST

    Hi,

    I want to copy a range of cells, including the format, from a FlexSheet and generate a new FlexGrid with the exact format representation from the FlexSheet. Another option could be to generate a new FlexGrid with the FlexGrid behind the FlexSheet. It is possible to use ```

    flexSheet.selectedSheet.grid

    
    Thank you in advance!
  • Posted 30 May 2018, 11:23 pm EST

    Hi,

    You can get the format and other column info via the columnLayout property and then use that info to generate the grid.

    Please refer to the following sample for the same:-

    https://stackblitz.com/edit/angular-jjcwhn?file=app%2Fapp.component.ts

    ~Manish

  • Posted 11 June 2018, 3:03 pm EST

    That works if the sheet has a data source bind to it.

    getSelColLayout(flex){
        var colLayout=JSON.parse(flex.columnLayout);
        colLayout.columns.forEach(col=>{
          if(flex.selection.containsColumn(flex.getColumn(col.name).index)){
            col['visible']=true;
          }else{
            col['visible']=false;
          }
        });
        return JSON.stringify(colLayout);
      }
    

    This code can’t work with what I need. the columns don’t have a name or a binding because I’m loading directly in the FlexSheet an excel file.SalesmenSales.zip

    That is the Excel file I’m using to loaded into FlexSheet. I should select any cells from any sheet of the file and generate a FlexGrid with the exact format and values of the selected cells.

  • Posted 12 June 2018, 10:47 pm EST

    Hi,

    For unbound sheets, column should be created for selected columns first. Then, set data for FlexGrid.

    For reference, please refer to the following sample:

    https://stackblitz.com/edit/angular-rdhtqh?file=app%2Fapp.component.ts

    ~Manish

Need extra support?

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

Learn More

Forum Channels