File import events

Posted by: mateusz.jagodzinski on 17 March 2021, 8:22 pm EST

  • Posted 17 March 2021, 8:22 pm EST

    Hi

    I'm using spreadJS v14.0.6 with React <Designer /> component.

    Through the designer (File -> Import; in the ribbon) user has the option to import files.



    I need a way to detect that this file import happened.

    Are there any specific events fired when file import is done?
    If no, in what other way I can detect that workbook has been replaced by a new one from file?

    Best Regards,
    Mateusz
  • Marked as Answer

    Replied 18 March 2021, 6:00 pm EST

    Hi Mateusz

    As of now the designer does not has this event but we have made an enhancement request on your behalf. We will update you on the development of this feature. The internal ID for this issue will be SJS-8049.

    Further as a workaround, you may override the fromJSON method. Please refer to the following code snippet and let us know if you face any issues.


    let old = GC.Spread.Sheets.Workbook.prototype.fromJSON;

    GC.Spread.Sheets.Workbook.prototype.fromJSON = function() {
    old.apply(this, arguments);
    console.log("JSON as been changed");
    spread = designer.getWorkbook();
    //You could also raise the custom event here
    };



    Regards
    Avinash
Need extra support?

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

Learn More

Forum Channels