saveAsync method doesn't export col header for flexsheet

Posted by: chandrasekar_keerthana on 3 December 2019, 6:16 pm EST

    • Post Options:
    • Link

    Posted 3 December 2019, 6:16 pm EST - Updated 3 October 2022, 9:34 am EST

    Hi Team,

    I’m trying export my flexsheet to excel using the below method.

    wijmo.grid.xlsx.FlexGridXlsxConverter.saveAsync(flexsheet, { sheetName: ‘flex’, includeColumnHeaders: true, includeCellStyles: false });

    It was working fine with previous wijmo versions. But after integrating the latest one, wijmo-5.20192.631, it is only displaying the alphabetical col headers in the export.

    Please find attached a screenshot of the export.

    Thanks,

    Keerthana

  • Posted 4 December 2019, 3:17 pm EST

    Hi Keerthana,

    Could you provide us with the screenshot of the FlexSheet so that we can mimic it and try to replicate the issue?

    Also, FlexSheet provides an inbuilt saveAsync method. So, I would suggest you use this method to export the FlexSheet.

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

    Regards,

    Ashwin

  • Posted 4 December 2019, 7:48 pm EST

    Hello Ashwin,

    We’re saving 9 workbooks using the async method and pushing it into a single workbook. There are nearly 50k records in one of the sheets and 10k records in each of the other sheets. Flexsheet.save() method was breaking with this amount of data, that’s the reason we went for the async save. PFB the flexsheet we use.

    sheet = new wijmo.grid.sheet.FlexSheet(“#” + id );

    Data = new wijmo.collections.ObservableArray();

    sheet.addBoundSheet(‘Flex’, Data, 0, grid);

    Please let me know how to use the flesheet’s async method without the jszip file with the below specifications:

    wijmo.grid.xlsx.FlexGridXlsxConverter.saveAsync(flexsheet, { sheetName: ‘flex’, includeColumnHeaders: true, includeCellStyles: false });

    Thanks,

    Keerthana

  • Posted 5 December 2019, 10:18 pm EST

    Hi Keerthana,

    As mentioned by Ashwin, flexSheet also provides saveAsync() method to allow async exports. Is there any particular reason why you are not using the flexSheet.saveAsync() method?

    Also, FlexGridXlsxConverter is expected to work correctly with the FlexGrid, passing FlexSheet instance may result in unexpected behavior. If you are trying to export the FlexSheet in multiple parts then you may create multiple FlexSheet just like in the code snippet you shared and then instead of using the FlexGridXlsxConverter to export the sheet may use the flexSheet.saveAsync() method.

    Regards

    Sharad

  • Posted 9 December 2019, 1:51 am EST

    Hi Team,

    Can you please help me implement the saveAsync method for flexsheet in the below snippet.

    https://codesandbox.io/s/mutable-surf-46dzw

    I need to save with a specific sheetName.

    Thanks,

    Keerthana

  • Posted 9 December 2019, 4:07 pm EST

    Hi Keerthana,

    The saveAsync method of the FlexSheet returns an instance of the Workbook class. You can easily get the reference to all the Sheets in the FlexSheet and change their name using this instance of the Workbook:

    var wb = flexSheet.saveAsync();
    wb.sheets[wb.activeWorksheet].name = 'flex';
    wb.saveAsync('FlexSheet.xlsx');
    

    Refer to the updated sample below:

    https://codesandbox.io/s/admiring-benz-2eff7

    ~regards

  • Posted 9 December 2019, 11:09 pm EST - Updated 3 October 2022, 9:34 am EST

    Hi,

    The above code when I use in my application throws the assertion failed error. PFB the screenshot for the same.

    sheet = new wijmo.grid.sheet.FlexSheet(“#” + id );

    Data = new wijmo.collections.ObservableArray();

    var grid= new wijmo.grid.FlexGrid(hostElem, {

    autoGenerateColumns: false,

    columns: });

    sheet.addBoundSheet(‘Flex’, Data, 0, grid);

    sheet.saveAsync();

    Thanks,

    Keerthana

  • Posted 10 December 2019, 4:06 pm EST

    Hi Keerthana,

    The error is thrown because you are using JSZip version 2., which is not compatible with exporting the sheet to excel asynchronously. To resolve this issue, simply update your JSZip to any 3. version.

    ~regards

  • Posted 10 December 2019, 10:06 pm EST

    Thanks for your help Ashwin.

Need extra support?

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

Learn More

Forum Channels