Spread 9. Export to Excel file by excelIO but not return data in sheet

Posted by: thai on 23 January 2019, 1:08 pm EST

  • Posted 23 January 2019, 1:08 pm EST

    Hi,
    I using template by Spread Desinner
    spread = new GC.Spread.Sheets.Workbook(document.getElementById("ShowSpread"), { sheetCount: 1 });

    , and get data to Speard then setDataSource to activeSheet
    spread .getActiveSheet().setDataSource(data, false);// data is list object

    In MVC view page not problem but when using export excel file not content data in excel file.
    var json = JSON.stringify(spread.toJSON());
    excelIO.save(json, function (blob) {
    saveAs(blob, FileName);
    //return old value;
    spread = oldSpread;
    }, function (e) {
    if (e.errorCode == 1) {
    alert(e.errorMessage);
    }
    });
  • Marked as Answer

    Replied 24 January 2019, 11:26 pm EST

    Hello,

    You need to include 'includeBindingSource" option while exporting sheet to JSON. For example:

     $("#saveExcel").click(function () {
    var serializationOption = {
    ignoreFormula: false,
    ignoreStyle: false,
    columnHeadersAsFrozenRows: true,
    includeBindingSource: true
    };

    var json = spread.toJSON(serializationOption);
    excelIo.save(json, function (blob) {
    saveAs(blob, "ExcelWithFormula.xlsx");
    }, function (e) {
    // process error
    console.log(e);
    }, {

    })
    };


    Thanks,
    Deepak Sharma
Need extra support?

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

Learn More

Forum Channels