We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Import / Export to function/json instead of excelUrl

Thread ID:

Created:

Updated:

Platform:

Replies:

121883 Feb 3,2016 06:10 AM Feb 4,2016 07:57 AM JavaScript 1
loading
Tags: ejSpreadSheet
fm
Asked On February 3, 2016 06:10 AM

Hi

Is there a way to export and import json data instead of the exportUrl to a server? I analized the json data thtat is posted to the server and I would like to intercept this data on the client and store it somewhere and not create an excel file. I would like to import this json data later without having to call a server.

is this possible or is there a plan to implement this?

Kind regards,

Freddy

Silambarasan I [Syncfusion]
Replied On February 4, 2016 07:57 AM

Hi Freddy,


Thank you for your interest in Syncfusion products.


Your requirement “Spreadsheet Import in JSON Format” is feasible and can be achieved by using “loadFromJSON” client-side method.  Currently, we don’t have API for export the Spreadsheet in JSON format.  However, we have already considered this is an improvement task and created the improvement task for “Spreadsheet Export in JSON Format”.  This fix will be included in our Essential Studio 2015 Volume 4 Service pack 1.


Meanwhile, we have created a workaround for your requirement “Import and Export the Spreadsheet as JSON data” has been achieved. Please refer the below code snippets.


CODE SNIPPET:


[HTML]

<table>

<tr>

    //...

            <table>

                //...

                    <td>

                        <input type="text" id="ExportName" />

                    </td>

                    <td>

                        <button id="getJsonBtn" onclick="getJSONData()">Get JSON</button>

                    </td>

               //...

                    <td>

                        <select id="loadJsonDD" onchange="loadJSONData(this)">

                            //...

                        </select>

                    </td>

               </table>

    //...

</tr>

</table>

//...

<div id="Spreadsheet"></div>


[SCRIPT]

window.localData = {

    //...

};


$(function () {

    $("#Spreadsheet").ejSpreadsheet({

        //...

        loadComplete: "loadComplete"

    });

});


function loadComplete(args) {


    //Here extend the ejSpreadsheet.Extension

    $.extend(this, ej.spreadsheetFeatures.extension);

}


function loadJSONData(args) {

    var xlObj = $("#Spreadsheet").data("ejSpreadsheet"), name = args.value;


    if (window.localData[name])

        //Import JSON data here

        xlObj.loadFromJSON(window.localData[name]);

}


function getJSONData(args) {

    var xlObj = $("#Spreadsheet").data("ejSpreadsheet"), name = $("#ExportName").val(), JSONData;


    //Export as JSON data

    JSONData = xlObj.saveAsJSON();


    if (name.length && JSONData) {

        //Store JSON data locally

        window.localData[name] = JSONData;

        //...

    }

}


Sample Link: http://www.syncfusion.com/downloads/support/forum/121883/ze/SampleApplication1631086689


Please let us know if you have any further assistance.


Regards,

Silambarasan I


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;