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