Automatically Import and Export SSJSON from/to server

Posted by: vinayakbagi on 2 April 2020, 7:49 pm EST

  • Posted 2 April 2020, 7:49 pm EST

    • “How can I programmatically Import SSJSON from server and Export SSJSON to server using the latest version of SpreadJs?”

    • “Which SpreadJs product is best suitable to implement this functionality?”

    I am using Angular for frontend and Node.JS for backend.

  • Posted 5 April 2020, 11:23 pm EST

    Hi Vinayak,

    SpreadJS is a pure client-side library and it is not opinionated about the type of backend/techniques you use.to save files. So to save/restore JSON all you need to do is use the toJSON() method to get the JSON of the workbook and fromJSON(_) method to load the saved JSON. You may refer to the following code snippet:

    // save json
    // get json
    let wbJSON = spreadInstance.toJSON();
    // send wbJSON to server to save to file, you may use fetch API or angular's HttpClient according to your project's requirement
    // you may use the JSON.strigify method if the server expects a json string
    this.httpClient.post("url_to_send_data", wbJSON).subscribe(() => {
        alert("uploaded to server");
    });
    
    // load json from server
    // get json from server, user fetchAPI or HttpClient
    this.httpClient.get("url").subscribe(data => {
        // let receivedJSON = data;
        // use json.parse if backend returns json string
        // load json into spread
        spreadInstance.fromJSON(receivedJSON);
    });
    

    Regards

    Sharad

  • Posted 7 April 2020, 2:38 am EST

    I need to implement this using which of the SpreadJs product?

  • Posted 7 April 2020, 3:59 pm EST

    You only need to use the SpreadJS.

  • Posted 8 April 2020, 9:17 pm EST

    Hi Sharad,

    Thanks for the details.

    I have gone through your products and SpreadJs Designer is the one which meets our requirements.

    Can you please share the Link of demo code for SpreadJs Designer so that I can test the above functionalities and make an Angular POC.

  • Posted 8 April 2020, 10:50 pm EST

    Hi Vinayak,

    Thank you for evaluating SpreadJS.

    We are sorry but as part of our licensing policy, we do not provide demo code for Designer, however, you may test the designer using the following online demo:

    https://www.grapecity.com/spreadjs/designer/content/index.html

    Further, please note that SJS Designer is not an angular application, it is written using pureJS and JQuery. After purchasing the designer license, you become entitled to get the source code for the Designer which you may modify further according to your requirement.

    Feel free to ask if you have any doubts.

Need extra support?

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

Learn More

Forum Channels