Flexgrid Export Excel Format Columns

Posted by: 048alexsandr1992 on 10 October 2017, 7:27 pm EST

    • Post Options:
    • Link

    Posted 10 October 2017, 7:27 pm EST

    Hi,

    I have column with type boolean.

    And my task - localization values in this column when I use

    wijmo.grid.xlsx.FlexGridXlsxConverter.save

    how to do it?

  • Posted 11 October 2017, 8:54 pm EST

    Hi Alex,

    Could you please elaborate your requirement so that we can assist you? What you mean from “My task-Localization values in this column”

    ~Manish

  • Posted 11 October 2017, 9:12 pm EST

    I mean that data in grid must be translated in selected language.

    But if in grid I use method itemFormatter for this task, then in wijmo.grid.xlsx.FlexGridXlsxConverter.save nothing like.

  • Posted 12 October 2017, 3:23 pm EST

    Hi Alex,

    You can use formatItem property and assign function with custom formatting and content. For reference, please refer to the following code snippet:

    function exportFormatItem(args) {
            var p = args.panel,
                row = args.row,
                col = args.col,
                xlsxCell = args.xlsxCell,
                cell, color;
    
            if (p.cellType === wijmo.grid.CellType.Cell) {
                if (p.columns[col].binding === 'color') {
                    if (xlsxCell.value) {
                        if (!xlsxCell.style.font) {
                            xlsxCell.style.font = {};
                        }
                        xlsxCell.style.font.color = xlsxCell.value.toLowerCase();
                    }
                } else if (p.columns[col].binding === 'active' && p.rows[row] instanceof wijmo.grid.GroupRow) {
                    cell = args.getFormattedCell();
                    xlsxCell.value = cell.textContent.trim(); // custom content
                    xlsxCell.style.hAlign = wijmo.xlsx.HAlign.Left; //styling
                }
            }
        }
    
    function export(){
    	wijmo.grid.xlsx.FlexGridXlsxConverter.save(grid, {
                includeColumnHeaders: true,
                includeCellStyles: false,
                formatItem:exportFormatItem
            }, 'FlexGrid.xlsx');
    }
    

    Please include JSZip file for enabling Excel Export feature.

    You may also refer to the demo sample for the same.

    http://demos.wijmo.com/5/Angular/ExcelImportExport/ExcelImportExport/FlexGridImportExport.htm

    ~Manish

Need extra support?

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

Learn More

Forum Channels