When exporting wijmo flexsheet using angular styling not working

Posted by: teenu.k on 17 September 2019, 4:29 am EST

    • Post Options:
    • Link

    Posted 17 September 2019, 4:29 am EST

    Hi,

    In my html i have,

    <wj-flex-sheet #flex [itemFormatter]=“itemFormatter” (initialized)=“flexInitialized(flex)”>

    <wj-sheet [name]=“‘Data’” [itemsSource]=“reportData” >

    </wj-flex-sheet>

    In component.ts file i have ,

    [b]itemFormatter = function (panel, r, c, cell) {

    if(panel.rows[r].dataItem != undefined){

    if( (r ==( panel.rows.length-1) &&

    (panel.rows[r].dataItem.stateCode == “Grand Total” || panel.rows[r].dataItem.programName == “Grand Total”))

    || (panel.rows[r].dataItem.county == “Total”) || (panel.rows[r].dataItem.zip == “Total”) || (panel.rows[r].dataItem.stateCode == “Total”)){

             cell.style.fontWeight="bold";
      }
    }
    

    }

    excellExport() {

    this.flexsheet.saveAsync(this.globals.reportmenu+“-”+this.selectedMonth);

    }[/b]

    When I export it as excel styling is not working in downloaded file using angular 7.

    Regards,

    Teenu

  • Posted 17 September 2019, 11:46 pm EST

    This is limitation of FlexSheet. FlexSheet only exports the cell style set by ‘applyCellsStyle’ method of FlexSheet .

    I would suggest using the applyCellsStyle() method.

    https://www.grapecity.com/wijmo/api/classes/wijmo_grid_sheet.flexsheet.html#applycellsstyle

  • Posted 18 September 2019, 3:34 am EST

    Hi,

    can you provide a sample for changing fontweight to bold using applyCellsStyle() method in itemFormatter function.

    below shows my itemformatter function,

    [b]itemFormatter = function (panel, r, c, cell) {

    if(panel.rows[r].dataItem != undefined){

    if( (r ==( panel.rows.length-1) &&

    (panel.rows[r].dataItem.stateCode == “Grand Total” || panel.rows[r].dataItem.programName == “Grand Total”))

    || (panel.rows[r].dataItem.county == “Total”) || (panel.rows[r].dataItem.zip == “Total”) || (panel.rows[r].dataItem.stateCode == “Total”)){

    cell.style.fontWeight=“bold”;

    }

    }

    }[/b]

    Regards,

    Teenu

  • Posted 19 September 2019, 3:33 am EST

    Hi Teenu,

    Please find the following demo sample for the same.

    https://stackblitz.com/edit/angular-hbzqxe?file=src/app/app.component.ts

    Regards,

    Manish Gupta

Need extra support?

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

Learn More

Forum Channels