spread js in angular

Posted by: preetidubariya on 26 March 2020, 5:20 pm EST

  • Posted 26 March 2020, 5:20 pm EST

    how to export excel data in spreadjs into json file in angular?
  • Replied 29 March 2020, 11:30 pm EST

    Hi,

    You may use the toJSON()/fromJSON() methods to serialize/deserialize the SpreadJS workbook to/from JSON. Please refer to the following code snippet:
    let wbJSON = spreadInstance.toJSON();


    API Reference:
    • toJSON() method: https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Sheets.Workbook~toJSON.html

    Regards
    Sharad
  • Replied 30 March 2020, 1:12 am EST

    Hi ,

    toJson method is updating the data to display.but i want to store that data into my json file.how can i achieve that?

    Thanks for reply.

    Regards,
    Preeti
  • Replied 31 March 2020, 12:40 am EST

    Hi Preeti,

    toJSON method is not supposed to update the data. Could you please explain further what is the issue you are facing i.e what data is being updated when using the toJSON method.
    Further, you may also refer to the following sample demonstrating the usage of toJSON method in an angular application:
    https://stackblitz.com/edit/angular-wwvn5x?file=src%2Fapp%2Fapp.component.ts

    Regards
  • Replied 31 March 2020, 4:44 pm EST

    Hi Sharad,

    whenever any changes in spreadsheet occurs it should update the json data in background in the file from which i am fetching the data to display.

    Thank you.

    Regards,
    Preeti
  • Replied 5 April 2020, 6:05 pm EST

    Hi Preeti,

    In this case, you may handle the various events such as EditEnded, RangeChanged, ClipboardPasted etc. provided by the Spread API and update the data in the background. Further, could you please explain more about your requirement like is the JSON file is a JSON template for SJS or it is just the data needs to be displayed, do you need to update only the values in the JSON file or you need to save the styles info too or any other information you think would be useful in better understanding of the requirement.

    API reference:
    events provided by SpreadJS API: https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Sheets.Events.html
Need extra support?

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

Learn More

Forum Channels